[][src]Struct hypercore::Storage

pub struct Storage<T> where
    T: RandomAccess + Debug
{ /* fields omitted */ }

Save data to a desired storage backend.

Methods

impl<T> Storage<T> where
    T: RandomAccess<Error = Error> + Debug
[src]

Create a new instance. Takes a keypair and a callback to create new storage instances.

Write data to the feed.

Write a byte vector to a data storage (random-access instance) at the position of index.

NOTE: Meant to be called from the .put() feed method. Probably used to insert data as-is after receiving it from the network (need to confirm with mafintosh). TODO: Ensure the signature size is correct. NOTE: Should we create a Data entry type?

Get data from disk that the user has written to it. This is stored unencrypted, so there's no decryption needed.

Search the signature stores for a Signature, starting at index.

Get a Signature from the store.

Write a Signature to self.Signatures. TODO: Ensure the signature size is correct. NOTE: Should we create a Signature entry type?

TODO(yw) docs Get the offset for the data, return (offset, size).

Panics

A panic can occur if no maximum value is found.

Get a Node from the tree storage.

Write a Node to the tree storage. TODO: prevent extra allocs here. Implement a method on node that can reuse a buffer.

Write data to the internal bitfield module. TODO: Ensure the chunk size is correct. NOTE: Should we create a bitfield entry type?

Read a public key from storage

Read a secret key from storage

Write a public key to the storage

Write a secret key to the storage

Tries to read a partial keypair (ie: with an optional secret_key) from the storage

impl Storage<RandomAccessMemory>
[src]

Create a new instance backed by a RandomAccessMemory instance.

impl Storage<RandomAccessDisk>
[src]

Create a new instance backed by a RandomAccessDisk instance.

Trait Implementations

impl<T: Debug> Debug for Storage<T> where
    T: RandomAccess + Debug
[src]

Auto Trait Implementations

impl<T> Send for Storage<T> where
    T: Send

impl<T> Sync for Storage<T> where
    T: Sync

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same for T

Should always be Self