ops

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: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QUEUE_SIZE = 10000
)

Variables

This section is empty.

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
}

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