package b0

  1. Overview
  2. Docs
On This Page
  1. Stores
Software construction and deployment kit

Install

dune-project
 Dependency

Authors

Maintainers

Sources

b0-0.0.5.tbz
sha512=00a6868b4dfa34565d0141b335622a81a0e8d5b9e3c6dfad025dabfa3df2db2a1302b492953bbbce30c3a4406c324fcec25250a00b38f6d18a69e15605e3b07e

doc/b0.b00/B00/Store/index.html

Module B00.StoreSource

Lazy immutable stores.

These stores provide access to immutable, lazily determined, typed key-value bindings.

The value of a key in a store is defined either:

Once determined the value of a key in the store never changes.

XXX. Maybe move that at the B0 level.

Stores

Sourcetype 'a key

The type for keys binding values of type 'a.

Sourcetype binding =
  1. | B : 'a key * 'a -> binding

The type for store bindings. A key and its value.

Sourcetype t

The type for stores.

Sourceval create : Memo.t -> dir:B0_std.Fpath.t -> binding list -> t

create memo ~dir bs is a store with predefined bindings bs. If a key is mentioned more than once in bs the last binding takes over. The store uses memo to determine other keys as needed. dir is a scratch directory used by key determination functions to write memoized file outputs.

Sourceval memo : t -> Memo.t

memo s is s's memo as given on create.

Sourceval dir : t -> B0_std.Fpath.t

dir s is the scratch directory of s. Key determination functions using this directory to write files should do so using nice file name prefixes (e.g. lowercased module or lib names) to avoid name clashes.

Sourceval key : ?mark:string -> (t -> Memo.t -> 'a B0_std.Fut.t) -> 'a key

key ~mark det is a new key whose value is determined on access by the future:

det s (Memo.with_mark mark (Store.memo s))

mark defaults to "".

Sourceval get : t -> 'a key -> 'a B0_std.Fut.t

get s k is a future that dermines with the value of k in s.