bindexec

package
v0.0.0-...-8bebe15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: Apache-2.0, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
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.

func NewMalformedArgumentsError

func NewMalformedArgumentsError(cause error) error

Types

type Arguments

type Arguments interface {
	cbg.CBORUnmarshaler
}

type HandlerFunc

type HandlerFunc[A Arguments, O Success] = func(*Request[A], *Response[O]) error

type Request

type Request[A Arguments] struct {
	execution.Request
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest[A Arguments](ctx context.Context, inv ucan.Invocation, options ...RequestOption) (*Request[A], error)

func (*Request[A]) Task

func (r *Request[A]) Task() *Task[A]

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

func NewResponse[O Success](task cid.Cid, options ...ResponseOption[O]) (*Response[O], error)

NewResponse creates a new response object, representing the result of executing a task.

func (*Response[O]) Metadata

func (r *Response[O]) Metadata() ucan.Container

func (*Response[O]) Receipt

func (r *Response[O]) Receipt() ucan.Receipt

func (*Response[O]) SetFailure

func (r *Response[O]) SetFailure(x error) error

func (*Response[O]) SetMetadata

func (r *Response[O]) SetMetadata(meta ucan.Container) error

func (*Response[O]) SetReceipt

func (r *Response[O]) SetReceipt(receipt ucan.Receipt) error

func (*Response[O]) SetSuccess

func (r *Response[O]) SetSuccess(o O) error

type ResponseOption

type ResponseOption[O Success] func(r *Response[O]) error

func WithFailure

func WithFailure[O Success](signer ucan.Signer, task cid.Cid, x error) ResponseOption[O]

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 SignerSetter interface {
	SetSigner(ucan.Signer) error
}

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.

func (*Task[A]) Arguments

func (t *Task[A]) Arguments() A

Arguments returns the arguments bound to the type for this task.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL