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.block/Granary_block/Mem/index.html

Module Granary_block.MemSource

In-memory BLOCK device: a fixed-size, page-addressed buffer.

Implements the same page-read/write/sync/resize interface as the Unix-file backend (Granary_unix.Unix_file) but keeps all pages in memory, for tests and ephemeral databases. sync is a no-op.

Sourcetype t
Sourcetype error =
  1. | Out_of_bounds of {
    1. page_id : int64;
    2. n_pages : int64;
    }
Sourceval pp : Format.formatter -> t -> unit

Pretty-print the device's page count.

Sourceval pp_error : Format.formatter -> error -> unit

Pretty-print an error.

Sourceval page_size : t -> int

This device's page size in bytes (#95).

Sourceval create : ?page_size:int -> n_pages:int64 -> unit -> t

create ?page_size ~n_pages () allocates a zero-filled device of n_pages pages, each page_size bytes (default 4096, #95).

Sourceval n_pages : t -> int64

Current size of the device, in pages.

Sourceval read_page : t -> page_id:int64 -> Cstruct.t -> (unit, error) result Lwt.t

read_page t ~page_id buf copies page page_id into buf.

Sourceval write_page : t -> page_id:int64 -> Cstruct.t -> (unit, error) result Lwt.t

write_page t ~page_id buf stores buf as page page_id.

Sourceval sync : t -> (unit, error) result Lwt.t

No-op for the in-memory backend (nothing to flush).

Sourceval resize : t -> n_pages:int64 -> (unit, error) result Lwt.t

resize t ~n_pages grows or shrinks the device to n_pages pages.