ops

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 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 (
	QUEUE_SIZE = 10000
)

Variables

View Source
var ErrOpCancelled = errors.New("op cancelled")

Functions

func NewHeartBeater

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

Types

type Cmd

type Cmd = uint8
const (
	QUIT Cmd = iota
)

type OpExecFunc

type OpExecFunc func(op iops.IOp)

type OpWorker

type OpWorker struct {
	Name       string
	OpC        chan iops.IOp
	CmdC       chan Cmd
	State      State
	Pending    int64
	ClosedCh   chan struct{}
	Stats      Stats
	ExecFunc   OpExecFunc
	CancelFunc OpExecFunc
}

func NewOpWorker

func NewOpWorker(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 State

type State = int32
const (
	CREATED State = iota
	RUNNING
	STOPPING_RECEIVER
	STOPPING_CMD
	STOPPED
)

type Stats

type Stats struct {
	Processed uint64
	Successed uint64
	Failed    uint64
	AvgTime   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