bvprocessor

package
v1.1.1-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBusy = errors.New("failed to acquire events semaphore")
)

Functions

This section is empty.

Types

type Callback

type Callback struct {
	Item ItemCallback
}

type Config

type Config struct {
	BufferLimit dag.Metric

	SemaphoreTimeout time.Duration

	MaxTasks int
}

func DefaultConfig

func DefaultConfig(scale cachescale.Func) Config

type ItemCallback

type ItemCallback struct {
	Process  func(bvs inter.LlrSignedBlockVotes) error
	Released func(bvs inter.LlrSignedBlockVotes, peer string, err error)
	Check    func(bvs inter.LlrSignedBlockVotes, checked func(error))
}

type Processor

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

Processor is responsible for processing incoming events

func New

func New(itemsSemaphore *datasemaphore.DataSemaphore, cfg Config, callback Callback) *Processor

New creates an event processor

func (*Processor) Enqueue

func (f *Processor) Enqueue(peer string, items []inter.LlrSignedBlockVotes, done func()) error

func (*Processor) Overloaded

func (f *Processor) Overloaded() bool

Overloaded returns true if too much items are being processed

func (*Processor) Start

func (f *Processor) Start()

Start boots up the items processor.

func (*Processor) Stop

func (f *Processor) Stop()

Stop interrupts the processor, canceling all the pending operations. Stop waits until all the internal goroutines have finished.

func (*Processor) TasksCount

func (f *Processor) TasksCount() int

Jump to

Keyboard shortcuts

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