connector

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 12, 2014 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector struct {
	Path     string
	NumConns int
	Rate     int
	Verbose  bool
	Results  *results.Results
	// contains filtered or unexported fields
}

Connector contains connector data.

func (*Connector) Connect

func (conn *Connector) Connect() results.Result

Connect makes a single connection.

func (Connector) New

func (conn Connector) New(path string, numconns int) Connector

New generates a new Connector with all the necessaries.

Example
go stubServer()

c := Connector{}.New("http://localhost:9877", 10)

//
// Note on Rate:
//
// If Rate is not zero, Run() will parallelize actions at a Rate (QPS)
// of the set value.
//
// If Rate is zero, Run() will run the connections in a series.
//
// Both c.Series() and c.Parallel() can also be called in place of Run().
//
c.Rate = 4 // QPS
c.Run()

for i, code := range c.Results.Code {
	fmt.Printf("Code[%d] = %d\n", i, code)
}
Output:

func (*Connector) Parallel

func (conn *Connector) Parallel()

Parallel runs the Connector parallelized.

func (*Connector) Run

func (conn *Connector) Run()

Run runs the Connector, selecting Parallel or Series based on Rate.

func (*Connector) Series

func (conn *Connector) Series()

Series runs the Connector serialized.

Jump to

Keyboard shortcuts

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