appdata

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllSet

type AllSet func(values extcommon.Values) bool

AllSet returns true if all of the values have been set

type Handler

type Handler func(channelID string, request *gproto.AppDataRequest, responder Responder)

Handler handles an application data request

type HandlerRegistry

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

HandlerRegistry manages handlers for application-specific Gossip messages

func NewHandlerRegistry

func NewHandlerRegistry() *HandlerRegistry

NewHandlerRegistry returns a new HandlerRegistry

func (*HandlerRegistry) HandlerForType

func (p *HandlerRegistry) HandlerForType(dataType string) (Handler, bool)

HandlerForType returns the handler for the given data type

func (*HandlerRegistry) Register

func (p *HandlerRegistry) Register(dataType string, handler Handler) error

Register registers a handler for the given data type. Only one handler may be registered per data type, otherwise an error results

type Option added in v0.1.5

type Option func(options *options)

Option is a retriever option

func WithPeerFilter added in v0.1.5

func WithPeerFilter(filter PeerFilter) Option

WithPeerFilter sets a peer filter

type PeerFilter added in v0.1.5

type PeerFilter = func(*extdiscovery.Member) bool

PeerFilter returns true to include the peer in the Gossip request

type Request

type Request struct {
	DataType string
	Payload  []byte
}

Request contains an application data request

func NewRequest

func NewRequest(dataType string, payload []byte) *Request

NewRequest returns a new application data request

type Responder added in v0.1.6

type Responder interface {
	Respond(data []byte)
}

Responder responds to data requests

type ResponseHandler

type ResponseHandler func(response []byte) (extcommon.Values, error)

ResponseHandler handles the response to retrieved data

type Retriever

type Retriever struct {
	*extdiscovery.Discovery
	// contains filtered or unexported fields
}

Retriever retrieves data from one or more peers on a channel

func NewRetriever

func NewRetriever(channelID string, gossip gossipService, gossipMaxAttempts, gossipMaxPeers int) *Retriever

NewRetriever returns a new application data retriever

func (*Retriever) Retrieve

func (r *Retriever) Retrieve(ctxt context.Context, request *Request, responseHandler ResponseHandler, allSet AllSet, opts ...Option) (extcommon.Values, error)

Retrieve retrieves application data from one or more peers

Jump to

Keyboard shortcuts

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