config

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Proto         string             `json:"proto"`
	Protoset      string             `json:"protoset"`
	Call          string             `json:"call"`
	Cert          string             `json:"cert"`
	CName         string             `json:"cName"`
	N             int                `json:"n"`
	C             int                `json:"c"`
	QPS           int                `json:"q"`
	Z             time.Duration      `json:"z"`
	X             time.Duration      `json:"x"`
	Timeout       int                `json:"t"`
	Data          interface{}        `json:"d,omitempty"`
	DataPath      string             `json:"D"`
	Metadata      *map[string]string `json:"m,omitempty"`
	MetadataPath  string             `json:"M"`
	Output        string             `json:"o"`
	Format        string             `json:"O"`
	Host          string             `json:"host"`
	DialTimeout   int                `json:"T"`
	KeepaliveTime int                `json:"L"`
	CPUs          int                `json:"cpus"`
	ImportPaths   []string           `json:"i,omitempty"`
	Insecure      bool               `json:"insecure,omitempty"`
}

Config for the run.

func New

func New(proto, protoset, call, cert, cName string, n, c, qps int, z time.Duration, x time.Duration,
	timeout int, data, dataPath, metadata, mdPath, output, format, host string,
	dialTimout, keepaliveTime, cpus int, importPaths []string, insecure bool) (*Config, error)

New creates a new config

func ReadConfig

func ReadConfig(path string) (*Config, error)

ReadConfig reads the JSON config from path, applies the defaults and validates

func (*Config) Default

func (c *Config) Default()

Default sets the defaults values for some of the properties that need to have valid values

func (Config) MarshalJSON

func (c Config) MarshalJSON() ([]byte, error)

MarshalJSON is our custom implementation to handle the Duration field Z

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON is our custom implementation to handle the Duration field Z and validate data

func (*Config) Validate

func (c *Config) Validate() error

Validate the config

Jump to

Keyboard shortcuts

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