plebeia
Library
Module
Module type
Parameter
Class
Class type
2 Types
type t = storage
The type
2 Open, close, and commit
val create :
?pos:int64 ->
?length:int ->
?resize_step:Plebeia__Index.t ->
string ->
t
Create a new storage
* pos : Where to start the storage in the file, in bytes. * length: The initial size of the storage, excluding pos
. * resize_step: How many cells allocated for each resize * string : The path name
Open an existing storage
val truncate : ?length:int -> t -> unit
Truncate the data file and reinitialize it. All the contents are lost. length
is the initial reserved size of the reinitialized file.
val sync : t -> unit
For reader to update the storage to catch up the update by the writer process. For Writer and Private, it does nothing.
val close : t -> unit
Close the storage
val commit : t -> unit
Write the current state of the storage at its header. If the system crashes, any updates to the storage after the last commit will be lost, even if they are written to the file.
2 Accessor
val filename : t -> string
Return the file name
val get_version : t -> int
Get the file version
val get_last_root_index : t -> Plebeia__Index.t option
val get_current_length : t -> Plebeia__Index.t
Get the status of the storage
For Reader, it only returns the lastest information it knows in memory. Writer may already update this information on the disk.
val set_last_root_index : t -> Plebeia__Index.t option -> unit
Set the last index of root hash. Note that the data are only saved to the file when Header.commit
is called.
2 Read and write
Get the contiguous bytes from the head of the index
val new_index : t -> Plebeia__Index.t
Allocate a cell and returns its index
val new_indices : t -> int -> Plebeia__Index.t
Allocate cells and return the first index
make a writable buffer of the cell of the given index
make a 64 bytes writable buffer from the beginning of the cell of the given index
module Chunk : sig ... end
Bigger data than a cell