package lmdb

  1. Overview
  2. Docs

Raw bindings for LMDB.

val version : string * int * int * int

Exceptions

exception Exists
exception Map_full
exception Error of int
val strerror : int -> string

Flags

module type Flags = sig ... end

Operations on sets of flags.

module Flags : Flags

Environment

type env
module EnvFlags : sig ... end
module CopyFlags : sig ... end
val env_create : unit -> env
val env_open : env -> string -> EnvFlags.t -> int -> unit
val env_close : env -> unit
val env_set_mapsize : env -> int -> unit
val env_set_maxdbs : env -> int -> unit
val env_set_maxreaders : env -> int -> unit
val env_copy : env -> string -> CopyFlags.t -> unit
val env_copyfd : env -> Unix.file_descr -> CopyFlags.t -> unit
val env_set_flags : env -> EnvFlags.t -> bool -> unit
val env_get_flags : env -> EnvFlags.t
val env_get_path : env -> string
val env_get_fd : env -> Unix.file_descr
val env_sync : env -> bool -> unit
val env_get_maxreaders : env -> int
val env_get_maxkeysize : env -> int
val reader_list : env -> (string -> int) -> int
val reader_check : env -> int
type stat = {
  1. psize : int;
  2. depth : int;
  3. branch_pages : int;
  4. leaf_pages : int;
  5. overflow_pages : int;
  6. entries : int;
}
val env_stat : env -> stat
type envinfo = {
  1. map_addr : int;
    (*

    To recover the actual address this integer needs to be shifted to the left by one bit. A 31 bit integer may overflow.

    *)
  2. map_size : int;
  3. last_pgno : int;
  4. last_txnid : int;
  5. max_readers : int;
  6. num_readers : int;
}
val env_info : env -> envinfo

Transaction

type txn
val txn_env : txn -> env
val txn_begin : env -> txn option -> EnvFlags.t -> txn
val txn_commit : txn -> unit
val txn_abort : txn -> unit

Dbi

type dbi
val invalid_dbi : dbi
module DbiFlags : sig ... end
module PutFlags : sig ... end
module Block_option : sig ... end
val dbi_open : txn -> string option -> DbiFlags.t -> dbi
val dbi_close : env -> dbi -> unit
val dbi_flags : txn -> dbi -> DbiFlags.t
val dbi_stat : txn -> dbi -> stat
val drop : txn -> dbi -> bool -> unit
val get : txn -> dbi -> bigstring -> bigstring
val put : txn -> dbi -> bigstring -> bigstring -> PutFlags.t -> unit
val put_reserve : txn -> dbi -> bigstring -> int -> PutFlags.t -> bigstring
val del : txn -> dbi -> bigstring -> bigstring Block_option.t -> unit
val cmp : txn -> dbi -> bigstring -> bigstring -> int
val dcmp : txn -> dbi -> bigstring -> bigstring -> int

Cursor

type cursor
module Ops : sig ... end
val cursor_open : txn -> dbi -> cursor
val cursor_close : cursor -> unit
val cursor_put : cursor -> bigstring -> bigstring -> PutFlags.t -> unit
val cursor_put_reserve : cursor -> bigstring -> int -> PutFlags.t -> bigstring
val cursor_del : cursor -> PutFlags.t -> unit
val cursor_count : cursor -> int

Internal

val sizeof_int : int
val sizeof_size_t : int
OCaml

Innovation. Community. Security.