fulfiller

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package fulfiller provides a type that implements capnp.Answer that resolves by calling setter methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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

func (f *Fulfiller) PipelineClose(transform []capnp.PipelineOp) error

PipelineClose waits until f is resolved and then calls PipelineClose on the fulfilled answer.

func (*Fulfiller) Reject

func (f *Fulfiller) Reject(err error)

Reject sets the fulfiller's answer to err. If there are queued pipeline calls, they will all return errors. Reject will panic if the error is nil or the fulfiller has already been resolved.

func (*Fulfiller) Struct

func (f *Fulfiller) Struct() (capnp.Struct, error)

Struct waits until f is resolved and returns its struct if fulfilled or an error if rejected.

Jump to

Keyboard shortcuts

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