Documentation ¶
Index ¶
- Variables
- type Callback
- type Config
- type EventCallback
- type Processor
- func (f *Processor) Clear()
- func (f *Processor) Enqueue(peer string, events dag.Events, ordered bool, ...) error
- func (f *Processor) IsBuffered(id hash.Event) bool
- func (f *Processor) Overloaded() bool
- func (f *Processor) Start()
- func (f *Processor) Stop()
- func (f *Processor) TasksCount() int
- func (f *Processor) TotalBuffered() dag.Metric
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrBusy = errors.New("failed to acquire events semaphore")
)
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { EventsBufferLimit dag.Metric EventsSemaphoreTimeout time.Duration MaxUnorderedInsertions int }
func DefaultConfig ¶
func DefaultConfig(scale cachescale.Func) Config
type EventCallback ¶
type EventCallback struct { Process func(e dag.Event) error Released func(e dag.Event, peer string, err error) Get func(hash.Event) dag.Event Exists func(hash.Event) bool OnlyInterested func(ids hash.Events) hash.Events CheckParents func(e dag.Event, parents dag.Events) error CheckParentless func(tasks []queuedcheck.EventTask, checked func(res []queuedcheck.EventTask)) }
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
Processor is responsible for processing incoming events
func New ¶
func New(eventsSemaphore *datasemaphore.DataSemaphore, cfg Config, callback Callback) *Processor
New creates an event processor
func (*Processor) Overloaded ¶
Overloaded returns true if too much events are being processed or requested
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 (*Processor) TotalBuffered ¶
Click to show internal directories.
Click to hide internal directories.