sandbox

package
v0.0.0-...-55a50c8 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2013 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

This package contains utilities for testing DCCP and CCID in a controlled, simulated environment.

Index

Constants

View Source
const (
	DefaultRateInterval           = 1e9
	DefaultRatePacketsPerInterval = 100
)

Variables

This section is empty.

Functions

func NanoToMilli

func NanoToMilli(nano float64) float64

func NewClientServerPipe

func NewClientServerPipe(env *dccp.Env) (clientConn, serverConn *dccp.Conn, clientToServer, serverToClient *headerHalfPipe)

NewClientServerPipe creates a sandbox communication pipe and attaches a DCCP client and a DCCP server to its endpoints. In addition to sending all emits to a standard DCCP log file, it sends a copy of all emits to the dup TraceWriter.

Types

type Measure

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

Measure is a dccp.TraceWriter which listens to the logs emitted from the Roundtrip. It measures the real roundtrip time between the sender and receiver, based on read and write logs and prints out this information.

func NewMeasure

func NewMeasure(env *dccp.Env, t *testing.T) *Measure

func (*Measure) Close

func (x *Measure) Close() error

func (*Measure) Loss

func (x *Measure) Loss() (cs float64, csLoss, csTotal int64, sc float64, scLoss, scTotal int64)

func (*Measure) String

func (x *Measure) String() string

func (*Measure) Sync

func (x *Measure) Sync() error

func (*Measure) Write

func (x *Measure) Write(r *dccp.Trace)

type Moment

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

func (*Moment) Add

func (x *Moment) Add(sample float64)

func (*Moment) AddWeighted

func (x *Moment) AddWeighted(sample float64, weight float64)

func (*Moment) Average

func (x *Moment) Average() float64

func (*Moment) Init

func (x *Moment) Init()

func (*Moment) Max

func (x *Moment) Max() float64

func (*Moment) Min

func (x *Moment) Min() float64

func (*Moment) Moment

func (x *Moment) Moment(k float64) float64

func (*Moment) StdDev

func (x *Moment) StdDev() float64

func (*Moment) Variance

func (x *Moment) Variance() float64

type Pipe

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

Pipe is an in-process commincation channel, whose two ends implement dccp.HeaderConn. It supports rate limiting, latency emulation and receive buffer emulation (in order to capture slow readers).

func NewPipe

func NewPipe(env *dccp.Env, amb *dccp.Amb, namea, nameb string) (a, b *headerHalfPipe, line *Pipe)

NewPipe creates a new pipe with a given runtime shared by both endpoints, and a root amb

type TraceWriterPlex

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

TraceWriterPlex is a dccp.TraceWriter that replicates TraceWriter method invocations to a set of TraceWriters

func NewEnv

func NewEnv(guzzleFilename string, guzzles ...dccp.TraceWriter) (env *dccp.Env, plex *TraceWriterPlex)

NewEnv creates a dccp.Env for test purposes, whose dccp.TraceWriter writes to a file and duplicates all emits to any number of additional guzzles, which are usually used to check test conditions. The TraceWriterPlex is returned to facilitate adding further guzzles.

func NewTraceWriterPlex

func NewTraceWriterPlex(guzzles ...dccp.TraceWriter) *TraceWriterPlex

func (*TraceWriterPlex) Add

func (t *TraceWriterPlex) Add(g dccp.TraceWriter)

Add adds an additional guzzle to the plex

func (*TraceWriterPlex) Close

func (t *TraceWriterPlex) Close() error

Close closes all the guzzles in the plex

func (*TraceWriterPlex) HighlightSamples

func (t *TraceWriterPlex) HighlightSamples(samples ...string)

HighlightSamples instructs the guzzle to highlight any records carrying samples of the given names

func (*TraceWriterPlex) Sync

func (t *TraceWriterPlex) Sync() error

Sync syncs all the guzzles in the plex

func (*TraceWriterPlex) Write

func (t *TraceWriterPlex) Write(r *dccp.Trace)

Jump to

Keyboard shortcuts

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