eventbridge

package
v0.0.0-...-6b2d232 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attach

func Attach(ctx context.Context, source Getter, sink events.Forwarder) <-chan error

Attach takes an existing Getter and forwards each event retrieved from it to the provided forwarder. For example, if the source is a client for a remote exchange and sink is a local exchange, Attach will result in each event published on the remote exchange to be forwarded to the local exchange, essentially bridging the two together.

func RegisterGetterService

func RegisterGetterService(srv *ttrpc.Server, svc Getter)

RegisterGetterService adds the Getter service as a method to the provided TTRPC server.

func Republish

func Republish(ctx context.Context, source events.Subscriber, sink events.Publisher) <-chan error

Republish subscribes to the provided source and publishes each received event on the provided sink. Note that the timestamp and namespace of the event will be set via the caller's context due to the use of Publish, as opposed to Forward.

Types

type Getter

type Getter interface {
	// GetEvent retrieves a single event from the source provided by the implementation. If no event is available at the
	// time of the call, GetEvent is expected to block until an event is available, an error occurs or the context is
	// canceled.
	GetEvent(ctx context.Context) (*eventapi.Envelope, error)
}

The Getter interface provides an API for retrieving containerd events from a remote event source, such as an exchange. It exists separately from containerd's existing EventClient and EventServer interfaces in order to support retrieving events via long-polling as opposed to a streaming model. This allows us to use TTRPC for the implementation, which currently does not support streaming.

func NewGetterClient

func NewGetterClient(rpcClient *ttrpc.Client) Getter

NewGetterClient returns a client-side implementation of the Getter interface using the provided TTRPC client to connect to the server.

func NewGetterService

func NewGetterService(ctx context.Context, eventSource events.Subscriber) Getter

NewGetterService returns a server-side implementation of the Getter interface. Given an existing event source, it will subscribe to that source with no filters. Each GetEvent call pops and returns an event buffered in the subscription's channel of published events. If no event is buffered, it blocks until one is.

Jump to

Keyboard shortcuts

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