sm

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Created int32 = iota
	Running
	ReceiverStopped
	PrepareStop
	Stopped
)

Variables

View Source
var (
	ErrClose = moerr.NewInternalErrorNoCtx("closed")
)

Functions

func NewSafeQueue

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

func NewStateMachine

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

Types

type Closable added in v0.8.0

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

type ClosedState added in v0.8.0

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

func (*ClosedState) IsClosed added in v0.8.0

func (c *ClosedState) IsClosed() bool

func (*ClosedState) TryClose added in v0.8.0

func (c *ClosedState) TryClose() bool

type EnqueueOp

type EnqueueOp = func(any) any

type Loop added in v0.6.0

type Loop struct {
	Itemcount int
	Itemtimes int
	// contains filtered or unexported fields
}

func NewLoop added in v0.6.0

func NewLoop(queue, nextQueue chan any, fn func([]any, chan any), maxBatchSize int) *Loop

func (*Loop) Start added in v0.6.0

func (l *Loop) Start()

func (*Loop) Stop added in v0.6.0

func (l *Loop) Stop()

type OnFinCB

type OnFinCB = func()

type OnItemsCB

type OnItemsCB = func(...any)

type Queue

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

type StateMachine

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

Jump to

Keyboard shortcuts

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