consumer

package
v0.0.0-...-4e1f4d9 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxStreamBufferSize uint32 = 4096

MaxStreamBufferSize represents the maximum number of elements a stream can have buffered before a consumer consumes it.

Functions

This section is empty.

Types

type Consumer

type Consumer interface {
	// InitStream initializes a resource stream for the consumer.
	InitStream(resourceUrl string) error

	// NotifyStream lazily notifies the relevant stream, if it exists, about
	// a change in a particular resource.
	NotifyStream(obj *rd.StreamResponse) error

	// WatchStream publishes changes to resources that are being watched.
	WatchStream(resourceUrl string) (<-chan WatchResponse, error)

	// CloseStream closes a resource stream for the consumer.
	CloseStream(resourceUrl string) error
}

Consumer represents an instance of a federated service mesh consumer.

type Registry

type Registry interface {
	// Register creates a new entry for the given consumer identified by id.
	Register(id string) (Consumer, error)

	// Deregister deregisters the consumer identified by id.
	Deregister(id string) error

	// GetAll returns all the registered consumer instances.
	GetAll() []Consumer
}

Registry maintains an active set of consumers and provides a mechanism to interact with them.

func NewRegistry

func NewRegistry(stateProvider state.StateProvider) Registry

NewRegistry returns a new instance of the registry.

type WatchResponse

type WatchResponse struct {
	// Object is the information about the change in a resource that's being
	// watched.
	Object *rd.StreamResponse

	// Closed tells if the stream being watched was closed.
	Closed bool

	// Error tells of any errors while processing the stream.
	Error error
}

WatchResponse holds the information about a resource change event to be notified to the watcher.

Jump to

Keyboard shortcuts

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