Expand description

Types for source chain queries

Macros

unidiomatic way to derive default trait implementations of TryFrom in/out of SerializedBytes

Structs

An agents chain elements returned from a agent_activity_query

The chain has been forked by these two headers

The header at the head of the complete chain. This is as far as this authority can see a chain with no gaps.

Query arguments

The highest header sequence observed by this authority. This also includes the headers at this sequence. If there is more then one then there is a fork.

A Canonical Serialized Bytes representation for data If you have a data structure that needs a canonical byte representation use this Always round-trip through SerializedBytes via. a single TryFrom implementation. This ensures that the internal bytes of SerializedBytes are indeed canonical. The corrolary is that if bytes are NOT wrapped in SerializedBytes we can assume they are NOT canonical. Typically we need a canonical serialization when data is to be handled at the byte level by independently implemented and maintained systems.

UnsafeBytes the only way to implement a custom round trip through bytes for SerializedBytes It is intended to be an internal implementation in TryFrom implementations The assumption is that any code using UnsafeBytes is NOT valid messagepack data This allows us to enforce that all data round-tripping through SerializedBytes is via TryFrom and also allow for custom non-messagepack canonical representations of data types.

Enums

Get either the full activity or just the status of the chain

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 header 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 header 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 elements 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 elements/headers 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 element after the fact.

Status of the agent activity chain

Traits

A data structure that can be deserialized from any data format supported by Serde.

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.

An attempted conversion that consumes self, which may or may not be expensive.

Functions

Derive Macros