broker

package
v0.0.0-...-01af507 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package broker implements the broker logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockingChannel

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

BlockingChannel implements the Queue interface using a channel.

func NewBlockingChannel

func NewBlockingChannel(bufferLen int) *BlockingChannel

NewBlockingChannel returns a BlockingChannel.

func (*BlockingChannel) Pop

Pop an event from the queue.

func (*BlockingChannel) Push

func (bc *BlockingChannel) Push(evt events.Interface)

Push pushes an event to the queue.

type Broker

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

Broker receives events from the collectors and sends them to the subscribers.

func New

func New(logger logr.Logger, queue Queue, collectors map[string]subscriber.SubsChan, opt ...Option) (*Broker, error)

New returns a new Broker.

func (*Broker) Start

func (br *Broker) Start(ctx context.Context) error

Start starts the grpc server and sends to subscribers the events received from the collectors.

type Option

type Option func(opt *options)

Option function used to set options when creating a new Broker instance.

func WithAddress

func WithAddress(addr string) Option

WithAddress configures the binding address of the grpc server to the given value.

func WithTLS

func WithTLS(certFilePath, keyFilePath string) Option

WithTLS configures the grpc server started by the broker to use TLS.

type Queue

type Queue interface {
	Push(evt events.Interface)
	Pop(ctx context.Context) events.Interface
}

Queue used to dispatch events from the collectors to the broker.

Jump to

Keyboard shortcuts

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