Struct hypercore::Feed [−][src]
pub struct Feed<T> where
T: RandomAccessMethods + Debug, { /* fields omitted */ }
Append-only log structure.
Methods
impl<T> Feed<T> where
T: RandomAccessMethods + Debug,
[src]
impl<T> Feed<T> where
T: RandomAccessMethods + Debug,
pub fn with_storage(storage: Storage<T>) -> Result<Self>
[src]
pub fn with_storage(storage: Storage<T>) -> Result<Self>
Create a new instance with a custom storage backend.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Get the amount of entries in the feed.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Check if the length is 0.
pub fn byte_len(&self) -> usize
[src]
pub fn byte_len(&self) -> usize
Get the total amount of bytes stored in the feed.
pub fn append(&mut self, data: &[u8]) -> Result<()>
[src]
pub fn append(&mut self, data: &[u8]) -> Result<()>
Append data into the log.
pub fn get(&mut self, index: usize) -> Result<Option<Vec<u8>>>
[src]
pub fn get(&mut self, index: usize) -> Result<Option<Vec<u8>>>
Retrieve data from the log.
pub fn proof(&mut self, index: usize) -> Result<Proof>
[src]
pub fn proof(&mut self, index: usize) -> Result<Proof>
Return the Nodes which prove the correctness for the Node at index.
pub fn put(&mut self, index: usize, data: &[u8], proof: Proof) -> Result<()>
[src]
pub fn put(&mut self, index: usize, data: &[u8], proof: Proof) -> Result<()>
Insert data into the tree at index
. Verifies the proof
when inserting
to make sure data is correct. Useful when replicating data from a remote
host.
pub fn signature(&mut self, index: usize) -> Result<Signature>
[src]
pub fn signature(&mut self, index: usize) -> Result<Signature>
Get a signature from the store.
pub fn verify(&mut self, index: usize, signature: &Signature) -> Result<()>
[src]
pub fn verify(&mut self, index: usize, signature: &Signature) -> Result<()>
Verify the entire feed. Checks a signature against the signature of all root nodes combined.
pub fn root_hashes(&mut self, index: usize) -> Result<Vec<Node>>
[src]
pub fn root_hashes(&mut self, index: usize) -> Result<Vec<Node>>
Get all root hashes from the feed.
pub fn keypair(&self) -> &Keypair
[src]
pub fn keypair(&self) -> &Keypair
Access the keypair.
impl Feed<RandomAccessDiskMethods>
[src]
impl Feed<RandomAccessDiskMethods>
pub fn new(dir: &PathBuf) -> Result<Self>
[src]
pub fn new(dir: &PathBuf) -> Result<Self>
Create a new instance that persists to disk at the location of dir
.
Trait Implementations
impl Default for Feed<RandomAccessMemoryMethods>
[src]
impl Default for Feed<RandomAccessMemoryMethods>
Create a new instance with an in-memory storage backend.
Panics
Can panic if constructing the in-memory store fails, which is highly unlikely.