A persistent store on disk for storing L2 blocks. It is composed of an index file and a data file which contains the actual blocks. The keys of the index are the L2 block hashes.

type t

The type of store for L2 blocks

val mem : t -> L2block.hash -> bool Lwt.t

Returns true if the L2 block hash exists in the index, i.e. if the block exists in the store.

val predecessor : t -> L2block.hash -> L2block.hash option Lwt.t

Returns the predecessor of the block (by only querying the index, without reading the block data).

Returns the context hash of the block (by only querying the index, without reading the block data).

val read_block : t -> L2block.hash -> L2block.t option Lwt.t

Read a block from the file on disk, given a L2 block hash. Returns None if the block is not stored.

val append_block : ?flush:bool -> t -> L2block.t -> unit Lwt.t

append_block ?flush store block stores the block in store updating its index and flushing if flush is set to true (defaults to true).