[−][src]Trait starling::traits::Database
This trait defines the required interface for connecting a storage mechanism to the MerkleBIT
.
Associated Types
type NodeType
The type of node to insert into the database.
type EntryType
The type of entry for insertion. Primarily for convenience and tracking what goes into the database.
Required methods
fn open(path: &PathBuf) -> Result<Self, Exception> where
Self: Sized,
Self: Sized,
fn get_node(&self, key: ArrayType) -> Result<Option<Self::NodeType>, Exception>
Gets a value from the database based on the given key.
Errors
Exception
generated if the get_node
does not succeed.
fn insert(
&mut self,
key: ArrayType,
node: Self::NodeType
) -> Result<(), Exception>
&mut self,
key: ArrayType,
node: Self::NodeType
) -> Result<(), Exception>
Queues a key and its associated value for insertion to the database.
Errors
Exception
generated if the insert
does not succeed.
fn remove(&mut self, key: &ArrayType) -> Result<(), Exception>
Removes a key and its associated value from the database.
Errors
Exception
generated if the remove
does not succeed.
fn batch_write(&mut self) -> Result<(), Exception>
Confirms previous inserts and writes the changes to the database.
Errors
Exception
generated if the batch_write
does not succeed.
Implementors
impl<ArrayType> Database<ArrayType> for HashDB<ArrayType> where
ArrayType: Array,
[src]
ArrayType: Array,
type NodeType = TreeNode<ArrayType>
type EntryType = ([u8; 32], Vec<u8>)
fn open(_path: &PathBuf) -> Result<Self, Exception>
[src]
fn get_node(&self, key: ArrayType) -> Result<Option<Self::NodeType>, Exception>
[src]
fn insert(
&mut self,
key: ArrayType,
value: Self::NodeType
) -> Result<(), Exception>
[src]
&mut self,
key: ArrayType,
value: Self::NodeType
) -> Result<(), Exception>