plebeia
Library
Module
Module type
Parameter
Class
Class type
module RootHash : sig ... end
Hash stored in the roots can be different from Plebeia's root Merkle hashes. Its length is 32bytes.
module Entry : sig ... end
type entry = Entry.t = {
meta : string; |
prev : Plebeia__Index.t option; |
parent : Plebeia__Index.t option; |
index : Plebeia__Index.t; |
hash : RootHash.t; |
}
val create :
storage_context:Plebeia__Storage.storage ->
storage_roots:Plebeia__Storage.storage ->
t
Load root hashes of the context and return t
Reload additional commits from the updated context.
Readers must call Storage.sync
prior to it in order to load new roots added by the Writer.
val sync : t -> unit
For reader, to update the root table informat which may be updated by the writer
val add :
t ->
?parent:Plebeia__Index.t ->
RootHash.t ->
Plebeia__Index.t ->
meta:string ->
unit
Add a new root hash, with its index, parent, meta commit log.
It immediately saves the root to the context.
If the root hash already exists in the table, it is overridden with the new one by add
.
val mem : t -> RootHash.t -> bool
Existence check. O(1) using hash table
val find : t -> RootHash.t -> Entry.t option
Find a root of the given hash. O(1) using hash table
Returns the childlren of the entry. O(1) using hash table
folding. The entries are applied in the order of registration, from the eldest to the newest.
Breadth first iteration of roots from genesis to the latest. Parents are always called before their children.
val length : t -> int
The number of entries in the table