concurrency

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SequencerContainer

type SequencerContainer struct {
	InChan chan *jsonblock.JsonBlockEssential
	// contains filtered or unexported fields
}

func NewSequencerContainer

func NewSequencerContainer(firstOut int64, bloatedCount int, outChan *chan *jsonblock.JsonBlockEssential) *SequencerContainer

NewSequencerContainer creates a SequenceContainer Objects are sent in to SequenceContainer.InChan in a pseudo-sequence. Objects come out of outChan in strict sequence order. The intention is to place this in a pipeline after a thread pool which may have disrupted the original sequence. To compensate for bloating, at a point upstream where things ARE still in sequence, you should call SequencerContainer.WaitForNotBloated() before sending objects to your thread pool.

func (*SequencerContainer) WaitForNotBloated

func (sc *SequencerContainer) WaitForNotBloated()

type SequencerContainerHashes

type SequencerContainerHashes struct {
	InChan chan *jsonblock.JsonBlockHashes
	// contains filtered or unexported fields
}

func NewSequencerContainerHashes

func NewSequencerContainerHashes(firstOut int64, bloatedCount int, outChan *chan *jsonblock.JsonBlockHashes) *SequencerContainerHashes

NewSequencerContainer creates a SequenceContainer Objects are sent in to SequenceContainer.InChan in a pseudo-sequence. Objects come out of outChan in strict sequence order. The intention is to place this in a pipeline after a thread pool which may have disrupted the original sequence. To compensate for bloating, at a point upstream where things ARE still in sequence, you should call SequencerContainer.WaitForNotBloated() before sending objects to your thread pool.

func (*SequencerContainerHashes) WaitForNotBloated

func (sc *SequencerContainerHashes) WaitForNotBloated()

type Task

type Task interface {
	Process() error // For the worker to call
	SetError(error) // For the worker to call with return value of Process()
	Done()
	GetError() error // For the client to call later
}

type WorkerPool

type WorkerPool struct {
	InChan chan Task
}

func NewWorkerPool

func NewWorkerPool(concurrency int) *WorkerPool

Jump to

Keyboard shortcuts

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