Crate btlib

source ·
Expand description

This crate contains the core structs and traits used by Blocktree. The crypto module contains all of the cryptographic primitives used to implement this system. Most of the functionality for accessing blocks is defined by the Block trait. The BlockMeta struct is the type which implements block metadata.

Re-exports

Modules

  • This module contains the Accessor type.
  • This module exports the AtomicFile struct, which is used to synchronize access to a file.
  • This module contains the BufReader type.
  • A collection of collection types.
  • This module contains functions which are useful for configuring applications.
  • This module contains types providing the cryptographic primitives necessary to implement Blocktree.
  • Contains the DropTrigger type.
  • This module defines the Error and Result types used in this crate. It also defines macros, bterr! and btensure!. The first accepts either a type which is StdError + Send + Sync + 'static or the same arguments as format!, allowing you to create one-off string errors. btensure takes a boolean expression as its first argument, and its remaining arguments are the same as those to bterr.
  • Helpers for configuring logging.
  • Contains the SectoredBuf type.

Macros

  • Ensures that an expression evaluates to true, and if it does’nt, returns an error.
  • Creates a new Error, which contains a stacktrace captured at the point where this macro was evaluated.
  • Attempts to unwrap the given result. If the result is an error and the given count is positive, then the error is logged and Ok($count) is returned. If the result is an error and count is zero, then the Err variant is returned containing it.

Structs

  • Attributes associated with a principal which are used for authorization decisions.
  • A unique identifier for a block.
  • Signed metadata associated with a block.
  • This struct contains all of the metadata fields associated with a block, except for its signature. Since this struct implements Serialize, this allows for convenient signature calculations.
  • Metadata that is encrypted.
  • Describes how to open a block, including the inner stream from which the block can be read and the credentials to use to open it.
  • An owned identifier for a block in a tree.
  • A generic block path.
  • A reference to a block path.
  • A stream which is responsible for managing the metadata associated with a block, including validating and authenticating it. This type shouldn’t be instantiated direction, instead a BlockOpenOptions struct is used.
  • A wrapper around positioned_io::SizeCursor which implements Split.
  • This is the body contained in directory blocks.
  • An instant in time represented by the number of seconds since January 1st 1970, 00:00:00 UTC.
  • Fragments are created from blocks using Erasure Encoding and stored with other nodes in the network to provide availability and redundancy of data.
  • Keeps track of which principal is storing a fragment.
  • The serial number of a block fragment.
  • A record which stores the authorization attributes, credentials, writecap, and IP address of a process.
  • An identifier for a security principal, which is any entity that can be authenticated.
  • An envelopment of a key, which is tagged with the principal who the key is meant for.
  • Represents a relative block path.
  • Structure for keeping track of server information in a directory.
  • Verifies that a principal is authorized to write blocks in a tree.

Enums

Constants

Traits

  • THE BLOCK TRAIT
  • Trait for accessing the metadata associated with a block.
  • Trait for streams which can efficiently and infallibly return their current position.
  • Trait for types which are owned by a Principal.
  • The Read trait requires the caller to supply the buffer to be read into. This trait is its dual in the sense that the trait implementor is expected to supply its own buffer, which a Write instance is given. This can be used to avoid copying in cases where the trait implementor is already buffering data, so it can give a reference to this buffer to the caller (for example in SectoredBuf)
  • A version of the WriteAt trait, which allows integrity information to be supplied when flushing.
  • Trait for types which can be extended with zero byes.

Type Definitions