evhttp

package
v0.1.0-beta11 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultMux

func DefaultMux(r evdb.Scanner, w evdb.Store) http.Handler

DefaultMux creates an HTTP endpoint for a evdb.DB

func EncodeScanQuery

func EncodeScanQuery(values url.Values, q *evdb.ScanQuery) error

EncodeScanQuery sets URL query values for a ScanQuery

func EncodeTimeRange

func EncodeTimeRange(values url.Values, q evdb.TimeRange)

EncodeTimeRange sets URL query values for a TimeRange

func InflateRequest

func InflateRequest(next http.Handler) http.HandlerFunc

InflateRequest middleware inflates request body

func MatchFieldsFromURL

func MatchFieldsFromURL(values url.Values) (m evdb.MatchFields, err error)

MatchFieldsFromURL parses MatchFields from URL query

func NewStoreHandler

func NewStoreHandler(s meter.Storer) http.Handler

NewStoreHandler returns an HTTP endpoint for a Storer

func ParseTime

func ParseTime(v string) (time.Time, error)

ParseTime parses time in various formats

func QueryHandler

func QueryHandler(scanner evdb.Scanner) http.HandlerFunc

QueryHandler returns an HTTP endpoint for a QueryRunner

func ScanQueryFromURL

func ScanQueryFromURL(values url.Values) (q evdb.ScanQuery, err error)

ScanQueryFromURL parses a ScanQuery from a URL query

func ScanQueryHandler

func ScanQueryHandler(scan evdb.Scanner) http.HandlerFunc

ScanQueryHandler returns a handler that serves ScanQuery HTTP requests

func ScanURL

func ScanURL(baseURL string, q *evdb.ScanQuery) (string, error)

ScanURL sets URL query from a ScanQuery

func StoreHandler

func StoreHandler(store meter.Store, prefix string) http.HandlerFunc

StoreHandler returns an HTTP handler for a Store

func TimeRangeFromURL

func TimeRangeFromURL(values url.Values) (t evdb.TimeRange, err error)

TimeRangeFromURL parses a TimeRange from URL query

func TimeRangeURL

func TimeRangeURL(rawURL string, t *evdb.TimeRange) (string, error)

TimeRangeURL sets URL query values for a TimeRange

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient does HTTP requests

type Querier

type Querier struct {
	URL string
	HTTPClient
}

Querier runs queries over http

func (*Querier) Query

func (qr *Querier) Query(ctx context.Context, r evdb.TimeRange, q string) ([]interface{}, error)

Query implements evdb.Evaler interface

type ScanQuerier

type ScanQuerier struct {
	URL string
	HTTPClient
}

ScanQuerier runs scan queries over http

func (*ScanQuerier) ScanQuery

func (s *ScanQuerier) ScanQuery(ctx context.Context, q *evdb.ScanQuery) (evdb.Results, error)

ScanQuery implements ScanQuerier interface

type Store

type Store struct {
	HTTPClient
	BaseURL string
}

Store is implements Store over HTTP

func (*Store) Storer

func (s *Store) Storer(event string) meter.Storer

Storer implements Store interface

type Storer

type Storer struct {
	HTTPClient
	URL string
}

Storer is a remote Storer over HTTP

func (*Storer) Store

func (c *Storer) Store(r *meter.Snapshot) (err error)

Store implements Storer interface

Jump to

Keyboard shortcuts

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