Crate noosphere_storage

Crate noosphere_storage 

Source
Expand description

This crate contains generic interfaces and concrete implementations to support a common API for data persistance in Noosphere on many different platforms. Current platforms include native targets (via disk-persisted K/V store) and web browsers (via IndexedDB).

Structs§

BlockStoreRetry
Implements retry and timeout logic for accessing blocks from a BlockStore. Any BlockStore can be wrapped by BlockStoreRetry to get retry and timeout logic for free. Each attempt to lookup a block is time limited by to a specified window with optional Backoff, and at most maximum_retries will be made to load the block.
BlockStoreTap
Wraps any BlockStore and “taps” it by cloning any block successfully retrieved from the store and sending over an MPSC channel. This allows an observer to record all the blocks needed to load arbitrarily deep and complex DAGs into memory without orchestrating a dedicated callback for the DAG implementations to invoke.
MemoryStorage
MemoryStore
SledStorage
SledStore
SphereDb
A SphereDb is a high-level storage primitive for Noosphere’s APIs. It takes a Storage and implements BlockStore and KeyValueStore, orchestrating writes so that as blocks are stored, links are also extracted and tracked separately, and also hosting metadata information such as sphere version records and other purely local configuration
StorageConfig
Generalized configurations for ConfigurableStorage.
StoreStats
TrackingStorage
TrackingStore
This is a store wrapper that tracks I/O. It is inspired by the testing utility originally created for the Forest HAMT implementation. This wrapper is all runtime overhead and should only be used for testing.
UcanStore

Enums§

Backoff
Backoff configuration used to define how BlockStoreRetry should time further attempts when store reads fail.

Constants§

BLOCK_STORE
LINK_STORE
METADATA_STORE
SPHERE_DB_STORE_NAMES
VERSION_STORE

Traits§

BlockStore
An interface for storage backends that are suitable for storing blocks. A block is a chunk of bytes that can be addressed by a CID. Any backend that implements this trait should be able to reliably store and retrieve blocks given a Cid.
ConfigurableStorage
Storage that can be customized via StorageConfig.
KeyValueStore
A KeyValueStore is a construct that is suitable for persisting generic key/value data to a storage backend.
Space
Space is a general trait for a storage provider to provide a the size on disk, used to calculate space amplification.
Storage
Storage is a general trait for composite storage backends. It is often the case that we are able to use a single storage primitive for all forms of storage, but sometimes block storage and generic key/value storage come from different backends. Storage provides a composite interface where both cases well accomodated without creating complexity in the signatures of other Noosphere constructs.
Store
A primitive interface for storage backends. A storage backend does not necessarily need to implement this trait to be used in Noosphere, but if it does it automatically benefits from trait implementations for BlockStore and KeyValueStore, making a single Store implementation into a universal backend.
StoreContainsCid

Functions§

base64_decode
Decode some bytes from an unpadded URL-safe base64 string
base64_encode
Encode some bytes as an unpadded URL-safe base64 string
block_decode
Decode any block as IPLD using the specified codec
block_deserialize
Decode any block as a deserializable type using the specified codec
block_encode
Encode any encodable type as a block using the specified codec
block_serialize
Encode any serializable type as a block using the specified codec
derive_cid
Produces a CID for a block with a Blake3_256 hash; note that the bytes are presumed to be encoded with the specified codec (honor system; this is not validated in any way).