Skip to documentation
SLOP

tiny.content.Reference

Reference tiny.content Reference

Defined in tiny.content.

The name of one piece of content passed by a caller to every read and every publication: what it hashes to and how long it is.

API (4)

Actions

Public operations.

Fields and members

Public fields and members.

No direct callersNo direct callstiny.contentReference
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/content/src/model.zig:87

zig
/// The name of one piece of content passed by a caller to every read and every/// publication: what it hashes to and how long it is. The struct holds an/// identifier and an extent as plain values that copy freely.pub const Reference = struct {    identifier: Identifier,    extent: Extent,    /// Derives both halves of a reference from the complete bytes, as a caller    /// does before publishing them, and returns `ContentExtentExceeded` when    /// the byte length does not fit an extent.    pub fn fromBytes(        algorithm: Algorithm,        bytes: []const u8,    ) ReferenceError!Reference {        return .{            .identifier = Identifier.fromBytes(algorithm, bytes),            .extent = try Extent.fromUsize(bytes.len),        };    }    /// Checks borrowed bytes against this reference before a sink hands them to    /// a provider, or when a caller receives bytes elsewhere. The function    /// returns `ContentExtentMismatch` when the byte length differs from the    /// extent, and `ContentIdentifierMismatch` when the digest of the bytes    /// differs from the identifier.    pub fn verify(self: Reference, bytes: []const u8) ReferenceError!void {        if (bytes.len != self.extent.toUsize()) {            return error.ContentExtentMismatch;        }        if (!self.identifier.matches(bytes)) {            return error.ContentIdentifierMismatch;        }    }};

Source: lib/content/src/root.zig:32

zig
pub const Reference = model.Reference;
Called byCallstest sourcelib.content.src.modeltest: reference verification separate...ExtentfromUsizeIdentifierfromBytesReferencefromBytes
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersExtenttoUsizeIdentifiermatchesReferenceverify
Static calls · unresolved targets: 0 · external targets: 0.

Audit

Definitions3
Public names3
Members2
Version26.7.0
Revisiondaab053ee433