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§

  • 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.
  • 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.
  • 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
  • Generalized configurations for ConfigurableStorage.
  • 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.

Enums§

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

Constants§

Traits§

  • 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.
  • Storage that can be customized via StorageConfig.
  • A KeyValueStore is a construct that is suitable for persisting generic key/value data to a storage backend.
  • Space is a general trait for a storage provider to provide a the size on disk, used to calculate space amplification.
  • 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.
  • 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.

Functions§

  • Decode some bytes from an unpadded URL-safe base64 string
  • Encode some bytes as an unpadded URL-safe base64 string
  • Decode any block as IPLD using the specified codec
  • Decode any block as a deserializable type using the specified codec
  • Encode any encodable type as a block using the specified codec
  • Encode any serializable type as a block using the specified codec
  • 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).