sm

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSafeQueue

func NewSafeQueue(queueSize, batchSize int, onItem OnItemsCB) *safeQueue

func NewStateMachine

func NewStateMachine(wg *sync.WaitGroup, closed Closable, rQueue, ckpQueue Queue) *stateMachine

func NewWaitableQueue

func NewWaitableQueue(queueSize, batchSize int, closed Closable, wg *sync.WaitGroup, enqueueOp EnqueueOp, onFin OnFinCB, onItem OnItemsCB) *waitableQueue

Types

type Closable

type Closable interface {
	IsClosed() bool
	TryClose() bool
}

type ClosedState

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

func (*ClosedState) IsClosed

func (s *ClosedState) IsClosed() bool

func (*ClosedState) TryClose

func (s *ClosedState) TryClose() bool

type EnqueueOp

type EnqueueOp = func(interface{}) interface{}

type OnFinCB

type OnFinCB = func()

type OnItemsCB

type OnItemsCB = func(...interface{})

type Queue

type Queue interface {
	Start()
	Stop()
	Enqueue(interface{}) (interface{}, error)
}

type State

type State = int32
const (
	Created State = iota
	Running
	ReceiverStopped
	PrepareStop
	Stopped
)

type StateMachine

type StateMachine interface {
	Start()
	Stop()
	EnqueueRecevied(interface{}) (interface{}, error)
	EnqueueCheckpoint(interface{}) (interface{}, error)
}

Jump to

Keyboard shortcuts

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