ContentAddress Structure

Computes deterministic guid from content data, which can also be used to implement equality. Endianness is taken care of; all data is byte-reversed when run on a big-endian platform.

Definition

Namespace: Quine.Schemas.Core
Assembly: Quine.Schemas.Core (in Quine.Schemas.Core.dll) Version: 1.0.0+0ea0706914ee4edf2b0ed66bec3ab4d062a43b68
C#
public struct ContentAddress
Inheritance
Object    ValueType    ContentAddress

Remarks

The supported types are primitives, string, DateTime, DateTimeOffset, TimeSpan, Guid, enums (converted to ulong for address computation), byte[], KeyValuePair{K,V}, IReadOnlyList{V} and types implementing IContentAddressable. Enumerables cannot be nested, and generic parameters must satisfy the same constraints. The computation also distinguishes between a null reference and an empty collection. Dictionaries are not supported because iteration may return elements in non-deterministic order between runs of the same program.

Methods

Add Visitor method used by IContentAddressable for adding values to existing computation.
Get Computes content address (a GUID) from given values. The values, together with the namespace, are fed to SHA256 and the highest 128 bits are used to form a v5 GUID.

Fields

AddressNamespace Namespace bytes used in GUID generation.

See Also