barrel_design_cursor (barrel_design v0.1.0)

View Source

Pinned read cursors: a RocksDB snapshot of a view's store, held so every page of one read comes from the same checkpoint and generation. Kept in a public table owned by barrel_design_dbs; the database's process creates, expires and evicts its own, and releases them all before it closes its store.

Summary

Functions

Release the least recently used cursors of a database until it holds fewer than Max.

Release the database's cursors unused for Ttl milliseconds.

The modules a database's open cursors hold.

Ask the database process to keep a reader's snapshot as a cursor. It is refused ({error, revoked}) unless the activation the read started under is still the design's current one.

Release every cursor of a database: its store is closing.

Release the cursors a database process held: it is gone.

Release the cursors of some views: their design is gone.

Functions

evict(Db, Max)

-spec evict(binary(), pos_integer()) -> ok.

Release the least recently used cursors of a database until it holds fewer than Max.

expire(Db, Ttl)

-spec expire(binary(), non_neg_integer()) -> ok.

Release the database's cursors unused for Ttl milliseconds.

insert(Db, Inst, Vid, Gen, Snap, Modules, Activation, Owner)

-spec insert(binary(), binary(), binary(), non_neg_integer(), term(), [binary()], term(), pid()) ->
                pos_integer().

lookup(Id)

-spec lookup(term()) -> {ok, map()} | error.

modules(Db)

-spec modules(binary()) -> [binary()].

The modules a database's open cursors hold.

new_table()

-spec new_table() -> ok.

pin(Worker, Inst, Vid, Gen, Snap, Modules, Activation)

-spec pin(pid(), binary(), binary(), non_neg_integer(), term(), [binary()], term()) ->
             {ok, pos_integer()} | {error, term()}.

Ask the database process to keep a reader's snapshot as a cursor. It is refused ({error, revoked}) unless the activation the read started under is still the design's current one.

release(Id)

-spec release(term()) -> ok.

release_db(Db)

-spec release_db(binary()) -> ok.

Release every cursor of a database: its store is closing.

release_owner(Owner)

-spec release_owner(pid()) -> ok.

Release the cursors a database process held: it is gone.

release_views(Db, Vids)

-spec release_views(binary(), [binary()]) -> ok.

Release the cursors of some views: their design is gone.