Generic KVS feed-server
Feed server for KVS abstract database middleware.
Implements database queries in the form of atomic operations or in other words, provides transaction for KVS-feeds logic.
log :: {Mod,Fun}
– Custom loggingfunction/3
, default:{wf,info}
feed_timeout :: non_neg_integer()
– Pool worker timeout, in ms, default:600000
(10 min)feed_timeout_action :: hibernate | stop
– Action for inactive pool workers, default: hibernate
append(Record)
– AddRecord
to database.delete(Record)
– RemoveRecord
from database.update(Record,Fun)
– UpdateRecord
withFun/1
which takesRecord2
(at the time of execution) and should return{ok,Record3}
(modified) if surgery is to be performed, or anything else to cancel.relink(Record)
– BringRecord
to top inRecord
feed.purge(Record,Fun)
– RemoveRecord
and related feeds withFun/0
which should return a list of feeds, example:kvs_feeds:purge(E,fun() -> [{feed,attachments,fun kvs_feed:delete/1}] end)
,feed_id
to be deleted will be generated as{attachment,element(2,E)}
forfeed
container table.eval(Record,Fun)
– Eval customFun/1
which takesRecord2
(at the time of execution), like asupdate/2
.
R=#post{},
{ok,R2}=kvs_feeds:append(R),
Link = 1000,
FunUpdate=fun(#post{links=Links}=P) -> {ok,P#post{links=lists:usort([Link | Links])}} end,
{ok,R3}=kvs_feeds:update(R2,FunUpdate),
ok=kvs_feeds:delete(R3),
kvs_feeds:purge(R3,fun() -> [{feed,attachment,fun kvs_feeds:delete/1}] end),