Module Tjr_fs_shared

Common types and defns for file system work.

A collection of the main types provided by this library.

include Tjr_fs_shared__.Summary

Int-like types

module Int_like : sig ... end

Int-like types with unboxed record wrappers, for documentation purposes

Buffers

module Buf_ops : sig ... end

Buffer operations including blit, moved from Tjr_btree.

type 'buf buf_ops = 'buf Buf_ops.buf_ops
val chr0 : char
type ba_buf = Buf_ops.ba_buf
type ba_buf_ops = Buf_ops.ba_buf_ops
val ba_buf_ops : Bigstring.t Buf_ops.buf_ops
val by_buf_ops : Stdlib.Bytes.t Buf_ops.buf_ops

Block identifiers

module Blk_intf : sig ... end

Blk-related interfaces

module Blk_id_as_int = Blk_intf.Blk_id_as_int

Blocks

module Blk_sz = Blk_intf.Blk_sz
type blk_sz = Blk_sz.blk_sz
val blk_sz_4096 : Blk_sz.blk_sz
module Blk_ops = Blk_intf.Blk_ops
type ('blk, 'buf) blk_ops = ('blk'buf) Blk_ops.blk_ops

Block devices

module Blk_dev_ops = Blk_intf.Blk_dev_ops
type ('blk_id, 'blk, 't) blk_dev_ops = ('blk_id'blk't) Blk_dev_ops.blk_dev_ops = {
blk_sz : blk_sz;
write : blk_id:'blk_id -> blk:'blk -> (unit, 't) Tjr_monad.m;
read : blk_id:'blk_id -> ('blk't) Tjr_monad.m;
write_many : ('blk_id * 'blk) list -> (unit, 't) Tjr_monad.m;
}
val blk_devs : < in_mem : monad_ops:'a Tjr_monad.monad_ops -> blk_sz:Blk_intf.blk_sz -> with_state:(('b'c) Tjr_lib.Tjr_map.With_stdcmp.stdmap'a) Tjr_monad.with_state -> ('b'c'a) Blk_intf.blk_dev_ops; lwt : (Blk_intf.Blk_id_as_int.blk_idShared_ctxt.blk, Tjr_monad.With_lwt.lwt, Lwt_unix.file_descr) Blk_intf.blk_dev_impl; lwt_open_file : fn:string -> create:bool -> trunc:bool -> (< blk_dev_ops : (Blk_intf.Blk_id_as_int.blk_idShared_ctxt.blk, Tjr_monad.With_lwt.lwt) Blk_intf.blk_dev_ops; close : unit -> (unit, Tjr_monad.With_lwt.lwt) Tjr_monad.m; fd : Lwt_unix.file_descr; sync : unit -> (unit, Tjr_monad.With_lwt.lwt) Tjr_monad.m; >, Tjr_monad.With_lwt.lwt) Tjr_monad.m; >

Block allocation

module Blk_allocator_ops = Blk_intf.Blk_allocator_ops
type ('blk_id, 't) blk_allocator_ops = ('blk_id't) Blk_allocator_ops.blk_allocator_ops = {
blk_alloc : unit -> ('blk_id't) Tjr_monad.m;
blk_free : 'blk_id -> (unit, 't) Tjr_monad.m;
}

Note on sync and the blk device layer

Kv ops

module Kvop : sig ... end

A concrete type for insert and delete operations. Don't open.

type ('k, 'v) kvop = ('k'v) Kvop.kvop
module Kvop_map = Kvop.Kvop_map

Small strings, leq 256 bytes

module Str_256 : sig ... end

Strings with max length 256 bytes; safe to open

type str_256 = Str_256.str_256

Write back cache

module Write_back_cache_v1_DONT_USE = Write_back_cache
module Write_back_cache_v2_DONT_USE = Tjr_fs_shared__.Write_back_cache_v2
module Write_back_cache_v3 : sig ... end

A write-back cache; a wrapper around pqwy/lru.

module Write_back_cache = Write_back_cache_v3
type wbc_params = Write_back_cache.wbc_params
type ('k, 'v, 't) wbc_ops = ('k'v't) Write_back_cache.wbc_ops
type ('k, 'v, 't) wbc_ops_plus = ('k'v't) Write_back_cache.wbc_ops_plus
type ('k, 'v, 't) wbc_factory = ('k'v't) Write_back_cache.wbc_factory

Marshalling

module Marshal_factory : sig ... end

Common marshallers

type ('a, 'buf) mshlr = ('a'buf) Marshal_factory.mshlr = {
max_elt_sz : int;
mshl : 'a -> ('buf * int) -> 'buf * int;
umshl : 'buf -> int -> 'a * int;
}
type ('k, 'v, 'buf) kv_mshlr = ('k'v'buf) Marshal_factory.kv_mshlr = {
k_mshlr : ('k'buf) mshlr;
v_mshlr : ('v'buf) mshlr;
}
val mshlrs : < for_blk_id : (Blk_intf.Blk_id_as_int.blk_idShared_ctxt.buf) Marshal_factory.mshlr; for_blk_id_option : (Blk_intf.Blk_id_as_int.blk_id optionShared_ctxt.buf) Marshal_factory.mshlr; for_int : (int, Shared_ctxt.buf) Marshal_factory.mshlr; for_int_int_kvop : ((int, int) Kvop.kvopShared_ctxt.buf) Marshal_factory.mshlr; for_int_int_kvop_option : ((int, int) Kvop.kvop optionShared_ctxt.buf) Marshal_factory.mshlr; for_int_option : (int optionShared_ctxt.buf) Marshal_factory.mshlr; for_kv : < int_int : (int, int, Shared_ctxt.buf) Marshal_factory.kv_mshlr; s256_int : (Str_256.str_256, int, Shared_ctxt.buf) Marshal_factory.kv_mshlr; s256_s256 : (Str_256.str_256Str_256.str_256Shared_ctxt.buf) Marshal_factory.kv_mshlr; >; for_s256 : (Str_256.str_256Shared_ctxt.buf) Marshal_factory.mshlr; >

Marshalling with bin-prot

module Pvt_bin_prot_marshalling = Tjr_fs_shared__.Bin_prot_marshalling
type 'a bp_mshlr = 'a Pvt_bin_prot_marshalling.bp_mshlr
type 'a ba_mshlr = 'a Pvt_bin_prot_marshalling.ba_mshlr
val bp_mshlrs : < ba_mshlr : a. mshlr:'a Pvt_bin_prot_marshalling.bp_mshlr -> buf_sz:int -> 'a Pvt_bin_prot_marshalling.ba_mshlr; int_mshlr : int Pvt_bin_prot_marshalling.bp_mshlr; r_mshlr : Shared_ctxt.r Pvt_bin_prot_marshalling.bp_mshlr; s256_mshlr : Str_256.str_256 Pvt_bin_prot_marshalling.bp_mshlr; >

Standard example types and defns

module Shared_ctxt : sig ... end

Represent common context using classes; don't open (use Tjr_fs_shared.ctxt#shared)

val ctxt : < shared_ctxt : (Shared_ctxt.rShared_ctxt.blkShared_ctxt.buf, Tjr_monad.With_lwt.lwt) Shared_ctxt.shared_ctxt; >

Dummy freelist for testing

module Shared_freelist : sig ... end

This is a shared type for blk freelists, and a dummy implementation; other libraries may have their own; don't open

val shared_freelist : (Shared_ctxt.r, Tjr_monad.With_lwt.lwt, Shared_freelist.Example.t) Shared_freelist.freelist_factory

Testing

module Test : sig ... end

Support for basic testing, controlled by optcomp

Log

module Log : sig ... end

Runtime config support

val runtime_config_factory : < make : default:'a option -> filename:string -> 'a Tjr_fs_shared__.Runtime_config_factory.runtime_config -> 'a Stdlib.Lazy.t; >