distributor

package
v0.0.0-...-cd242ba Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDistributorCommand

func NewDistributorCommand(ctx context.Context) *cobra.Command

func PreRun

func PreRun(cmd *cobra.Command, args []string)

Types

type CallBackFunc

type CallBackFunc func(obj interface{}) int

CallBackFunc will be called after processing an object

type DefaultLoadBalancer

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

func (*DefaultLoadBalancer) Handle

func (lb *DefaultLoadBalancer) Handle(obj interface{}) int

func (*DefaultLoadBalancer) Run

func (lb *DefaultLoadBalancer) Run(ctx context.Context)

func (*DefaultLoadBalancer) SetCallBack

func (lb *DefaultLoadBalancer) SetCallBack(cb CallBackFunc)

func (*DefaultLoadBalancer) Workers

func (lb *DefaultLoadBalancer) Workers() []*Worker

type LoadBalancer

type LoadBalancer interface {
	// Start load balancer
	Run(ctx context.Context)
	// Do the load balancing and distribute packets to workers
	Handle(obj interface{}) int
	// Return workers
	Workers() []*Worker
	// Set callback function for worker to do post processing
	SetCallBack(cb CallBackFunc)
}

func NewDefaultLoadBalancer

func NewDefaultLoadBalancer(numWorkers int) (LoadBalancer, error)

type RX

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

func NewRX

func NewRX(ctx context.Context, handle *cne.System, lb LoadBalancer) *RX

func (*RX) Start

func (rx *RX) Start()

func (*RX) Stop

func (rx *RX) Stop()

type TX

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

func NewTX

func NewTX(ctx context.Context, handle *cne.System, lb LoadBalancer) (*TX, error)

func (*TX) Aggregate

func (tx *TX) Aggregate(obj interface{}) int

func (*TX) Start

func (tx *TX) Start()

func (*TX) Stop

func (tx *TX) Stop()

type Worker

type Worker struct {
	Name string

	Count int
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(name string) (*Worker, error)

func (*Worker) Distribute

func (w *Worker) Distribute(obj interface{}) int

func (*Worker) Run

func (w *Worker) Run(ctx context.Context)

func (*Worker) SetCallBack

func (w *Worker) SetCallBack(cb CallBackFunc)

Jump to

Keyboard shortcuts

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