Documentation
¶
Index ¶
- Constants
- Variables
- type AcceptArguments
- type AcceptOK
- type AddArguments
- type AddOK
- type AllocateArguments
- type AllocateOK
- type Blob
- type BlobAddress
- type ListArguments
- type ListBlobItem
- type ListOK
- type RemoveArguments
- type RemoveOK
- type ReplicateArguments
- type ReplicateOK
- type RetrieveArguments
- type RetrieveBlob
- type RetrieveOK
Constants ¶
const AcceptCommand = "/blob/accept"
const AddCommand = "/blob/add"
const AllocateCommand = "/blob/allocate"
const ListCommand = "/blob/list"
const MaxBlobSize = 268_435_456
const RemoveCommand = "/blob/remove"
const ReplicateCommand = "/blob/replicate"
const RetrieveCommand = "/blob/retrieve"
Variables ¶
var Accept = capabilities.MustNew[*AcceptArguments](AcceptCommand)
var Add = capabilities.MustNew[*AddArguments]( AddCommand, capability.WithPolicyBuilder( policy.GreaterThan(".blob.size", 0), policy.LessThanOrEqual(".blob.size", MaxBlobSize), ), )
var Allocate = capabilities.MustNew[*AllocateArguments]( AllocateCommand, capability.WithPolicyBuilder( policy.GreaterThan(".blob.size", 0), policy.LessThanOrEqual(".blob.size", MaxBlobSize), ), )
var List = capabilities.MustNew[*ListArguments](ListCommand)
var Remove = capabilities.MustNew[*RemoveArguments](RemoveCommand)
var Replicate = capabilities.MustNew[*ReplicateArguments]( ReplicateCommand, capability.WithPolicyBuilder( policy.GreaterThan(".blob.size", 0), policy.LessThanOrEqual(".blob.size", MaxBlobSize), policy.GreaterThanOrEqual(".replicas", 1), ), )
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 = capabilities.MustNew[*RetrieveArguments](RetrieveCommand)
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/capabilities/content.Retrieve` (the `/content/retrieve` capability).
Functions ¶
This section is empty.
Types ¶
type AcceptArguments ¶
type AcceptArguments struct {
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 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 {
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 capabilities.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 RemoveArguments ¶
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 RemoveOK ¶
type RemoveOK = capabilities.Unit
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)