package granary
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Pure-OCaml SQL engine
Install
dune-project
Dependency
Authors
Maintainers
Sources
0.0.3.tar.gz
sha256=8b18780ea373be48301d9f333925860a2f9110fc0ac28684295118d72b65a67e
sha512=25ca3c9c5e2b528704a542502e0f37dc33ba003f65622d969b8c2b800778585f8ef0cf89b36e6679832e3993e8303aecddfc662742baf7044d6afe4a796b8f11
doc/src/granary.columnar/persist.ml.html
Source file persist.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31open Lwt.Syntax module Row = Granary_encoding.Row module S = 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. *) let data_key = Bytes.make 1 '\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. *) let save (tx : S.rw S.txn) (tree_id : S.tree_id) (store : Col_store.t) : unit Lwt.t = let encoded = Col_store.encode store in S.put tx tree_id data_key encoded ;; (** [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. *) let load (tx : _ S.txn) (tree_id : S.tree_id) (schema : Row.column list) : Col_store.t option Lwt.t = let* data = S.get tx tree_id data_key in match data with | None -> Lwt.return None | Some buf -> let store = Col_store.decode schema buf in Lwt.return (Some store) ;;
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>