tiny.content.Sink
Defined in tiny.content.
Write capability over one provider, for a holder that may add bytes to a store and nothing else.
API (5)
Actions
Public operations.
put: Makes bytes retrievable under the reference a caller derived from them by checking the bytes against the reference and then asking the provider to publish them.
Types and contracts
Public types and contracts.
Fields and members
Public fields and members.
Source
Source: lib/content/src/capability.zig:95
zig
/// Write capability over one provider, for a holder that may add bytes to a/// store and nothing else. The capability carries three things: an opaque/// context pointer for the provider, the capacity the store was built with, and/// a function table whose single entry publishes bytes. Publishing is its whole/// surface, so holding a Sink grants no way to read, look up, list, or delete.pub const Sink = struct { context: *anyopaque, capacity: model.Capacity, vtable: *const VTable, pub const VTable: type = SinkVTable; /// Makes bytes retrievable under the reference a caller derived from them /// by checking the bytes against the reference and then asking the provider /// to publish them. The call rejects a reference whose extent is above the /// object ceiling first, with `ContentExtentExceeded`, and verifies the /// bytes against the reference next, so a length or digest disagreement /// stops the call before the provider sees anything. The call returns the /// provider's publication answer, `created` for new bytes and `exists_same` /// for bytes already held under this reference. pub fn put( self: Sink, reference: model.Reference, bytes: []const u8, ) PublicationError!Publication { try self.capacity.validateReference(reference); try reference.verify(bytes); return self.vtable.put(self.context, reference, bytes); }};Source: lib/content/src/root.zig:41
zig
pub const Sink = capability.Sink;Audit
| Definitions | 3 |
|---|---|
| Public names | 3 |
| Members | 3 |
| Version | 26.7.0 |
| Revision | daab053ee433 |