Module Tjr_plist.Make_1
Construct a persistent list (most generic version, not concurrent-safe).
We store the list of elts from offset off0 (say); the nxt pointer takes up the first off0 bytes. Assumes max size of marshalled blk_ptr is off0 bytes.
When an elt is added, we marshal to buffer immediately (same for nxt pointer). Only when we write to disk do we update the buffer with the None pointer.
The idea is to make an on-disk list structure that can be updated extremely quickly (one block write and one barrier in the common case, without having to udpate the origin since we can just follow tl pointers).
Plist block structure:
Some invariants:
- adding an element, or setting the nxt pointer, marshals immediately
- the EOL marker is only marshalled when syncing the tl block (presumably to avoid repeated marshalling of this marker? seems premature)
module type S = sig ... end
module type T = sig ... end
val make : buf_ops:'buf Tjr_fs_shared.buf_ops -> blk_ops:('blk, 'buf) Tjr_fs_shared.blk_ops -> plist_marshal_info:('a, 'blk_id, 'blk, 'buf) Plist_intf.plist_marshal_info -> monad_ops:'t Tjr_monad.monad_ops -> ('a, 'blk_id, 'blk, 'buf, 't) Plist_intf.plist_factory
Version without functor
examples
val pl_examples : < for_blk_id : Tjr_fs_shared.Shared_ctxt.r Pl_type_abbrevs.plist_factory; for_int : int Pl_type_abbrevs.plist_factory; for_int_int_kvop : (int, int) Tjr_fs_shared.kvop Pl_type_abbrevs.plist_factory; >