api

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: 1 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeSet

type ChangeSet struct {
	Success []Field `json:"success"`
	Failure []Field `json:"failure"`
}

ChangeSet is an input for marshalling json input and out from the api

func ChangeSetOutput

func ChangeSetOutput(a selectors.ChangeSet) ChangeSet

type Field

type Field string

Field is an input for marshalling json input and output from the api

func FieldsOutput

func FieldsOutput(a []selectors.Field) []Field

type FieldScore

type FieldScore struct {
	Field Field `json:"field"`
	Score int64 `json:"score"`
}

FieldScore is an input for marshalling json input and out from the api

type FieldValueScore

type FieldValueScore struct {
	Field Field  `json:"field"`
	Value []byte `json:"value"`
	Score int64  `json:"score"`
}

FieldValueScore is an input for marshalling json input and out from the api

type Key

type Key string

Key is an input for marshalling json input and output from the api

func KeysOutput

func KeysOutput(a []selectors.Key) []Key

type MembersInput

type MembersInput struct {
	Members []FieldValueScore `json:"members"`
}

MembersInput defines a simple type for marshalling and unmarshalling members

type Presence

type Presence struct {
	Present  bool  `json:"present"`
	Inserted bool  `json:"inserted"`
	Score    int64 `json:"score"`
}

Presence is an input for marshalling json input and out from the api

type Transport

type Transport interface {
	TransportNetwork

	// Insert takes a key and value and stores with in the underlying store.
	// Returns ChangeSet of success and failure
	Insert(selectors.Key, []selectors.FieldValueScore) (selectors.ChangeSet, error)

	// Delete removes a value associated with the key.
	// Returns ChangeSet of success and failure
	Delete(selectors.Key, []selectors.FieldValueScore) (selectors.ChangeSet, error)

	// Select retrieves a field and score associated with the store.
	// Returns Field, Value and Score if the value found
	Select(selectors.Key, selectors.Field) (selectors.FieldValueScore, error)

	// Keys returns all the potential keys that are stored with in the store.
	Keys() ([]selectors.Key, error)

	// Size returns the number of members for the key are stored in the store.
	Size(selectors.Key) (int64, error)

	// Members returns the members associated for a key
	Members(selectors.Key) ([]selectors.Field, error)

	// Score returns the specific score for the field with in the key.
	Score(selectors.Key, selectors.Field) (selectors.Presence, error)
}

Transport wraps the API transportation request to provide an agnostic approach to the store. As long as the API implements the following transportation service then any protocol can be used; http, gRPC, raw udp

type TransportNetwork

type TransportNetwork interface {

	// Hash returns the transport unique hash
	Hash() uint32

	// Host returns the transport underlying host
	Host() string
}

TransportNetwork defines a hash and host

type TransportStrategy

type TransportStrategy interface {

	// Apply applies a host to create a new api.Transport
	Apply(string) Transport
}

TransportStrategy defines a way to create a transport

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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