pub trait TransparentLog<'a, T: Serialize + Deserialize<'a>> {
type LogSize: Integer + Copy + Hash;
// Required methods
fn add(&mut self, record: T) -> Result<Self::LogSize>;
fn add_hash(
&mut self,
level: LogHeight,
hash: String,
) -> Result<Self::LogSize>;
fn get_hash(
&self,
level: LogHeight,
index: Self::LogSize,
) -> Result<MaybeOwned<'_, String>>;
fn size(&self) -> Result<Self::LogSize>;
fn get(&self, index: Self::LogSize) -> Result<Option<MaybeOwned<'_, T>>>;
// Provided methods
fn append(&mut self, record: T) -> Result<Record<Self::LogSize>> { ... }
fn push_hash(
&mut self,
level: LogHeight,
hash: String,
) -> Result<Self::LogSize> { ... }
fn latest(&self) -> Result<LogTree<Self::LogSize>> { ... }
fn proofs<I>(
&self,
positions: I,
) -> Result<HashMap<LogTreePosition<Self::LogSize>, String>>
where I: Iterator<Item = LogTreePosition<Self::LogSize>> { ... }
}Expand description
Transparent log Trait
Required Associated Types§
Required Methods§
Sourcefn add_hash(&mut self, level: LogHeight, hash: String) -> Result<Self::LogSize>
fn add_hash(&mut self, level: LogHeight, hash: String) -> Result<Self::LogSize>
Add a hash and index, returns the index of the added hash
Provided Methods§
Sourcefn append(&mut self, record: T) -> Result<Record<Self::LogSize>>
fn append(&mut self, record: T) -> Result<Record<Self::LogSize>>
Append a new record to the log and return its index
Sourcefn push_hash(&mut self, level: LogHeight, hash: String) -> Result<Self::LogSize>
fn push_hash(&mut self, level: LogHeight, hash: String) -> Result<Self::LogSize>
Recursively push a hash to the tree at given level
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
Source§impl<'a, T: Serialize + Deserialize<'a>> TransparentLog<'a, T> for InMemoryLog<T>
TransparentLog Trait implementation for in-memory log
impl<'a, T: Serialize + Deserialize<'a>> TransparentLog<'a, T> for InMemoryLog<T>
TransparentLog Trait implementation for in-memory log