metrictank: github.com/grafana/metrictank/api/response Index | Files

package response

import "github.com/grafana/metrictank/api/response"

Index

Package Files

error.go fast_json.go json.go msgp.go msgpack.go pickle.go response.go

Constants

const HttpClientClosedRequest = 499

Variables

var BufferPool = util.NewBufferPool() // used by pickle, fastjson and msgp responses to serialize into
var ErrMetricNotFound = errors.New("metric not found")
var RequestCanceledErr = NewError(HttpClientClosedRequest, "request canceled")

func Write Uses

func Write(w http.ResponseWriter, resp Response)

type Error Uses

type Error interface {
    //This could have just been `Code`, but that would make it accidentally share an interface with gocql and lead to nonsense HTTP codes
    //See https://github.com/grafana/metrictank/issues/1678
    HTTPStatusCode() int
    Error() string
}

type ErrorResp Uses

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

func Errorf Uses

func Errorf(code int, format string, a ...interface{}) *ErrorResp

func NewError Uses

func NewError(code int, err string) *ErrorResp

func WrapError Uses

func WrapError(e error) *ErrorResp

func WrapErrorForTagDB Uses

func WrapErrorForTagDB(e error) *ErrorResp

graphite's http tagdb client requires a specific error format

func (*ErrorResp) Body Uses

func (r *ErrorResp) Body() ([]byte, error)

func (*ErrorResp) Close Uses

func (r *ErrorResp) Close()

func (*ErrorResp) Code Uses

func (r *ErrorResp) Code() int

func (*ErrorResp) Error Uses

func (r *ErrorResp) Error() string

func (*ErrorResp) HTTPStatusCode Uses

func (r *ErrorResp) HTTPStatusCode() int

func (*ErrorResp) Headers Uses

func (r *ErrorResp) Headers() (headers map[string]string)

type FastJSON Uses

type FastJSON interface {
    MarshalJSONFast([]byte) ([]byte, error)
}

type FastJson Uses

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

func NewFastJson Uses

func NewFastJson(code int, body FastJSON) *FastJson

func (*FastJson) Body Uses

func (r *FastJson) Body() ([]byte, error)

func (*FastJson) Close Uses

func (r *FastJson) Close()

func (*FastJson) Code Uses

func (r *FastJson) Code() int

func (*FastJson) Headers Uses

func (r *FastJson) Headers() (headers map[string]string)

type Json Uses

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

func NewJson Uses

func NewJson(code int, body interface{}, jsonp string) *Json

func (*Json) Body Uses

func (r *Json) Body() (buf []byte, err error)

func (*Json) Close Uses

func (r *Json) Close()

func (*Json) Code Uses

func (r *Json) Code() int

func (*Json) Headers Uses

func (r *Json) Headers() (headers map[string]string)

type Msgp Uses

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

func NewMsgp Uses

func NewMsgp(code int, body msgp.Marshaler) *Msgp

func (*Msgp) Body Uses

func (r *Msgp) Body() ([]byte, error)

func (*Msgp) Close Uses

func (r *Msgp) Close()

func (*Msgp) Code Uses

func (r *Msgp) Code() int

func (*Msgp) Headers Uses

func (r *Msgp) Headers() (headers map[string]string)

type MsgpArray Uses

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

func NewMsgpArray Uses

func NewMsgpArray(code int, body []msgp.Marshaler) *MsgpArray

func (*MsgpArray) Body Uses

func (r *MsgpArray) Body() ([]byte, error)

func (*MsgpArray) Close Uses

func (r *MsgpArray) Close()

func (*MsgpArray) Code Uses

func (r *MsgpArray) Code() int

func (*MsgpArray) Headers Uses

func (r *MsgpArray) Headers() (headers map[string]string)

type Msgpack Uses

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

func NewMsgpack Uses

func NewMsgpack(code int, body msgp.Marshaler) *Msgpack

func (*Msgpack) Body Uses

func (r *Msgpack) Body() ([]byte, error)

func (*Msgpack) Close Uses

func (r *Msgpack) Close()

func (*Msgpack) Code Uses

func (r *Msgpack) Code() int

func (*Msgpack) Headers Uses

func (r *Msgpack) Headers() (headers map[string]string)

type Picklable Uses

type Picklable interface {
    Pickle([]byte) ([]byte, error)
}

type Pickle Uses

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

func NewPickle Uses

func NewPickle(code int, body Picklable) *Pickle

func (*Pickle) Body Uses

func (r *Pickle) Body() ([]byte, error)

func (*Pickle) Close Uses

func (r *Pickle) Close()

func (*Pickle) Code Uses

func (r *Pickle) Code() int

func (*Pickle) Headers Uses

func (r *Pickle) Headers() (headers map[string]string)

type Response Uses

type Response interface {
    Code() int
    Body() ([]byte, error)
    Headers() map[string]string
    Close()
}

type TagDBError Uses

type TagDBError struct {
    Error string `json:"error"`
}

Package response imports 6 packages (graph) and is imported by 3 packages. Updated 2020-07-15. Refresh now. Tools for package owners.