responsebroker

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestResponseBroker

func TestResponseBroker(t *testing.T)

Types

type ResponseBroker

type ResponseBroker struct {
	// contains filtered or unexported fields
}

ResponseBroker propagates a response to an arbitrary number of requests

func New

func New() *ResponseBroker

func (*ResponseBroker) Acquire

func (rb *ResponseBroker) Acquire(identifier string) (handle ResponseHandle, isOwner bool)

func (*ResponseBroker) Done

func (rb *ResponseBroker) Done(identifier string)

Done marks this request identified by `identifier` as finished and waits till anyone who's interested in its response has read it. Should be called after a successful request. Invalidates all ResponseHandles.

type ResponseHandle

type ResponseHandle struct {
	// contains filtered or unexported fields
}

ResponseHandle for a request

func (*ResponseHandle) Read

func (h *ResponseHandle) Read() (interface{}, error)

Read reads the response

func (*ResponseHandle) Release

func (h *ResponseHandle) Release()

Release releases the handle.

func (*ResponseHandle) Write

func (h *ResponseHandle) Write(data interface{}, err error)

Write writes a response, letting others read it

Jump to

Keyboard shortcuts

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