internal

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildStage

func BuildStage(ctx context.Context,
	cli *mongo.Client,
	roc <-chan RawMongoOp,
	wg *sync.WaitGroup) (<-chan ExecFunc, <-chan error)

func CollectStat

func CollectStat(opInfoCh <-chan OpInfo) models.LoadStat

func ExecStage

func ExecStage(ctx context.Context, fc <-chan ExecFunc, workers, resSize int, wg *sync.WaitGroup) <-chan OpInfo

func GenerateAmmo

func GenerateAmmo(r io.Reader, w io.Writer) error

func NewMongoClient

func NewMongoClient(ctx context.Context, uri string) (*mongo.Client, error)

func PrintStat

func PrintStat(stat models.LoadStat, writer io.Writer) error

func RandSeq

func RandSeq(n int) string

func ReadRawStage

func ReadRawStage(ctx context.Context,
	r io.Reader,
	size int,
	wg *sync.WaitGroup) (<-chan RawMongoOp, <-chan error, error)

Types

type AbortOp

type AbortOp struct {
	ID int `json:"id"`
}

func NewAbortOp

func NewAbortOp(cd RawMongoOp) (*AbortOp, error)

type CommandOp

type CommandOp struct {
	DB string `json:"db"`
	ID int    `json:"id"`
	// contains filtered or unexported fields
}

func NewCommandOp

func NewCommandOp(rawOp RawMongoOp) (*CommandOp, error)

type ExecFunc

type ExecFunc func(ctx context.Context) OpInfo

func NewAbortExec

func NewAbortExec(_ *mongo.Client, op *AbortOp) ExecFunc

func NewExecFunc

func NewExecFunc(client *mongo.Client, opdata RawMongoOp) (ExecFunc, error)

func NewOpExec

func NewOpExec(client *mongo.Client, op *CommandOp) ExecFunc

func NewSleepExec

func NewSleepExec(client *mongo.Client, op *SleepOp) ExecFunc

func NewTxnExec

func NewTxnExec(client *mongo.Client, op *TxnOp) ExecFunc

type OpInfo

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

func NewOpInfo

func NewOpInfo(opName string, id int, timeStart time.Time, timeEnd time.Time, err error) OpInfo

type RawMongoOp

type RawMongoOp struct {
	OP  string          `json:"op,omitempty"`
	DB  string          `json:"db,omitempty"`
	ID  int             `json:"id,omitempty"`
	Cmd json.RawMessage `json:"dc,omitempty"`
}

type SleepOp

type SleepOp struct {
	DB       string  `json:"db"`
	Coll     string  `json:"cl"`
	ID       int     `json:"id"`
	Duration float32 `json:"time"`
}

func NewSleepOp

func NewSleepOp(rawOp RawMongoOp) (*SleepOp, error)

type TxnOp

type TxnOp struct {
	Cmds []RawMongoOp `json:"dc"`
	ID   int          `json:"id"`
	// contains filtered or unexported fields
}

func NewTxnOp

func NewTxnOp(rawOp RawMongoOp) (*TxnOp, error)

Jump to

Keyboard shortcuts

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