channel

package
v0.0.0-...-780ac92 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

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

Channel represents a communication path or data flow.

func NewChannel

func NewChannel(ctx context.Context, conf *config.JSON) *Channel

NewChannel creates a new instance of a Channel.

func (*Channel) Close

func (c *Channel) Close()

Close terminates or shuts down the Channel.

func (*Channel) IsEmpty

func (c *Channel) IsEmpty() bool

IsEmpty checks whether the Channel is empty, i.e., it has no records.

func (*Channel) Pop

func (c *Channel) Pop() (r element.Record, ok bool)

Pop removes and returns a record from the Channel. If no records are present, it returns false.

func (*Channel) PopAll

func (c *Channel) PopAll(onRecord func(element.Record) error) error

PopAll removes and returns multiple records from the Channel using the onRecord function.

func (*Channel) Push

func (c *Channel) Push(r element.Record) (n int, err error)

Push adds a record, r, to the Channel.

func (*Channel) PushAll

func (c *Channel) PushAll(fetchRecord func() (element.Record, error)) error

PushAll adds multiple records to the Channel using the fetchRecord function.

func (*Channel) PushTerminate

func (c *Channel) PushTerminate() (n int)

PushTerminate adds a termination record to the Channel.

func (*Channel) Size

func (c *Channel) Size() int

Size indicates the number of records present in the Channel.

func (*Channel) StatsJSON

func (c *Channel) StatsJSON() StatsJSON

StatsJSON returns the statistical information of the Channel in JSON format.

type Stats

type Stats struct {
	sync.RWMutex
	StatsJSON
}

Stats provides statistical information about the Channel.

type StatsJSON

type StatsJSON struct {
	TotalByte   int64 `json:"totalByte"`
	TotalRecord int64 `json:"totalRecord"`
	Byte        int64 `json:"byte"`
	Record      int64 `json:"record"`
}

StatsJSON represents the statistical information of the Channel in JSON format.

Jump to

Keyboard shortcuts

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