Documentation
¶
Overview ¶
Package request is the request primitive shared by the public call helper and the protocol engine's inbound bridge: one request sent through addressed access with a fresh return capability that carries its invocation lifecycle, and the wait for its one response.
Index ¶
Constants ¶
const DefaultTimeout = 30 * time.Second
DefaultTimeout is how long a call waits for its response when it states no deadline of its own.
Variables ¶
This section is empty.
Functions ¶
func Await ¶
func Await(ctx context.Context, reply <-chan Result, done <-chan struct{}, ended func() error, result any) (bool, error)
Await is the request primitive shared by carriers and addressed access: it waits for the response, the context's end or the carrier's end. The first result says whether the caller withdrew, so a cancellation is owed.
func Call ¶
func Call(ctx context.Context, access wire.AddressedWire, path []string, params, result any, dispatch *delivery.Context, options Options) error
Call sends one request at path through access and waits for its response. dispatch is the context a carrier established when this call forwards a request it admitted; it is nil for an application's own call.
Types ¶
type Options ¶
type Options struct {
Propagator core.Propagator
Timeout time.Duration
}
Options configures one call. A zero Timeout uses DefaultTimeout; a nil Propagator uses core.DefaultPropagator.
type Reply ¶
type Reply struct {
// contains filtered or unexported fields
}
Reply is the return capability of one call. Its empty path takes the response; every other path is its invocation's lifecycle vocabulary.
func Own ¶ added in v0.4.1
Own is the return capability of an application's own call, if message carries one: a Reply that no carrier established. A peer whose deadline for such a call passes fails it locally with Expire; any other return may cross a wire and is answered.
func (*Reply) BitruntimeDelivery ¶
func (w *Reply) BitruntimeDelivery() *delivery.Context
BitruntimeDelivery is the context the carrier established, if any.
func (*Reply) Expire ¶ added in v0.4.1
Expire settles the call with err and no response. bitwire/1 fails a call locally when its caller's deadline passes: that error is the caller's own and never a frame.
func (*Reply) Invocation ¶
func (w *Reply) Invocation() *core.Invocation
Invocation exposes this return capability's lifecycle to its owner.
type Result ¶
type Result struct {
Value json.RawMessage
Err error
}
Result is one response as a waiter receives it.