Documentation
¶
Index ¶
- Constants
- func NewHandler[A Arguments, O Success](handler HandlerFunc[A, O]) execution.HandlerFunc
- func NewMalformedArgumentsError(cause error) error
- type Arguments
- type HandlerFunc
- type Request
- type RequestOption
- type Response
- func (r *Response[O]) Metadata() ucan.Container
- func (r *Response[O]) Receipt() ucan.Receipt
- func (r *Response[O]) SetFailure(x error) error
- func (r *Response[O]) SetMetadata(meta ucan.Container) error
- func (r *Response[O]) SetReceipt(receipt ucan.Receipt) error
- func (r *Response[O]) SetSuccess(o O) error
- type ResponseOption
- func WithFailure[O Success](signer ucan.Signer, task cid.Cid, x error) ResponseOption[O]
- func WithMetadata[O Success](meta ucan.Container) ResponseOption[O]
- func WithReceipt[O Success](receipt ucan.Receipt) ResponseOption[O]
- func WithSigner[O Success](signer ucan.Signer) ResponseOption[O]
- func WithSuccess[O Success](o O) ResponseOption[O]
- type SignerSetter
- type Success
- type Task
Constants ¶
const MalformedArgumentsErrorName = "MalformedArguments"
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
func NewHandler[A Arguments, O Success](handler HandlerFunc[A, O]) execution.HandlerFunc
NewHandler creates a new execution.HandlerFunc from the provided typed handler.
Types ¶
type Arguments ¶
type Arguments interface {
cbg.CBORUnmarshaler
}
type Request ¶
func NewRequest ¶
func NewRequest[A Arguments](ctx context.Context, inv ucan.Invocation, options ...RequestOption) (*Request[A], error)
func (*Request[A]) Task ¶
Task returns an object containing just the fields that comprise the task for the invocation.
https://github.com/ucan-wg/invocation/blob/main/README.md#task
type RequestOption ¶
type RequestOption = func(cfg *requestConfig)
func WithDelegations ¶
func WithDelegations(delegations ...ucan.Delegation) RequestOption
WithDelegations adds delegations to the execution request.
func WithInvocations ¶
func WithInvocations(invocations ...ucan.Invocation) RequestOption
WithInvocations adds additional invocations to the execution request.
func WithProofs ¶
func WithProofs(delegations ...ucan.Delegation) RequestOption
WithProofs adds delegations to the execution request. They should be linked from the invocation to be executed.
func WithReceipts ¶
func WithReceipts(receipts ...ucan.Receipt) RequestOption
WithReceipts adds receipts to the execution request.
type Response ¶
type Response[O Success] struct { // contains filtered or unexported fields }
func NewResponse ¶
NewResponse creates a new response object, representing the result of executing a task.
func (*Response[O]) SetFailure ¶
func (*Response[O]) SetSuccess ¶
type ResponseOption ¶
func WithFailure ¶
WithFailure issues and sets a receipt for a failed execution of a task.
func WithMetadata ¶
func WithMetadata[O Success](meta ucan.Container) ResponseOption[O]
func WithReceipt ¶
func WithReceipt[O Success](receipt ucan.Receipt) ResponseOption[O]
func WithSigner ¶
func WithSigner[O Success](signer ucan.Signer) ResponseOption[O]
func WithSuccess ¶
func WithSuccess[O Success](o O) ResponseOption[O]
WithSuccess issues and sets a receipt for a successful execution of a task.
type SignerSetter ¶
type Success ¶
type Success interface {
cbg.CBORMarshaler
}
type Task ¶
type Task[A Arguments] struct { *invocation.Task // contains filtered or unexported fields }
func NewTask ¶
func NewTask[A Arguments]( subject did.DID, command ucan.Command, argsBytes []byte, nonce []byte, ) (*Task[A], error)
NewTask constructs a typed task. argsBytes must be the raw CBOR encoding of the args (typically obtained from invocation.Invocation.ArgumentsBytes); the bytes are decoded directly into the typed argument struct A via cborgen.