Module holochain::core

source ·
Expand description

Defines the core Holochain workflows

Modules

Include nice string encoding methods and From impls
HoloHash Error Type.
Defines the prefixes for the various HashTypes, as well as the traits which unify them
Manages the spawning of tasks which process the various work queues in the system, as well as notifying subsequent queue processors to pick up the work that was left off.
A Ribosome is a structure which knows how to execute hApp code.
Workflows are the core building block of Holochain functionality.

Macros

Helper for ensuring the the proper number of bytes is used in various situations
A default HashableContent implementation, suitable for content which is already TryInto, and uses a PrimitiveHashType

Structs

A newtype for a collection of EntryHashes, needed for some wasm return types.
A HoloHash contains a vector of 36 bytes representing a 32-byte blake2b hash plus 4 bytes representing a DHT location. It also contains a zero-sized type which specifies what it is a hash of.
A wrapper around HoloHash that Serializes into a base64 string rather than a raw byte array.
Represents some piece of content along with its hash representation, so that hashes need not be calculated multiple times. Provides an easy constructor which consumes the content.
Allows you to send an op to the incoming_dht_ops_workflow if you found it on the network and were supposed to be holding it.
A microsecond-precision UTC timestamp for use in Holochain’s actions.

Enums

The primitive hash types represented by this composite hash
The primitive hash types represented by this composite hash
HashableContent can be expressed as “content”, or “prehashed”, which affects how a HoloHashed type will be constructed from it.
Validation can result in either
All the outcomes that can come from validation This is not an error type it is the outcome of failed validation.

Constants

Length of the core bytes (32)
Length of the full HoloHash bytes (39 = 3 + 32 + 4)
Length of the location bytes (4)
Length of the prefix bytes (3)
Length of the core bytes + the loc bytes (36 = 32 + 4), i.e. everything except the type prefix
16mb limit on Entries due to websocket limits. 4mb limit to constrain bandwidth usage on uploading. (Assuming a baseline 5mbps upload for now… update this as consumer internet connections trend toward more upload) Consider splitting large entries up.
The maximum size to hash synchronously. Anything larger than this will take too long to hash within a single tokio context
1kb limit on LinkTags. Tags are used as keys to the database to allow fast lookup so they should be small.

Traits

Anything which has an owned HoloHashOf.
Every HoloHash is generic over HashType. Additionally, every HashableContent has an associated HashType. The HashType is the glue that binds together HashableContent with its hash.
Any implementor of HashableContent may be used in a HoloHashed to pair data with its HoloHash representation. It also has an associated HashType.
Adds convenience methods for constructing HoloHash and HoloHashed from some HashableContent
Adds convenience methods for constructing HoloHash and HoloHashed from some HashableContent
A PrimitiveHashType is one with a multihash prefix. In contrast, a non-primitive hash type could be one of several primitive types, e.g. an AnyDhtHash can represent one of three primitive types.

Functions

Verify the author key was valid at the time of signing with dpki TODO: This is just a stub until we have dpki.
If we are not holding this entry then retrieve any record at this EntryHash and send it as a StoreEntry DhtOp to our incoming_dht_ops_workflow.
If we are not holding this action then retrieve it and send it as a RegisterAddLink DhtOp to our incoming_dht_ops_workflow.
If we are not holding this action then retrieve it and send it as a RegisterAgentActivity DhtOp to our incoming_dht_ops_workflow.
If we are not holding this action then retrieve it and send it as a StoreEntry DhtOp to our incoming_dht_ops_workflow.
If we are not holding this action then retrieve it and send it as a StoreRecord DhtOp to our incoming_dht_ops_workflow.
Check the AppEntryDef is valid for the zome. Check the EntryDefId and ZomeIndex are in range.
Check if there are other actions at this sequence number
Verify that the signature on a preflight request is valid.
Verify all the countersigning session data together.
Verify the countersigning session contains the specified action.
Check the actions entry hash matches the hash of the entry
Check the entry size is under the MAX_ENTRY_SIZE
Check the entry variant matches the variant in the actions entry type
Check the action should have an entry. Is either a Create or Update
Check the app entry type isn’t private for store entry
Check that the correct actions have the correct setting for prev_action:
Check the previous action is one less than the current
Check previous action timestamp is before this action
Placeholder for future spam check. Check action timestamps don’t exceed MAX_PUBLISH_FREQUENCY
Check the link tag size is under the MAX_TAG_SIZE
Check a Update’s entry type is the same for original and new entry.
Check that Dna actions are only added to empty source chains
internal PARSE for holo hash REPR
internal PARSE for holo hash REPR
internal REPR for holo hash
Validate a chain of actions with an optional starting point.
Verify the signature for this action

Type Definitions

The hash of an action
Base64-ready version of ActionHash
An Agent public signing key. Not really a hash, more of an “identity hash”.
Base64-ready version of AgentPubKey
The hash of anything referrable in the DHT. This is a composite of either an EntryHash or a ActionHash
Base64-ready version of AnyDhtHash
The hash of anything linkable.
Base64-ready version of AnyLinkableHash
The hash of a DhtOp’s “unique form” representation
Base64-ready version of DhtOpHash
The hash of a DnaDef
Base64-ready version of DnaHash
The hash of an Entry.
Base64-ready version of EntryHash
The hash of some external data that can’t or doesn’t exist on the DHT.
Base64-ready version of ExternalHash
A convenience type, for specifying a hash by HashableContent rather than by its HashType
The hash of a network ID
Base64-ready version of NetIdHash
Alias for AnyLinkableHash. This hash forms the notion of the “basis hash” of an op.
Return either:
The hash of some wasm bytecode
Base64-ready version of WasmHash
A public key of a pair of signing keys for signing zome calls.