emul

package
v0.0.0-...-1c8de56 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher interface {
	SendReq(ctx context.Context, filePath string, args *SendArgs) (err error)
	MultiSend(ctx context.Context, req <-chan interface{}, args *SendArgs, wgSend *sync.WaitGroup) (err error)
	GetHisto() (histo metrics.Histogram, err error)
}

Dispatcher sends requests to the endpoint.

type Emul

type Emul struct {
	Dispatcher Dispatcher
	Client     net.Client
	Filer      sio.Filer
	Consoler   cui.Consoler
	Logger     slog.Logger
	Limiter    throt.Limiter
	Histogram  metrics.Histogram
}

Emul - Emulatator interface implementation.

func NewEmul

func NewEmul(clt net.Client, flr sio.Filer, con cui.Consoler, limiter throt.Limiter, logger slog.Logger, histo metrics.Histogram) (em *Emul, err error)

NewEmul creates new emul instance.

func (*Emul) GetHisto

func (em *Emul) GetHisto() (histo metrics.Histogram, err error)

GetHisto implements interface method to returns histogram.

func (*Emul) MultiSend

func (em *Emul) MultiSend(ctx context.Context, in <-chan interface{}, args *SendArgs, wgSend *sync.WaitGroup) (err error)

MultiSend dispatches requests, controlling the number of concurrent connections.

func (*Emul) SendReq

func (em *Emul) SendReq(ctx context.Context, filePath string, args *SendArgs) (err error)

SendReq sends a single request to destination.

func (*Emul) SetLogger

func (em *Emul) SetLogger(logger slog.Logger)

SetLogger sets Emul logger.

type Request

type Request struct {
	SesID    string
	ReqID    uint64
	FilePath string
}

Request - emul request implementation.

type Requester

type Requester interface {
	GetRequestID() (string, error)
	GetFilePath() (string, error)
}

Requester sends requests to the endpoint.

type SendArgs

type SendArgs struct {
	Data            string
	SrcDir          string
	Wildcard        string
	SaveReqDir      string
	SaveReqFilepath string
	SaveResDir      string
	SaveResFilepath string
	Repeat          uint
	CxnNum          uint
	SleepMs         uint
	Address         string
	Port            uint
	RateSec         uint
	RateMin         uint
	SendType        SendType
	TmoSec          uint
	TmoRdS          uint
	TmoWrS          uint
	TmoCxn          uint
	CxnLim          bool
	CltType         conf.ClientType
	SaveReq         bool
	SaveRes         bool
	ReqID           uint64
}

SendArgs send command arguments.

type SendType

type SendType int

SendType request type.

const (
	// UnknownReq unknown send type.
	UnknownReq SendType = iota
	// SingleReq a single send request.
	SingleReq
	// RepeatReq repeat the same request.
	RepeatReq
	// MultiReq multiple requests.
	MultiReq
)

func (SendType) String

func (s SendType) String() string

Jump to

Keyboard shortcuts

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