Documentation ¶
Overview ¶
Package fulfiller provides a type that implements capnp.Answer that resolves by calling setter methods.
Index ¶
- type EmbargoClient
- type Fulfiller
- func (f *Fulfiller) Done() <-chan struct{}
- func (f *Fulfiller) Fulfill(s capnp.Struct)
- func (f *Fulfiller) Peek() capnp.Answer
- func (f *Fulfiller) PipelineCall(transform []capnp.PipelineOp, call *capnp.Call) capnp.Answer
- func (f *Fulfiller) PipelineClose(transform []capnp.PipelineOp) error
- func (f *Fulfiller) Reject(err error)
- func (f *Fulfiller) Struct() (capnp.Struct, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmbargoClient ¶
type EmbargoClient struct {
// contains filtered or unexported fields
}
EmbargoClient is a client that flushes a queue of calls. Fulfiller will create these automatically when pipelined calls are made on unresolved answers. EmbargoClient is exported so that rpc can avoid making calls on its own Conn.
func (*EmbargoClient) Call ¶
func (ec *EmbargoClient) Call(cl *capnp.Call) capnp.Answer
Call either queues a call to the underlying client or starts a call if the embargo has been lifted.
func (*EmbargoClient) Client ¶
func (ec *EmbargoClient) Client() capnp.Client
Client returns the underlying client if the embargo has been lifted and nil otherwise.
func (*EmbargoClient) Close ¶
func (ec *EmbargoClient) Close() error
Close closes the underlying client, rejecting any queued calls.
func (*EmbargoClient) TryQueue ¶
func (ec *EmbargoClient) TryQueue(cl *capnp.Call) capnp.Answer
TryQueue will attempt to queue a call or return nil if the embargo has been lifted.
type Fulfiller ¶
type Fulfiller struct {
// contains filtered or unexported fields
}
Fulfiller is a promise for a Struct. The zero value is an unresolved answer. A Fulfiller is considered to be resolved once Fulfill or Reject is called. Calls to the Fulfiller will queue up until it is resolved. A Fulfiller is safe to use from multiple goroutines.
func (*Fulfiller) Done ¶
func (f *Fulfiller) Done() <-chan struct{}
Done returns a channel that is closed once f is resolved.
func (*Fulfiller) Fulfill ¶
func (f *Fulfiller) Fulfill(s capnp.Struct)
Fulfill sets the fulfiller's answer to s. If there are queued pipeline calls, the capabilities on the struct will be embargoed until the queued calls finish. Fulfill will panic if the fulfiller has already been resolved.
func (*Fulfiller) Peek ¶
func (f *Fulfiller) Peek() capnp.Answer
Peek returns f's resolved answer or nil if f has not been resolved. The Struct method of an answer returned from Peek returns immediately.
func (*Fulfiller) PipelineCall ¶
func (f *Fulfiller) PipelineCall(transform []capnp.PipelineOp, call *capnp.Call) capnp.Answer
PipelineCall calls PipelineCall on the fulfilled answer or queues the call if f has not been fulfilled.
func (*Fulfiller) PipelineClose ¶
PipelineClose waits until f is resolved and then calls PipelineClose on the fulfilled answer.