12345678910111213141516171819202122232425262728293031openLwt.SyntaxmoduleRow=Granary_encoding.RowmoduleS=Granary_store.Store(** Well-known key under which columnar store data is persisted within the
table's tree_id. A single zero byte avoids collision with any real
application key. *)letdata_key=Bytes.make1'\x00'(** [save tx tree_id store] persists [store] to the B-tree at [tree_id].
The entire store is serialised via {!Col_store.encode} and stored as a
single value; the B-tree overflow chain handles values up to 1 GiB. *)letsave(tx:S.rwS.txn)(tree_id:S.tree_id)(store:Col_store.t):unitLwt.t=letencoded=Col_store.encodestoreinS.puttxtree_iddata_keyencoded;;(** [load tx tree_id schema] reads a previously persisted columnar store from
the B-tree at [tree_id]. Returns [None] when no data has been persisted
yet (fresh table). Raises [Failure] on corrupt data. Works with both RO
and RW transactions. *)letload(tx:_S.txn)(tree_id:S.tree_id)(schema:Row.columnlist):Col_store.toptionLwt.t=let*data=S.gettxtree_iddata_keyinmatchdatawith|None->Lwt.returnNone|Somebuf->letstore=Col_store.decodeschemabufinLwt.return(Somestore);;