diodes

package
v0.0.0-...-1fc00ed Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ManyToOne

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

ManyToOne diode is optimal for many writers and a single reader for slices of bytes.

func NewManyToOne

func NewManyToOne(size int, alerter gendiodes.Alerter) *ManyToOne

NewManyToOne initializes a new many to one diode of a given size and alerter. The alerter is called whenever data is dropped with an integer representing the number of byte slices that were dropped.

func (*ManyToOne) Next

func (d *ManyToOne) Next() []byte

Next will return the next item to be read from the diode. If the diode is empty this method will block until an item is available to be read.

func (*ManyToOne) Set

func (d *ManyToOne) Set(data []byte)

Set inserts the given data into the diode.

func (*ManyToOne) TryNext

func (d *ManyToOne) TryNext() ([]byte, bool)

TryNext returns the next item to be read from the diode. If the diode is empty it will return a nil slice of bytes and false for the bool.

type ManyToOneEnvelope

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

ManyToOneEnvelope diode is optimal for many writers and a single reader for V1 envelopes.

func NewManyToOneEnvelope

func NewManyToOneEnvelope(size int, alerter gendiodes.Alerter) *ManyToOneEnvelope

NewManyToOneEnvelope returns a new ManyToOneEnvelope diode to be used with many writers and a single reader.

func (*ManyToOneEnvelope) Next

func (d *ManyToOneEnvelope) Next() *events.Envelope

Next will return the next V1 envelope to be read from the diode. If the diode is empty this method will block until anenvelope is available to be read.

func (*ManyToOneEnvelope) Set

func (d *ManyToOneEnvelope) Set(data *events.Envelope)

Set inserts the given V1 envelope into the diode.

func (*ManyToOneEnvelope) TryNext

func (d *ManyToOneEnvelope) TryNext() (*events.Envelope, bool)

TryNext returns the next V1 envelope to be read from the diode. If the diode is empty it will return a nil envelope and false for the bool.

type ManyToOneEnvelopeV2

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

ManyToOneEnvelopeV2 diode is optimal for many writers and a single reader for V2 envelopes.

func NewManyToOneEnvelopeV2

func NewManyToOneEnvelopeV2(size int, alerter gendiodes.Alerter) *ManyToOneEnvelopeV2

NewManyToOneEnvelopeV2 returns a new ManyToOneEnvelopeV2 diode to be used with many writers and a single reader.

func (*ManyToOneEnvelopeV2) Next

Next will return the next V2 envelope to be read from the diode. If the diode is empty this method will block until anenvelope is available to be read.

func (*ManyToOneEnvelopeV2) Set

Set inserts the given V2 envelope into the diode.

func (*ManyToOneEnvelopeV2) TryNext

TryNext returns the next V2 envelope to be read from the diode. If the diode is empty it will return a nil envelope and false for the bool.

type OneToOne

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

OneToOne diode is optimized for a single writer and a single reader for byte slices.

func NewOneToOne

func NewOneToOne(size int, alerter gendiodes.Alerter) *OneToOne

NewOneToOne initializes a new one to one diode of a given size and alerter. The alerter is called whenever data is dropped with an integer representing the number of byte slices that were dropped.

func (*OneToOne) Next

func (d *OneToOne) Next() []byte

Next will return the next item to be read from the diode. If the diode is empty this method will block until an item is available to be read.

func (*OneToOne) Set

func (d *OneToOne) Set(data []byte)

Set inserts the given data into the diode.

func (*OneToOne) TryNext

func (d *OneToOne) TryNext() ([]byte, bool)

TryNext returns the next item to be read from the diode. If the diode is empty it will return a nil slice of bytes and false for the bool.

type OneToOneEnvelopeV2

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

OneToOneEnvelopeV2 diode is optimized for a single writer and a single reader

func NewOneToOneWaiterEnvelopeV2

func NewOneToOneWaiterEnvelopeV2(size int, alerter gendiodes.Alerter, opts ...gendiodes.WaiterConfigOption) *OneToOneEnvelopeV2

NewOneToOneWaiterEnvelopeV2 initializes a new one to one diode for V2 envelopes of a given size and alerter. The alerter is called whenever data is dropped with an integer representing the number of V2 envelopes that were dropped.

func (*OneToOneEnvelopeV2) Next

Next will return the next V2 envelope to be read from the diode. If the diode is empty this method will block until anenvelope is available to be read.

func (*OneToOneEnvelopeV2) Set

Set inserts the given V2 envelope into the diode.

func (*OneToOneEnvelopeV2) TryNext

TryNext returns the next V2 envelope to be read from the diode. If the diode is empty it will return a nil envelope and false for the bool.

Jump to

Keyboard shortcuts

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