package plebeia
Module Internal.StorageSource
1 Fixed size storage on a file
The Storage has fixed 32-byte size cells.
2 Types
2 Open, close, and commit
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
Truncate the data file and reinitialize it. All the contents are lost. length is the initial reserved size of the reinitialized file.
For reader to update the storage to catch up the update by the writer process. For Writer and Private, it does nothing.
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
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.
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 content of the cell specified by the index
Get the contiguous bytes from the head of the 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