ops

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CREATED int32 = iota
	RUNNING
	StoppingReceiver
	StoppingCMD
	STOPPED
)
View Source
const (
	QueueSize = 10000
)

Variables

This section is empty.

Functions

func NewHeartBeater

func NewHeartBeater(interval time.Duration, handle base.IHBHandle) *heartbeater

func NewHeartBeaterWithFunc added in v0.6.0

func NewHeartBeaterWithFunc(interval time.Duration, onExec, onStop func()) *heartbeater

Types

type Cmd

type Cmd = uint8
const (
	QUIT Cmd = iota
)

type OpExecFunc

type OpExecFunc func(op iops.IOp)

type OpWorker

type OpWorker struct {
	Ctx        context.Context
	Name       string
	OpC        chan iops.IOp
	CmdC       chan Cmd
	State      atomic.Int32
	Pending    atomic.Int64
	ClosedCh   chan struct{}
	Stats      Stats
	ExecFunc   OpExecFunc
	CancelFunc OpExecFunc
}

func NewOpWorker

func NewOpWorker(ctx context.Context, name string, args ...int) *OpWorker

func (*OpWorker) SendOp

func (w *OpWorker) SendOp(op iops.IOp) bool

func (*OpWorker) Start

func (w *OpWorker) Start()

func (*OpWorker) StatsString

func (w *OpWorker) StatsString() string

func (*OpWorker) Stop

func (w *OpWorker) Stop()

func (*OpWorker) StopReceiver

func (w *OpWorker) StopReceiver()

func (*OpWorker) WaitStop

func (w *OpWorker) WaitStop()

type Stats

type Stats struct {
	Processed atomic.Uint64
	Successed atomic.Uint64
	Failed    atomic.Uint64
	AvgTime   atomic.Int64
}

func (*Stats) AddFailed

func (s *Stats) AddFailed()

func (*Stats) AddProcessed

func (s *Stats) AddProcessed()

func (*Stats) AddSuccessed

func (s *Stats) AddSuccessed()

func (*Stats) RecordTime

func (s *Stats) RecordTime(t int64)

func (*Stats) String

func (s *Stats) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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