Module Tjr_fs_shared.Shared_freelist

This is a shared type for blk freelists, and a dummy implementation; other libraries may have their own; don't open

type ('blk_id, 't) freelist_ops = {
alloc : unit -> ('blk_id't) Tjr_monad.m;
alloc_many : int -> ('blk_id list't) Tjr_monad.m;
free : 'blk_id -> (unit, 't) Tjr_monad.m;
free_many : 'blk_id list -> (unit, 't) Tjr_monad.m;
sync : unit -> (unit, 't) Tjr_monad.m;

NOTE the freelist already ensures it is crash safe; this sync is really for tidy shutdown

}
type ('blk_id, 't, 'internal_state) freelist_factory = < with_ : fn:string -> < create : min_free:'blk_id -> (< close : unit -> (unit, 't) Tjr_monad.m; freelist_ops : ('blk_id't) freelist_ops; get_state : unit -> 'internal_state; >, 't) Tjr_monad.m; restore : unit -> (< close : unit -> (unit, 't) Tjr_monad.m; freelist_ops : ('blk_id't) freelist_ops; get_state : unit -> 'internal_state; >, 't) Tjr_monad.m; >; >

NOTE these are just mocks, for testing

module Example : sig ... end

Simple example, with just a "min free" int, backed by a file; good intro to how the freelist actually works

val example : (Shared_ctxt.r, Tjr_monad.With_lwt.lwt, Example.t) freelist_factory
module Test : functor () sig ... end