Module holochain_types::prelude

source ·
Expand description

reexport some common things

Re-exports§

Modules§

  • represent arbitrary bytes (not serialized) e.g. totally random crypto bytes from random_bytes
  • A “Cell” represents a DNA/AgentId pair - a space where one dna/agent can track its source chain and service network requests / responses.
  • Cells can be cloned to create new cells with the different properties.
  • Defines DnaDef struct
  • DNA Properties Support types
  • Types for arbitrary data driven by entropy
  • ffs - the Friendly Filesystem
  • Items related to the DNA initialization callback.
  • A variant of Zome which is defined entirely by native, inline Rust code
  • Wrapper type to indicate some data which has a ValidationStatus associated with it.
  • Metadata types for use in wasm
  • Implements YamlProperties, and potentially any other data types that can represent “properties” of a DNA
  • Types for source chain queries
  • Types for requesting metadata
  • Schedule functions to run outside a direct zome call.
  • App-defined signals
  • Common helpers for writing tests against zome types
  • A microsecond-precision UTC timestamp for use in Holochain’s actions.
  • Tracking versions between the WASM host and guests and other interfaces.
  • Types for warrants

Macros§

  • Serialization for fixed arrays is generally not available in a way that can be derived. Being able to wrap fixed size arrays is important e.g. for crypto safety etc. so this is a simple way to implement serialization so that we can send these types between the host/guest.
  • unidiomatic way to derive default trait implementations of TryFrom in/out of SerializedBytes
  • Helper macro for implementing ToSql, when using rusqlite as a dependency
  • Helper macro for implementing ToSql, when using rusqlite as a dependency
  • Cryptographic secrets are fiddly at the best of times.

Structs§

Enums§

  • Action contains variants for each type of action.
  • Enum to mirror Action for all the shared data required to build session actions. Does NOT hold any agent specific information.
  • A unit enum which just maps onto the different Action variants, without containing any extra data
  • Get either the full activity or just the status of the chain
  • Target of a block. Each target type has an ID and associated reason.
  • Represents access requirements for capability grants.
  • Represents a potentially valid access grant to a zome call. Zome call response will be Unauthorized without a valid grant.
  • Reason why we might want to block a cell.
  • Specify which Actions to allow through this filter.
  • Defines several ways that queries can be restricted to a range. Notably hash bounded ranges disambiguate forks whereas sequence indexes do not as the same position can be found in many forks. The reason that this does NOT use native rust range traits is that the hash bounded queries MUST be inclusive otherwise the integrity and fork disambiguation logic is impossible. An exclusive range bound that does not include the final action tells us nothing about which fork to select between N forks of equal length that proceed it. With an inclusive hash bounded range the final action always points unambiguously at the “correct” fork that the range is over. Start hashes are not needed to provide this property so ranges can be hash terminated with a length of preceeding records to return only. Technically the seq bounded ranges do not imply any fork disambiguation and so could be a range but for simplicity we left the API symmetrical in boundedness across all enum variants. @TODO It may be possible to provide/implement RangeBounds in the case that a full sequence of records/actions is provided but it would need to be handled as inclusive first, to enforce the integrity of the query, then the exclusiveness achieved by simply removing the final record after the fact.
  • Status of the agent activity chain
  • Ways of specifying a clone cell.
  • Errors during conversion from RoleName to CloneId.
  • Errors related to the secure primitive macro.
  • Return type for get_details calls. ActionHash returns a Record. EntryHash returns an Entry.
  • Structure holding the entry portion of a chain record.
  • Either a Action::Create or a Action::Update. These actions both create a new instance of an Entry.
  • Either an EntryDefIndex or one of:
  • The status of an Entry in the Dht
  • Errors involving app entry creation
  • Allows Actions which reference Entries to know what type of Entry it is referencing. Useful for examining Actions without needing to fetch the corresponding Entries.
  • Describes the get call and what information the caller is concerned about. This helps the subconscious avoid unnecessary network calls.
  • A collection of zome/function pairs
  • Input to holochain hash function.
  • Output from the holochain hashing host function.
  • Anything that can go wrong while calling a HostFnApi method
  • A human-readable timestamp which is represented/serialized as an RFC3339 when possible, and a microsecond integer count otherwise. Both representations can be deserialized to this type.
  • The result of the DNA initialization callback.
  • Reason why we might want to block an IP.
  • Maps directly to the tracing Levels but here to define the interface. See https://docs.rs/tracing-core/0.1.17/tracing_core/struct.Level.html
  • Filter on a set of LinkTypes.
  • Reason why we might want to block a node.
  • These are the operations that can be applied to Holochain data. Every Action produces a set of operations. These operations are each sent to an authority for validation.
  • A preflight request can be accepted, or invalid, or valid but the local agent cannot accept it.
  • Represents the different ways the entry_address reference within an action can be interpreted
  • The level of validation package required by an entry.
  • Defines either a persisted or ephemeral schedule for a schedule function. Persisted schedules survive a conductor reboot, ephemeral will not. Persisted schedules continue beyond irrecoverable errors, ephemeral do not.
  • Scheduling errors.
  • Errors related to the secure primitive macro.
  • A full UnitEnum, or just the unit type of that UnitEnum
  • Unresolved dependencies that are either a set of hashes or an agent activity query.
  • The validation status for an op or record much of this happens in the subconscious an entry missing validation dependencies may cycle through Pending many times before finally reaching a final validation state or being abandoned
  • Input to the weigh callback. Includes an “unweighed” action, and Entry if applicable.
  • Response to a zome call.
  • Just the definition of a Zome, without the name included. This exists mainly for use in HashMaps where ZomeDefs are keyed by ZomeName.
  • Anything that can go wrong while calling a HostFnApi method

Constants§

  • The number of bits we want for a comfy secret.
  • The number of bytes we want for a comfy secret.
  • Delimiter in a clone id that separates the base cell’s role name from the clone index.
  • Entries larger than this number of bytes cannot be created
  • 8 seems like a reasonable limit of agents to countersign.
  • Need at least two to countersign.
  • One million
  • Expire persisted schedules after this long.
  • Any action with a action_seq less than this value is part of a record created during genesis. Anything with this seq or higher was created after genesis.
  • Tick the scheduler every this many millis.
  • The timestamps on actions for a session use this offset relative to the session start time. This makes it easier for agents to accept a preflight request with actions that are after their current chain top, after network latency.
  • Maximum time in the future the session start can be in the opinion of the participating agent. As the action will be SESSION_ACTION_TIME_OFFSET after the session start we include that here.
  • Ed25519 signatures are always the same length, 64 bytes.

Statics§

  • 10MB of entropy free for the taking. Useful for initializing arbitrary::Unstructured data

Traits§

  • Builder for non-genesis Actions
  • A trait to unify the “inner” parts of an Action, i.e. the structs inside the Action enum’s variants. This trait is used for the “unweighed” version of each struct, i.e. the version with weight information erased.
  • A trait to unify the “inner” parts of an Action, i.e. the structs inside the Action enum’s variants. This trait is used for the “weighed” version of each struct, i.e. the version without weight information erased.
  • Extend holo_hash::AgentPubKey with additional signature functionality from Keystore.
  • A data structure that can be deserialized from any data format supported by Serde.
  • Trait for binding static EntryDef property access for a type. This trait maps a type to its corresponding EntryDef property at compile time.
  • Helper trait for deserializing Entrys to the correct type.
  • Data that requires a validation status.
  • A helper trait for finding the app defined link type from a ZomeIndex and LinkType.
  • A data structure that can be serialized into any data format supported by Serde.
  • Simple and safe type conversions that may fail in a controlled way under some circumstances. It is the reciprocal of TryInto.
  • Trait to convert from dna properties into specified type
  • An attempted conversion that consumes self, which may or may not be expensive.
  • Helper trait for types that are internally represented as u8 but need to be used as indicies into containers.
  • A utility trait for associating a data enum with a unit enum that has the same variants.

Functions§

Type Aliases§

Derive Macros§