util

package
v0.2.24 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2013 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const BINARY_VERSION = "0.2.24"

Variables

This section is empty.

Functions

func ApiRequest added in v0.2.23

func ApiRequest(endpoint string) (*simplejson.Json, error)

ApiRequest is a helper function to perform an HTTP request and parse our NSQ daemon's expected response format, with deadlines.

{"status_code":200, "status_txt":"OK", "data":{...}}

func ApiResponse

func ApiResponse(w http.ResponseWriter, statusCode int, statusTxt string, data interface{})

func ByteToBase10 added in v0.2.16

func ByteToBase10(b []byte) (n uint64, err error)

func Commafy added in v0.2.16

func Commafy(i interface{}) string

func FloatToPercent added in v0.2.24

func FloatToPercent(i float64) string

func GetTopicChannelArgs

func GetTopicChannelArgs(rp Getter) (string, string, error)

func HTTPServer added in v0.2.22

func HTTPServer(listener net.Listener, handler http.Handler)

func NanoSecondToHuman added in v0.2.24

func NanoSecondToHuman(v float64) string

func NewDeadlineTransport added in v0.2.23

func NewDeadlineTransport(timeout time.Duration) *http.Transport

A custom http.Transport with support for deadline timeouts

func ParseReaderOpts added in v0.2.24

func ParseReaderOpts(r *nsq.Reader, opts StringArray) error

func PercSuffix added in v0.2.24

func PercSuffix(i float64) string

func SendFramedResponse added in v0.2.23

func SendFramedResponse(w io.Writer, frameType int32, data []byte) (int, error)

SendFramedResponse is a server side utility function to prefix data with a length header and frame header and write to the supplied Writer

func SendResponse added in v0.2.23

func SendResponse(w io.Writer, data []byte) (int, error)

SendResponse is a server side utility function to prefix data with a length header and write to the supplied Writer

func StatsdHostKey added in v0.2.22

func StatsdHostKey(h string) string

func StringAdd

func StringAdd(s []string, a string) []string

func StringUnion

func StringUnion(s []string, a []string) []string

func TCPServer added in v0.2.22

func TCPServer(listener net.Listener, handler TCPHandler)

func Version added in v0.2.20

func Version(app string) string

Types

type ChildErr added in v0.2.23

type ChildErr interface {
	Parent() error
}

type ClientErr added in v0.2.23

type ClientErr struct {
	ParentErr error
	Code      string
	Desc      string
}

ClientErr provides a way for NSQ daemons to log a human reabable error string and return a machine readable string to the client.

see docs/protocol.md for error codes by command

func NewClientErr added in v0.2.23

func NewClientErr(parent error, code string, description string) *ClientErr

NewClientErr creates a ClientErr with the supplied human and machine readable strings

func (*ClientErr) Error added in v0.2.23

func (e *ClientErr) Error() string

Error returns the machine readable form

func (*ClientErr) Parent added in v0.2.23

func (e *ClientErr) Parent() error

Parent returns the parent error

type E2eProcessingLatencyAggregate added in v0.2.24

type E2eProcessingLatencyAggregate struct {
	Count       int                  `json:"count"`
	Percentiles []map[string]float64 `json:"percentiles"`
	Topic       string               `json:"topic"`
	Channel     string               `json:"channel"`
	Addr        string               `json:"host"`
}

func E2eProcessingLatencyAggregateFromJson added in v0.2.24

func E2eProcessingLatencyAggregateFromJson(j *simplejson.Json, topic, channel, host string) *E2eProcessingLatencyAggregate

func (*E2eProcessingLatencyAggregate) Add added in v0.2.24

func (*E2eProcessingLatencyAggregate) Host added in v0.2.24

func (*E2eProcessingLatencyAggregate) Len added in v0.2.24

func (*E2eProcessingLatencyAggregate) Less added in v0.2.24

func (e *E2eProcessingLatencyAggregate) Less(i, j int) bool

func (*E2eProcessingLatencyAggregate) Swap added in v0.2.24

func (e *E2eProcessingLatencyAggregate) Swap(i, j int)

func (*E2eProcessingLatencyAggregate) Target added in v0.2.24

func (e *E2eProcessingLatencyAggregate) Target(key string) ([]string, string)

type FatalClientErr added in v0.2.23

type FatalClientErr struct {
	ParentErr error
	Code      string
	Desc      string
}

func NewFatalClientErr added in v0.2.23

func NewFatalClientErr(parent error, code string, description string) *FatalClientErr

NewClientErr creates a ClientErr with the supplied human and machine readable strings

func (*FatalClientErr) Error added in v0.2.23

func (e *FatalClientErr) Error() string

Error returns the machine readable form

func (*FatalClientErr) Parent added in v0.2.23

func (e *FatalClientErr) Parent() error

Parent returns the parent error

type FloatArray added in v0.2.24

type FloatArray []float64

func (FloatArray) Len added in v0.2.24

func (a FloatArray) Len() int

func (FloatArray) Less added in v0.2.24

func (a FloatArray) Less(i, j int) bool

func (*FloatArray) Set added in v0.2.24

func (a *FloatArray) Set(param string) error

func (*FloatArray) String added in v0.2.24

func (a *FloatArray) String() string

func (FloatArray) Swap added in v0.2.24

func (a FloatArray) Swap(i, j int)

type Getter added in v0.2.17

type Getter interface {
	Get(key string) (string, error)
}

type PercentileResult added in v0.2.24

type PercentileResult struct {
	Count       int                  `json:"count"`
	Percentiles []map[string]float64 `json:"percentiles"`
}

func (*PercentileResult) String added in v0.2.24

func (pr *PercentileResult) String() string

type PostParams added in v0.2.17

type PostParams struct {
	*http.Request
}

func (*PostParams) Get added in v0.2.17

func (p *PostParams) Get(key string) (string, error)

type Protocol added in v0.2.23

type Protocol interface {
	IOLoop(conn net.Conn) error
}

Protocol describes the basic behavior of any protocol in the system

type Quantile added in v0.2.24

type Quantile struct {
	sync.Mutex

	Percentiles    []float64
	MoveWindowTime time.Duration
	// contains filtered or unexported fields
}

func NewQuantile added in v0.2.24

func NewQuantile(WindowTime time.Duration, Percentiles []float64) *Quantile

func (*Quantile) Insert added in v0.2.24

func (q *Quantile) Insert(msgStartTime int64)

func (*Quantile) IsDataStale added in v0.2.24

func (q *Quantile) IsDataStale(now time.Time) bool

func (*Quantile) Merge added in v0.2.24

func (q *Quantile) Merge(them *Quantile)

func (*Quantile) PercentileResult added in v0.2.24

func (q *Quantile) PercentileResult() *PercentileResult

func (*Quantile) QueryHandler added in v0.2.24

func (q *Quantile) QueryHandler() *quantile.Stream

type ReqParams

type ReqParams struct {
	url.Values
	Body []byte
}

func NewReqParams

func NewReqParams(req *http.Request) (*ReqParams, error)

func (*ReqParams) Get added in v0.2.16

func (r *ReqParams) Get(key string) (string, error)

func (*ReqParams) GetAll added in v0.2.16

func (r *ReqParams) GetAll(key string) ([]string, error)

type StatsdClient added in v0.2.16

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

func NewStatsdClient added in v0.2.16

func NewStatsdClient(addr string, prefix string) *StatsdClient

func (*StatsdClient) Close added in v0.2.16

func (c *StatsdClient) Close() error

func (*StatsdClient) CreateSocket added in v0.2.16

func (c *StatsdClient) CreateSocket() error

func (*StatsdClient) Decr added in v0.2.16

func (c *StatsdClient) Decr(stat string, count int64) error

func (*StatsdClient) Gauge added in v0.2.16

func (c *StatsdClient) Gauge(stat string, value int64) error

func (*StatsdClient) Incr added in v0.2.16

func (c *StatsdClient) Incr(stat string, count int64) error

func (*StatsdClient) String added in v0.2.16

func (c *StatsdClient) String() string

func (*StatsdClient) Timing added in v0.2.16

func (c *StatsdClient) Timing(stat string, delta int64) error

type StringArray

type StringArray []string

func (*StringArray) Set

func (a *StringArray) Set(s string) error

func (*StringArray) String

func (a *StringArray) String() string

type TCPHandler added in v0.2.22

type TCPHandler interface {
	Handle(net.Conn)
}

type WaitGroupWrapper

type WaitGroupWrapper struct {
	sync.WaitGroup
}

func (*WaitGroupWrapper) Wrap

func (w *WaitGroupWrapper) Wrap(cb func())

Directories

Path Synopsis
COPIED FROM http://code.google.com/p/go-semver/
COPIED FROM http://code.google.com/p/go-semver/

Jump to

Keyboard shortcuts

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