Documentation
¶
Index ¶
- Constants
- Variables
- type AbortArguments
- type AbortOK
- type AcceptArguments
- type AcceptOK
- type AddArguments
- type AddOK
- type AllocateArguments
- type AllocateOK
- type Blob
- type BlobAddress
- type ListArguments
- type ListBlobItem
- type ListOK
- type RejectArguments
- type RejectOK
- type ReleaseArguments
- type ReleaseOK
- type RemoveArguments
- type RemoveOK
- type ReplicateArguments
- type ReplicateOK
- type RetrieveArguments
- type RetrieveBlob
- type RetrieveOK
Constants ¶
const BlobAcceptedErrorName = "BlobAccepted"
BlobAcceptedErrorName is the stable receipt-failure name when reject is invoked for a blob the invoking space has accepted — accepted blobs are released via `/blob/remove`, never rejected.
const InvalidCauseErrorName = "InvalidCause"
InvalidCauseErrorName is the stable receipt-failure name when the linked `/blob/remove` task's subject does not equal Space or its digest does not equal Digest.
const MaxBlobSize = (256 << 20) * 127 / 128
MaxBlobSize is the network-wide ceiling on a single blob, in bytes, as shipped to a storage node: the most raw bytes a default-configured piri accepts in one piece. Piri's default piece ceiling is a 256 MiB PADDED piece (piri pkg/pdp/piecesize, DefaultMaxPaddedSize), and Fr32 padding leaves 127/128 of it for data — 266338304 (~254 MiB). Piri's piece config is raise-only (an operator may accept more, never less), so a client sharding uploads at this constant is safe against every conforming node.
This measures the stored artifact. An encrypting client must choose its plaintext split below this, leaving room for its envelope framing.
const MissingCauseErrorName = "MissingCause"
MissingCauseErrorName is the stable receipt-failure name when an abort's Cause is missing or does not resolve to a known `/blob/add` task — without it the upload service cannot recover which storage node holds the parked blob.
const UnknownCauseErrorName = "UnknownCause"
UnknownCauseErrorName is the stable receipt-failure name when a release's Cause is undefined, the linked invocation is not present in the request container, or the linked invocation is not a `/blob/remove` task.
Variables ¶
var Abort = binding.Bind[*AbortArguments, *AbortOK](command.MustParse("/blob/abort"))
Abort (/blob/abort) abandons an in-flight upload of a PARKED blob — allocated but never accepted, whether or not the bytes ever reached the storage node. It is the client-facing abandon verb: an upload ends in exactly one of `/blob/accept` (commit) or an abort that the upload service translates into `/blob/reject` on the storage node holding the allocation.
Served by the upload service (subject = the space). A parked blob has no registration or acceptance to look the storage node up by, so the service recovers it from the Cause receipt chain and forwards a `/blob/reject` (Cause itself is not forwarded — it is routing metadata, meaningless to the node). A missing or unknown Cause fails with MissingCause. Blobs the space has accepted are released via `/blob/remove` instead; if the node refuses the translated reject with BlobAccepted, the service surfaces that named failure in the abort receipt. The abort mutates no upload-service state, so a failed abort is safely retryable.
Idempotent: aborting an unknown or already-rejected blob succeeds. The receipt carries no payload (Unit).
var Accept = binding.Bind[*AcceptArguments, *AcceptOK](command.MustParse("/blob/accept"))
var Add = binding.Bind[*AddArguments, *AddOK](command.MustParse("/blob/add"))
var Allocate = binding.Bind[*AllocateArguments, *AllocateOK](command.MustParse("/blob/allocate"))
var ErrBlobAccepted = errors.New(BlobAcceptedErrorName, "blob has been accepted by the space; release the claim via /blob/remove")
var ErrInvalidCause = errors.New(InvalidCauseErrorName, "cause invocation does not match release arguments")
var ErrMissingCause = errors.New(MissingCauseErrorName, "abort requires the cause of the /blob/add task that parked the blob")
var ErrUnknownCause = errors.New(UnknownCauseErrorName, "unknown cause invocation")
var List = binding.Bind[*ListArguments, *ListOK](command.MustParse("/blob/list"))
var Reject = binding.Bind[*RejectArguments, *RejectOK](command.MustParse("/blob/reject"))
Reject (/blob/reject) is the "don't accept" inverse of `/blob/accept`: it retires a PARKED blob — allocated, never accepted, whether or not its bytes were ever received. A blob's lifecycle on a storage node ends in exactly one of `/blob/accept` (commit: aggregation, location claim, registration) or `/blob/reject` (drop: allocation released, bytes deleted).
Served by storage nodes (subject = the provider DID, invoked by the upload service under its registration delegation, typically translating a client `/blob/abort`). The node drops the space's allocation and deletes any received bytes once no space holds an allocation or acceptance for the digest.
A blob that THE INVOKING SPACE has accepted is refused with BlobAccepted — a space's accepted blobs are released via `/blob/remove`, never rejected. The guard is scoped to the invoking space, not the digest: another space's acceptance of the same bytes must not block the reject — the node simply drops this space's allocation and retains the bytes for the space that still claims them.
Idempotent: rejecting an unknown or already-rejected blob succeeds. The receipt carries no payload (Unit).
var Release = binding.Bind[*ReleaseArguments, *ReleaseOK](command.MustParse("/blob/release"))
Release (/blob/release) is the claim-release inverse of `/blob/allocate`: it drops one space's reference to a blob on a storage node. It is the upload service's translation of a client `/blob/remove`.
Served by storage nodes (subject = the provider DID, invoked by the upload service under its registration delegation; the space travels in the arguments, matching Allocate/Accept). The node drops the space's allocation, acceptance and location claim. Bytes are physically deleted only when no space claims the digest anymore — and an accepted blob's bytes may additionally be retained until its PDP aggregate root is fully retired on-chain. Physical deletion is always asynchronous: the removal machinery re-verifies zero claims before every destructive step.
The release carries Cause, a link to the originating `/blob/remove` task, and the remove invocation itself MUST ride in the request container so the node can verify the release is legitimate rather than trusting the upload service: the node rejects releases whose cause invocation is absent or not a `/blob/remove` task (UnknownCause), or whose subject/digest do not match the release's Space/Digest (InvalidCause).
Idempotent: releasing an unknown or already-released blob succeeds. The receipt carries no payload (Unit).
var Remove = binding.Bind[*RemoveArguments, *RemoveOK](command.MustParse("/blob/remove"))
Remove (/blob/remove) releases a space's claim on an ACCEPTED blob.
Served by the upload service (subject = the space). The service validates the caller's space authority, recovers every storage node holding the blob (the primary via the registration's receipt chain, plus any non-failed replicas), forwards a `/blob/release` to each, and deregisters the blob last — so the receipt chain to the primary survives for a retry if every forward fails. Forwarding is best-effort: the node-side handler is idempotent and unclaimed allocations expire, so a missed node is reconciled by provider-side hygiene.
Parked (never-accepted) blobs are abandoned via `/blob/abort` instead.
Idempotent: removing an unknown or already-removed blob succeeds. The receipt carries no payload (Unit).
var Replicate = binding.Bind[*ReplicateArguments, *ReplicateOK](command.MustParse("/blob/replicate"))
Replicate is a capability that allows an agent to replicate a Blob into a space identified by did:key in the `with` field.
A Replicate capability may only be invoked after a `/blob/accept` receipt has been receieved, indicating the source node has successfully received the blob. Each Replicate task MUST target a different node, and they MUST NOT target the original upload target.
The Replicate task receipt includes async tasks for `/blob/replica/allocate` and `/blob/replica/transfer`. Successful completion of the `/blob/replica/transfer` task indicates the replication target has transferred and stored the blob. The number of `/blob/replica/allocate` and `/blob/replica/transfer` tasks corresponds directly to number of replicas requested.
var Retrieve = binding.Bind[*RetrieveArguments, *RetrieveOK](command.MustParse("/blob/retrieve"))
Retrieve is the service-level retrieval capability (e.g. used by the indexer to fetch content claims from a Piri node). It is NOT space-scoped: any holder of a valid delegation for `/blob/retrieve` may fetch the blob by digest, regardless of which space it was originally stored under.
For user-facing retrieval that requires an allocation in a specific space see `libforge/commands/content.Retrieve` (the `/content/retrieve` capability).
Functions ¶
This section is empty.
Types ¶
type AbortArguments ¶
type AbortArguments struct {
Digest multihash.Multihash `cborgen:"digest" dagjsongen:"digest"`
Cause cid.Cid `cborgen:"cause" dagjsongen:"cause"`
}
AbortArguments abandons the invoking space's in-flight upload of the parked (never-accepted) blob identified by Digest. The space is the invocation subject. Cause is the `/blob/add` task link: the upload service uses it to recover which storage node holds the parked blob — a parked blob has no registration or acceptance to look the node up by.
func (*AbortArguments) MarshalCBOR ¶
func (t *AbortArguments) MarshalCBOR(w io.Writer) error
func (*AbortArguments) MarshalDagJSON ¶
func (t *AbortArguments) MarshalDagJSON(w io.Writer) error
func (*AbortArguments) UnmarshalCBOR ¶
func (t *AbortArguments) UnmarshalCBOR(r io.Reader) (err error)
func (*AbortArguments) UnmarshalDagJSON ¶
func (t *AbortArguments) UnmarshalDagJSON(r io.Reader) (err error)
type AcceptArguments ¶
type AcceptArguments struct {
Space did.DID `cborgen:"space" dagjsongen:"space"`
Blob Blob `cborgen:"blob" dagjsongen:"blob"`
Put promise.AwaitOK `cborgen:"_put" dagjsongen:"_put"`
}
func (*AcceptArguments) MarshalCBOR ¶
func (t *AcceptArguments) MarshalCBOR(w io.Writer) error
func (*AcceptArguments) MarshalDagJSON ¶
func (t *AcceptArguments) MarshalDagJSON(w io.Writer) error
func (*AcceptArguments) UnmarshalCBOR ¶
func (t *AcceptArguments) UnmarshalCBOR(r io.Reader) (err error)
func (*AcceptArguments) UnmarshalDagJSON ¶
func (t *AcceptArguments) UnmarshalDagJSON(r io.Reader) (err error)
type AcceptOK ¶
type AddArguments ¶
type AddArguments struct {
Blob Blob `cborgen:"blob" dagjsongen:"blob"`
}
func (*AddArguments) MarshalCBOR ¶
func (t *AddArguments) MarshalCBOR(w io.Writer) error
func (*AddArguments) MarshalDagJSON ¶
func (t *AddArguments) MarshalDagJSON(w io.Writer) error
func (*AddArguments) UnmarshalCBOR ¶
func (t *AddArguments) UnmarshalCBOR(r io.Reader) (err error)
func (*AddArguments) UnmarshalDagJSON ¶
func (t *AddArguments) UnmarshalDagJSON(r io.Reader) (err error)
type AddOK ¶
type AllocateArguments ¶
type AllocateArguments struct {
Space did.DID `cborgen:"space" dagjsongen:"space"`
Blob Blob `cborgen:"blob" dagjsongen:"blob"`
Cause cid.Cid `cborgen:"cause" dagjsongen:"cause"`
}
func (*AllocateArguments) MarshalCBOR ¶
func (t *AllocateArguments) MarshalCBOR(w io.Writer) error
func (*AllocateArguments) MarshalDagJSON ¶
func (t *AllocateArguments) MarshalDagJSON(w io.Writer) error
func (*AllocateArguments) UnmarshalCBOR ¶
func (t *AllocateArguments) UnmarshalCBOR(r io.Reader) (err error)
func (*AllocateArguments) UnmarshalDagJSON ¶
func (t *AllocateArguments) UnmarshalDagJSON(r io.Reader) (err error)
type AllocateOK ¶
type AllocateOK struct {
Size uint64 `cborgen:"size" dagjsongen:"size"`
Address *BlobAddress `cborgen:"address,omitempty" dagjsongen:"address,omitempty"`
}
func (*AllocateOK) MarshalCBOR ¶
func (t *AllocateOK) MarshalCBOR(w io.Writer) error
func (*AllocateOK) MarshalDagJSON ¶
func (t *AllocateOK) MarshalDagJSON(w io.Writer) error
func (*AllocateOK) UnmarshalCBOR ¶
func (t *AllocateOK) UnmarshalCBOR(r io.Reader) (err error)
func (*AllocateOK) UnmarshalDagJSON ¶
func (t *AllocateOK) UnmarshalDagJSON(r io.Reader) (err error)
type Blob ¶
type BlobAddress ¶
type BlobAddress struct {
URL commands.CborURL `cborgen:"url" dagjsongen:"url"`
Headers map[string]string `cborgen:"headers" dagjsongen:"headers"`
Expires int64 `cborgen:"expires" dagjsongen:"expires"`
}
func (*BlobAddress) MarshalCBOR ¶
func (t *BlobAddress) MarshalCBOR(w io.Writer) error
func (*BlobAddress) MarshalDagJSON ¶
func (t *BlobAddress) MarshalDagJSON(w io.Writer) error
func (*BlobAddress) UnmarshalCBOR ¶
func (t *BlobAddress) UnmarshalCBOR(r io.Reader) (err error)
func (*BlobAddress) UnmarshalDagJSON ¶
func (t *BlobAddress) UnmarshalDagJSON(r io.Reader) (err error)
type ListArguments ¶
type ListArguments struct {
Cursor *string `cborgen:"cursor,omitempty" dagjsongen:"cursor,omitempty"`
Size *uint64 `cborgen:"size,omitempty" dagjsongen:"size,omitempty"`
}
func (*ListArguments) MarshalCBOR ¶
func (t *ListArguments) MarshalCBOR(w io.Writer) error
func (*ListArguments) MarshalDagJSON ¶
func (t *ListArguments) MarshalDagJSON(w io.Writer) error
func (*ListArguments) UnmarshalCBOR ¶
func (t *ListArguments) UnmarshalCBOR(r io.Reader) (err error)
func (*ListArguments) UnmarshalDagJSON ¶
func (t *ListArguments) UnmarshalDagJSON(r io.Reader) (err error)
type ListBlobItem ¶
type ListBlobItem struct {
Blob Blob `cborgen:"blob" dagjsongen:"blob"`
InsertedAt int64 `cborgen:"insertedAt" dagjsongen:"insertedAt"`
}
func (*ListBlobItem) MarshalCBOR ¶
func (t *ListBlobItem) MarshalCBOR(w io.Writer) error
func (*ListBlobItem) MarshalDagJSON ¶
func (t *ListBlobItem) MarshalDagJSON(w io.Writer) error
func (*ListBlobItem) UnmarshalCBOR ¶
func (t *ListBlobItem) UnmarshalCBOR(r io.Reader) (err error)
func (*ListBlobItem) UnmarshalDagJSON ¶
func (t *ListBlobItem) UnmarshalDagJSON(r io.Reader) (err error)
type ListOK ¶
type ListOK struct {
Cursor *string `cborgen:"cursor,omitempty" dagjsongen:"cursor,omitempty"`
Size uint64 `cborgen:"size" dagjsongen:"size"`
Results []ListBlobItem `cborgen:"results" dagjsongen:"results"`
}
type RejectArguments ¶
type RejectArguments struct {
Space did.DID `cborgen:"space" dagjsongen:"space"`
Digest multihash.Multihash `cborgen:"digest" dagjsongen:"digest"`
}
RejectArguments drops Space's allocation for the parked (never-accepted) blob identified by Digest on the storage node; the node deletes any received bytes once no space holds an allocation or acceptance for the digest.
func (*RejectArguments) MarshalCBOR ¶
func (t *RejectArguments) MarshalCBOR(w io.Writer) error
func (*RejectArguments) MarshalDagJSON ¶
func (t *RejectArguments) MarshalDagJSON(w io.Writer) error
func (*RejectArguments) UnmarshalCBOR ¶
func (t *RejectArguments) UnmarshalCBOR(r io.Reader) (err error)
func (*RejectArguments) UnmarshalDagJSON ¶
func (t *RejectArguments) UnmarshalDagJSON(r io.Reader) (err error)
type ReleaseArguments ¶
type ReleaseArguments struct {
Space did.DID `cborgen:"space" dagjsongen:"space"`
Digest multihash.Multihash `cborgen:"digest" dagjsongen:"digest"`
// Cause is the link to the `/blob/remove` task this release translates.
// The linked invocation MUST be present in the request container; the
// node verifies its subject equals Space and its digest equals Digest
// before dropping the claim.
Cause cid.Cid `cborgen:"cause" dagjsongen:"cause"`
}
ReleaseArguments drops Space's claim on the blob identified by Digest on a storage node. Space is explicit (matching Allocate/Accept) because the invocation subject is the provider, and storage nodes key allocations and acceptances by (digest, space): release drops one space's claim, and the node performs physical deletion only once no space claims the digest at all. Cause proves the release originates from the space: it links the `/blob/remove` task the release translates.
func (*ReleaseArguments) MarshalCBOR ¶
func (t *ReleaseArguments) MarshalCBOR(w io.Writer) error
func (*ReleaseArguments) MarshalDagJSON ¶
func (t *ReleaseArguments) MarshalDagJSON(w io.Writer) error
func (*ReleaseArguments) UnmarshalCBOR ¶
func (t *ReleaseArguments) UnmarshalCBOR(r io.Reader) (err error)
func (*ReleaseArguments) UnmarshalDagJSON ¶
func (t *ReleaseArguments) UnmarshalDagJSON(r io.Reader) (err error)
type RemoveArguments ¶
RemoveArguments releases the invoking space's claim on the blob identified by Digest. The space is the invocation subject — it is not repeated in the arguments (compare ReleaseArguments, the provider-rooted leg, where the subject is the provider and the space must travel explicitly).
func (*RemoveArguments) MarshalCBOR ¶
func (t *RemoveArguments) MarshalCBOR(w io.Writer) error
func (*RemoveArguments) MarshalDagJSON ¶
func (t *RemoveArguments) MarshalDagJSON(w io.Writer) error
func (*RemoveArguments) UnmarshalCBOR ¶
func (t *RemoveArguments) UnmarshalCBOR(r io.Reader) (err error)
func (*RemoveArguments) UnmarshalDagJSON ¶
func (t *RemoveArguments) UnmarshalDagJSON(r io.Reader) (err error)
type ReplicateArguments ¶
type ReplicateArguments struct {
// Blob is the blob that must be replicated.
Blob Blob `cborgen:"blob" dagjsongen:"blob"`
// Replicas is the number of replicas to ensure.
// e.g. Replicas: 3 will ensure 3 copies of the data exist in a network in total.
Replicas uint64 `cborgen:"replicas" dagjsongen:"replicas"`
// Site is a link to a location commitment indicating where the Blob must be
// fetched from.
Site cid.Cid `cborgen:"site" dagjsongen:"site"`
}
func (*ReplicateArguments) MarshalCBOR ¶
func (t *ReplicateArguments) MarshalCBOR(w io.Writer) error
func (*ReplicateArguments) MarshalDagJSON ¶
func (t *ReplicateArguments) MarshalDagJSON(w io.Writer) error
func (*ReplicateArguments) UnmarshalCBOR ¶
func (t *ReplicateArguments) UnmarshalCBOR(r io.Reader) (err error)
func (*ReplicateArguments) UnmarshalDagJSON ¶
func (t *ReplicateArguments) UnmarshalDagJSON(r io.Reader) (err error)
type ReplicateOK ¶
type ReplicateOK struct {
// Site resolves to additional locations for the blob. They are links to
// `/blob/replica/transfer` tasks.
Site []promise.AwaitOK `cborgen:"site" dagjsongen:"site"`
}
func (*ReplicateOK) MarshalCBOR ¶
func (t *ReplicateOK) MarshalCBOR(w io.Writer) error
func (*ReplicateOK) MarshalDagJSON ¶
func (t *ReplicateOK) MarshalDagJSON(w io.Writer) error
func (*ReplicateOK) UnmarshalCBOR ¶
func (t *ReplicateOK) UnmarshalCBOR(r io.Reader) (err error)
func (*ReplicateOK) UnmarshalDagJSON ¶
func (t *ReplicateOK) UnmarshalDagJSON(r io.Reader) (err error)
type RetrieveArguments ¶
type RetrieveArguments struct {
Blob RetrieveBlob `cborgen:"blob" dagjsongen:"blob"`
}
RetrieveArguments is the argument shape of the `/blob/retrieve` capability — a service-level (not space-scoped) retrieval handle. Compare to `content.RetrieveArguments` which is space-scoped and carries a byte Range; the `/blob/retrieve` flow is consumed by service principals (e.g. the indexer) fetching content claims that aren't bound to any space.
func (*RetrieveArguments) MarshalCBOR ¶
func (t *RetrieveArguments) MarshalCBOR(w io.Writer) error
func (*RetrieveArguments) MarshalDagJSON ¶
func (t *RetrieveArguments) MarshalDagJSON(w io.Writer) error
func (*RetrieveArguments) UnmarshalCBOR ¶
func (t *RetrieveArguments) UnmarshalCBOR(r io.Reader) (err error)
func (*RetrieveArguments) UnmarshalDagJSON ¶
func (t *RetrieveArguments) UnmarshalDagJSON(r io.Reader) (err error)
type RetrieveBlob ¶
RetrieveBlob identifies a blob solely by its content multihash. Used by the service-level `/blob/retrieve` capability where the caller is fetching data by hash without prior knowledge of the byte size.
func (*RetrieveBlob) MarshalCBOR ¶
func (t *RetrieveBlob) MarshalCBOR(w io.Writer) error
func (*RetrieveBlob) MarshalDagJSON ¶
func (t *RetrieveBlob) MarshalDagJSON(w io.Writer) error
func (*RetrieveBlob) UnmarshalCBOR ¶
func (t *RetrieveBlob) UnmarshalCBOR(r io.Reader) (err error)
func (*RetrieveBlob) UnmarshalDagJSON ¶
func (t *RetrieveBlob) UnmarshalDagJSON(r io.Reader) (err error)
type RetrieveOK ¶
type RetrieveOK struct{}
RetrieveOK is the success return for `/blob/retrieve`. The blob bytes themselves are streamed back through the response container's body (the libforge HTTPHeader retrieval transport); the typed OK record is empty.
func (*RetrieveOK) MarshalCBOR ¶
func (t *RetrieveOK) MarshalCBOR(w io.Writer) error
func (*RetrieveOK) MarshalDagJSON ¶
func (t *RetrieveOK) MarshalDagJSON(w io.Writer) error
func (*RetrieveOK) UnmarshalCBOR ¶
func (t *RetrieveOK) UnmarshalCBOR(r io.Reader) (err error)
func (*RetrieveOK) UnmarshalDagJSON ¶
func (t *RetrieveOK) UnmarshalDagJSON(r io.Reader) (err error)