Struct hypercore::Storage[][src]

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

Save data to a desired storage backend.

Methods

impl<T> Storage<T> where
    T: RandomAccessMethods + 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?

TODO(yw) docs

impl Storage<RandomAccessMemoryMethods>
[src]

impl Storage<RandomAccessDiskMethods>
[src]

Trait Implementations

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

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

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