reply

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fixed32Encode

func Fixed32Encode(x uint32) []byte

func Fixed64Encode

func Fixed64Encode(x uint64) []byte

func ProtobufWriteDouble

func ProtobufWriteDouble(w io.Writer, value float64)

func ProtobufWriteDoubleN

func ProtobufWriteDoubleN(w io.Writer, value float64, n int)

func ProtobufWriteSingle

func ProtobufWriteSingle(w io.Writer, value float32)

func VarintEncode

func VarintEncode(x uint64) []byte

func VarintLen

func VarintLen(x uint64) uint64

func VarintWrite

func VarintWrite(w io.Writer, x uint64)

func WriteByteN

func WriteByteN(w *bufio.Writer, value byte, n int)

Types

type Formatter

type Formatter interface {
	// Parse request
	ParseRequest(r *http.Request) (data.MultiTarget, error)
	// Generate reply payload
	Reply(http.ResponseWriter, *http.Request, data.CHResponses)
}

Formatter implements request parser and response generator

func GetFormatter

func GetFormatter(r *http.Request) (Formatter, error)

GetFormatter returns a proper interface for render format

type JSON

type JSON struct{}

JSON is an implementation of carbonapi_v3_pb MultiGlobRequest and MultiFetchResponse interconnection. It accepts the normal forms parser of `Content-Type: application/json` POST requests with JSON representation of MultiGlobRequest.

func (*JSON) ParseRequest

func (*JSON) ParseRequest(r *http.Request) (data.MultiTarget, error)

ParseRequest first tries to get body for application/json and convert it to carbonapi_v3_pb.MultiFetchRequest. As a fail-over it parses request forms.

func (*JSON) Reply

func (*JSON) Reply(w http.ResponseWriter, r *http.Request, multiData data.CHResponses)

Reply response to request with JSON representation of carbonapi_v3_pb.MultiFetchResponse.

type Pickle

type Pickle struct{}

Pickle is a formatter for python object serialization format.

func (*Pickle) ParseRequest

func (*Pickle) ParseRequest(r *http.Request) (data.MultiTarget, error)

ParseRequest parses target/from/until/maxDataPoints URL forms values

func (*Pickle) Reply

func (*Pickle) Reply(w http.ResponseWriter, r *http.Request, multiData data.CHResponses)

Reply serializes ClickHouse response to pickle format

type V2PB

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

V2PB is a formatter for carbonapi_v2_pb

func (*V2PB) ParseRequest

func (*V2PB) ParseRequest(r *http.Request) (data.MultiTarget, error)

ParseRequest parses target/from/until/maxDataPoints URL forms values

func (*V2PB) Reply

func (v *V2PB) Reply(w http.ResponseWriter, r *http.Request, multiData data.CHResponses)

Reply serializes ClickHouse response to carbonapi_v2_pb.MultiFetchResponse format

type V3PB

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

V3PB is a formatter for carbonapi_v3_pb

func (*V3PB) ParseRequest

func (*V3PB) ParseRequest(r *http.Request) (data.MultiTarget, error)

ParseRequest reads the requests parameters from carbonapi_v3_pb.MultiFetchRequest

func (*V3PB) Reply

func (v *V3PB) Reply(w http.ResponseWriter, r *http.Request, multiData data.CHResponses)

Reply serializes ClickHouse response to carbonapi_v3_pb.MultiFetchResponse format

Jump to

Keyboard shortcuts

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