httpd

package
v0.10.1-0...-af01984 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2016 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultChunkSize specifies the amount of data mappers will read
	// up to, before sending results back to the engine. This is the
	// default size in the number of values returned in a raw query.
	//
	// Could be many more bytes depending on fields returned.
	DefaultChunkSize = 10000
)

Variables

This section is empty.

Functions

func MarshalJSON

func MarshalJSON(v interface{}, pretty bool) []byte

MarshalJSON will marshal v to JSON. Pretty prints if pretty is true.

func NormalizeBatchPoints

func NormalizeBatchPoints(bp client.BatchPoints) ([]models.Point, error)

NormalizeBatchPoints returns a slice of Points, created by populating individual points within the batch, which do not have times or tags, with the top-level values.

Types

type Batch

type Batch struct {
	Database        string  `json:"database"`
	RetentionPolicy string  `json:"retentionPolicy"`
	Points          []Point `json:"points"`
}

Batch is a collection of points associated with a database, having a certain retention policy.

type Config

type Config struct {
	Enabled          bool   `toml:"enabled"`
	BindAddress      string `toml:"bind-address"`
	AuthEnabled      bool   `toml:"auth-enabled"`
	LogEnabled       bool   `toml:"log-enabled"`
	WriteTracing     bool   `toml:"write-tracing"`
	PprofEnabled     bool   `toml:"pprof-enabled"`
	HTTPSEnabled     bool   `toml:"https-enabled"`
	HTTPSCertificate string `toml:"https-certificate"`
	JSONWriteEnabled bool   `toml:"json-write-enabled"`
}

Config represents a configuration for a HTTP service.

func NewConfig

func NewConfig() Config

NewConfig returns a new Config with default settings.

type Handler

type Handler struct {
	Version string

	MetaClient interface {
		Database(name string) (*meta.DatabaseInfo, error)
		Authenticate(username, password string) (ui *meta.UserInfo, err error)
		Users() []meta.UserInfo
		Ping(checkAllMetaServers bool) error
	}

	QueryAuthorizer *meta.QueryAuthorizer
	QueryExecutor   influxql.QueryExecutor

	PointsWriter interface {
		WritePoints(p *cluster.WritePointsRequest) error
	}

	ContinuousQuerier continuous_querier.ContinuousQuerier

	Logger *log.Logger

	WriteTrace       bool // Detailed logging of write path
	JSONWriteEnabled bool // Allow JSON writes
	// contains filtered or unexported fields
}

Handler represents an HTTP handler for the InfluxDB server.

func NewHandler

func NewHandler(requireAuthentication, loggingEnabled, writeTrace, JSONWriteEnabled bool, statMap *expvar.Map) *Handler

NewHandler returns a new instance of handler with routes.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP responds to HTTP request to the handler.

func (*Handler) SetRoutes

func (h *Handler) SetRoutes(routes []route)

SetRoutes sets the provided routes on the handler.

type Point

type Point struct {
	Name   string                 `json:"name"`
	Time   time.Time              `json:"time"`
	Tags   map[string]string      `json:"tags"`
	Fields map[string]interface{} `json:"fields"`
}

Point represents an InfluxDB point.

type Response

type Response struct {
	Results []*influxql.Result
	Err     error
}

Response represents a list of statement results.

func (*Response) Error

func (r *Response) Error() error

Error returns the first error from any statement. Returns nil if no errors occurred on any statements.

func (Response) MarshalJSON

func (r Response) MarshalJSON() ([]byte, error)

MarshalJSON encodes a Response struct into JSON.

func (*Response) UnmarshalJSON

func (r *Response) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the data into the Response struct

type Service

type Service struct {
	Handler *Handler

	Logger *log.Logger
	// contains filtered or unexported fields
}

Service manages the listener and handler for an HTTP endpoint.

func NewService

func NewService(c Config) *Service

NewService returns a new instance of Service.

func (*Service) Addr

func (s *Service) Addr() net.Addr

Addr returns the listener's address. Returns nil if listener is closed.

func (*Service) Close

func (s *Service) Close() error

Close closes the underlying listener.

func (*Service) Err

func (s *Service) Err() <-chan error

Err returns a channel for fatal errors that occur on the listener.

func (*Service) Open

func (s *Service) Open() error

Open starts the service

func (*Service) SetLogger

func (s *Service) SetLogger(l *log.Logger)

SetLogger sets the internal logger to the logger passed in.

Jump to

Keyboard shortcuts

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