package granary

  1. Overview
  2. Docs
Pure-OCaml SQL engine

Install

dune-project
 Dependency

Authors

Maintainers

Sources

0.0.3.tar.gz
sha256=8b18780ea373be48301d9f333925860a2f9110fc0ac28684295118d72b65a67e
sha512=25ca3c9c5e2b528704a542502e0f37dc33ba003f65622d969b8c2b800778585f8ef0cf89b36e6679832e3993e8303aecddfc662742baf7044d6afe4a796b8f11

doc/granary.unix/Granary_unix/index.html

Module Granary_unixSource

Unix platform driver for granary (#170): file-backed database constructors plus the file provider that powers ATTACH and VACUUM on the otherwise platform-agnostic core.

Sourcemodule Unix_file : sig ... end

Unix-file BLOCK backend (pread/pwrite over a Unix fd).

Sourcemodule Fault_inject : sig ... end

Fault-injecting wrapper around Unix_file for crash-recovery tests.

Sourcemodule Store : sig ... end

Unix-file convenience constructors for Granary_store.Store.

The Unix file provider, exposed for explicit installation.

Sourceval install : unit -> unit

Install the process-wide file provider (see Granary.Db.set_file_provider) so ATTACH and VACUUM can touch the local filesystem. Idempotent; also called automatically by open_file / open_file_wal.

Sourceval open_file : ?page_size:int -> ?reserved_bytes_per_page:int -> ?clock:(unit -> float) -> ?as_of_history:bool -> path:string -> unit -> (Granary.Db.t, Granary.Db.error) result Lwt.t

Open a persistent B+-tree database at file path, registering the file provider for this process. Creates the file if absent.

page_size (default 4096, a multiple of 4096 up to 65536) and reserved_bytes_per_page (default 0) set the page geometry when CREATING a new file (#95); they are immutable thereafter and ignored when reopening an existing file (whose stored geometry is used). Reopening with an explicit geometry that disagrees with the file is rejected.

clock is forwarded to Granary.Db.of_store (used by datetime). Note: durability applies to WAL mode only; the non-WAL commit path syncs inline and ignores the sync mode, so open_file takes no durability (#298).

as_of_history (#266) defaults to false; set it to true to enable the <path>.aslog as-of commit log, which lets Granary.Db.query_as_of read the database as it existed at a past txn id / timestamp.

Sourceval open_file_wal : ?page_size:int -> ?reserved_bytes_per_page:int -> ?clock:(unit -> float) -> ?durability:Granary_store.Store.durability -> ?as_of_history:bool -> path:string -> unit -> (Granary.Db.t, Granary.Db.error) result Lwt.t

Open a persistent WAL-mode database (path for the main DB, path ^ "-wal" for the WAL), registering the file provider. Crash recovery runs automatically at open. Geometry arguments behave as in open_file (#95). clock and durability are forwarded to Granary.Db.of_store (#298). as_of_history (#266) defaults to false — see open_file.