collector

package
v0.0.0-...-a26ebea Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrProducerMustBeSet = validation.NewError(
	"collector_producer_must_be_set",
	"the collector producer must be set and cannot be nil",
)

ErrProducerMustBeSet is the validation check error returned when the collector producer isn't set.

View Source
var States = []State{
	Opened,
	Closed,
}

States is list of all valid collector states.

View Source
var Transitions = map[State]map[State]bool{
	Opened: {Closed: true},
	Closed: {Opened: true},
}

Transitions contains valid transitions between states of a collector.

Functions

This section is empty.

Types

type Collector

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

Collector provides metrics and offset tracking while fronting a kafka producer.

func Generate

func Generate(rand *rand.Rand) *Collector

Generate a random collector value.

func New

func New(producer *producer.Producer) (*Collector, validation.ErrorGroup)

New creates and validates a new Collector.

func (*Collector) Check

func (c *Collector) Check() validation.ErrorGroup

Check runs default validation checks for the collector.

func (*Collector) Close

func (c *Collector) Close() error

Close the collector if it is open.

func (*Collector) Flush

func (c *Collector) Flush() error

Flush buffered messages in the collector.

func (*Collector) Generate

func (*Collector) Generate(rand *rand.Rand, size int) reflect.Value

Generate random collector values.

Interface: quick.Generator

func (*Collector) Open

func (c *Collector) Open() error

Open collector to begin sending messages.

func (*Collector) Send

func (c *Collector) Send(ctx context.Context, rec record.Record, keyCodec, valCodec codec.Codec) error

Send record to Kafka.

TODO (ahawker) Properly implement.

func (*Collector) String

func (c *Collector) String() string

String value of the collector.

Interface: fmt.Stringer.

type State

type State string

State represents the valid states of a collector.

Interface: state.State

const (
	Opened  State = "opened"
	Closed  State = "closed"
	Initial       = Closed
)

Jump to

Keyboard shortcuts

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