ops

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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