farm

package
v0.0.0-...-4aff305 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2018 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// APIPathInsert represents a way to insert a series or records.
	APIPathInsert = "/insert"

	// APIPathDelete represents a way to delete a series or records.
	APIPathDelete = "/delete"

	// APIPathSelect represents a way to select a record.
	APIPathSelect = "/select"

	// APIPathKeys represents a way to find all the keys with in the cache.
	APIPathKeys = "/keys"

	// APIPathSize represents a way to find the size of a key with in the cache.
	APIPathSize = "/size"

	// APIPathMembers represents a way to find all the members for a key with in
	// the cache.
	APIPathMembers = "/members"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API serves the cache API

func NewAPI

func NewAPI(farm farm.Farm,
	logger log.Logger,
	clients metrics.Gauge,
	duration metrics.HistogramVec,
) *API

NewAPI creates a API with the correct dependencies.

func (*API) Close

func (a *API) Close()

Close out the API

func (*API) ServeHTTP

func (a *API) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ChangeSetQueryResult

type ChangeSetQueryResult struct {
	Errors    errs.Error
	Params    KeyQueryParams      `json:"query"`
	Duration  string              `json:"duration"`
	ChangeSet selectors.ChangeSet `json:"changeset"`
}

ChangeSetQueryResult contains statistics about the query.

func (*ChangeSetQueryResult) EncodeTo

func (qr *ChangeSetQueryResult) EncodeTo(w http.ResponseWriter)

EncodeTo encodes the ChangeSetQueryResult to the HTTP response writer.

type FieldParams

type FieldParams interface {
	Field() selectors.Field
}

FieldParams represents a object that has a selectors.Field

type FieldScoreQueryResult

type FieldScoreQueryResult struct {
	Errors     errs.Error
	Params     KeyFieldQueryParams  `json:"query"`
	Duration   string               `json:"duration"`
	FieldScore selectors.FieldScore `json:"fieldscore"`
}

FieldScoreQueryResult contains statistics about the query.

func (*FieldScoreQueryResult) EncodeTo

func (qr *FieldScoreQueryResult) EncodeTo(w http.ResponseWriter)

EncodeTo encodes the FieldScoreQueryResult to the HTTP response writer.

type FieldValueScoreQueryResult

type FieldValueScoreQueryResult struct {
	Errors          errs.Error
	Params          KeyFieldQueryParams       `json:"query"`
	Duration        string                    `json:"duration"`
	FieldValueScore selectors.FieldValueScore `json:"fieldValueScore"`
}

FieldValueScoreQueryResult contains statistics about the query.

func (*FieldValueScoreQueryResult) EncodeTo

EncodeTo encodes the FieldValueScoreQueryResult to the HTTP response writer.

type FieldsQueryResult

type FieldsQueryResult struct {
	Errors   errs.Error
	Params   KeyQueryParams    `json:"query"`
	Duration string            `json:"duration"`
	Fields   []selectors.Field `json:"fields"`
}

FieldsQueryResult contains statistics about the query.

func (*FieldsQueryResult) EncodeTo

func (qr *FieldsQueryResult) EncodeTo(w http.ResponseWriter)

EncodeTo encodes the FieldsQueryResult to the HTTP response writer.

type Int64QueryResult

type Int64QueryResult struct {
	Errors   errs.Error
	Params   KeyParams `json:"query"`
	Duration string    `json:"duration"`
	Integer  int64     `json:"size"`
}

Int64QueryResult contains statistics about the query.

func (*Int64QueryResult) EncodeTo

func (qr *Int64QueryResult) EncodeTo(w http.ResponseWriter)

EncodeTo encodes the Int64QueryResult to the HTTP response writer.

type KeyFieldQueryParams

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

KeyFieldQueryParams defines all the dimensions of a query.

func (*KeyFieldQueryParams) DecodeFrom

func (qp *KeyFieldQueryParams) DecodeFrom(u *url.URL, h http.Header, rb queryBehavior) error

DecodeFrom populates a KeyFieldQueryParams from a URL.

func (KeyFieldQueryParams) Field

func (qp KeyFieldQueryParams) Field() selectors.Field

Field returns the field value from the parameters

func (KeyFieldQueryParams) Key

Key returns the key value from the parameters

type KeyParams

type KeyParams interface {
	Key() selectors.Key
}

KeyParams represents a parameter that has a selectors.Key

type KeyQueryParams

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

KeyQueryParams defines all the dimensions of a query.

func (*KeyQueryParams) DecodeFrom

func (qp *KeyQueryParams) DecodeFrom(u *url.URL, h http.Header, rb queryBehavior) error

DecodeFrom populates a KeyQueryParams from a URL.

func (KeyQueryParams) Key

func (qp KeyQueryParams) Key() selectors.Key

Key returns the key value from the parameters

type KeysQueryResult

type KeysQueryResult struct {
	Errors   errs.Error
	Duration string          `json:"duration"`
	Keys     []selectors.Key `json:"keys"`
}

KeysQueryResult contains statistics about the query.

func (*KeysQueryResult) EncodeTo

func (qr *KeysQueryResult) EncodeTo(w http.ResponseWriter)

EncodeTo encodes the KeysQueryResult to the HTTP response writer.

type PresenceQueryResult

type PresenceQueryResult struct {
	Errors   errs.Error
	Params   KeyFieldQueryParams `json:"query"`
	Duration string              `json:"duration"`
	Presence selectors.Presence  `json:"presence"`
}

PresenceQueryResult contains statistics about the query.

func (*PresenceQueryResult) EncodeTo

func (qr *PresenceQueryResult) EncodeTo(w http.ResponseWriter)

EncodeTo encodes the PresenceQueryResult to the HTTP response writer.

Jump to

Keyboard shortcuts

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