Documentation
¶
Index ¶
- Constants
- func NewHandlerExecutionError(cmd ucan.Command, cause error) error
- func NewInvalidAudienceError(expected did.DID, actual did.DID) error
- type ExecRequest
- type ExecResponse
- func (r *ExecResponse) Metadata() ucan.Container
- func (r *ExecResponse) Receipt() ucan.Receipt
- func (r *ExecResponse) SetFailure(x error) error
- func (r *ExecResponse) SetMetadata(meta ucan.Container) error
- func (r *ExecResponse) SetReceipt(receipt ucan.Receipt) error
- func (r *ExecResponse) SetSigner(signer ucan.Signer) error
- func (r *ExecResponse) SetSuccess(ok cbg.CBORMarshaler) error
- type Executor
- type HandlerFunc
- type Request
- type RequestOption
- type Response
- type ResponseOption
- func WithFailure(x error) ResponseOption
- func WithMetadata(m ucan.Container) ResponseOption
- func WithReceipt(receipt ucan.Receipt) ResponseOption
- func WithReceiptTimestamp(enabled bool) ResponseOption
- func WithSigner(signer ucan.Signer) ResponseOption
- func WithSuccess(o cbg.CBORMarshaler) ResponseOption
Constants ¶
const HandlerExecutionErrorName = "HandlerExecutionError"
const InvalidAudienceErrorName = "InvalidAudience"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExecRequest ¶
type ExecRequest struct {
// contains filtered or unexported fields
}
func NewRequest ¶
func NewRequest(ctx context.Context, inv ucan.Invocation, options ...RequestOption) *ExecRequest
func (*ExecRequest) Context ¶
func (r *ExecRequest) Context() context.Context
func (*ExecRequest) Invocation ¶
func (r *ExecRequest) Invocation() ucan.Invocation
func (*ExecRequest) Metadata ¶
func (r *ExecRequest) Metadata() ucan.Container
type ExecResponse ¶
type ExecResponse struct {
// contains filtered or unexported fields
}
func NewResponse ¶
func NewResponse(task cid.Cid, options ...ResponseOption) (*ExecResponse, error)
NewResponse creates a new response object, representing the result of executing a task.
func (*ExecResponse) Metadata ¶
func (r *ExecResponse) Metadata() ucan.Container
func (*ExecResponse) Receipt ¶
func (r *ExecResponse) Receipt() ucan.Receipt
func (*ExecResponse) SetFailure ¶
func (r *ExecResponse) SetFailure(x error) error
func (*ExecResponse) SetMetadata ¶
func (r *ExecResponse) SetMetadata(meta ucan.Container) error
func (*ExecResponse) SetReceipt ¶
func (r *ExecResponse) SetReceipt(receipt ucan.Receipt) error
func (*ExecResponse) SetSuccess ¶
func (r *ExecResponse) SetSuccess(ok cbg.CBORMarshaler) error
type Executor ¶
Executor executes UCAN invocations. In order to execute an invocation, proof chains must be validated and delegation policies matched. Hence a UCAN executor is responsible for both validation and execution of invocations.
type HandlerFunc ¶
HandlerFunc is a function that can handle a specific UCAN invocation.
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 interface {
// Receipt for the executed task.
Receipt() ucan.Receipt
// SetReceipt sets the receipt for the executed task.
SetReceipt(ucan.Receipt) error
// SetSuccess issues a receipt with a successful result for the executed
// task and sets it on the response. The ok value is any
// cborgen-marshalable type whose schema matches what the task expects to
// produce.
SetSuccess(ok cbg.CBORMarshaler) error
// SetFailure issues a receipt with a failure result for the executed task
// and sets it on the response.
SetFailure(error) error
// Metadata provides additional information about the response.
Metadata() ucan.Container
// SetMetadata sets additional information about the response.
SetMetadata(ucan.Container) error
}
type ResponseOption ¶
type ResponseOption func(r *ExecResponse) error
func WithFailure ¶
func WithFailure(x error) ResponseOption
WithFailure issues and sets a receipt for a failed execution of a task.
func WithMetadata ¶
func WithMetadata(m ucan.Container) ResponseOption
func WithReceipt ¶
func WithReceipt(receipt ucan.Receipt) ResponseOption
func WithReceiptTimestamp ¶
func WithReceiptTimestamp(enabled bool) ResponseOption
WithReceiptTimestamp configures the response to issue receipts with issuance timestamps. Note: this option should be ordered before WithSuccess or WithFailure, since these options issue a receipt.
func WithSigner ¶
func WithSigner(signer ucan.Signer) ResponseOption
func WithSuccess ¶
func WithSuccess(o cbg.CBORMarshaler) ResponseOption
WithSuccess issues and sets a receipt for a successful execution of a task.