store

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: Apache-2.0 Imports: 14 Imported by: 1

README

store

DB

Yugabyte

CREATE KEYSPACE IF NOT EXISTS argus;
CREATE TABLE argus.gifnoc (
    bucket VARCHAR,
    id VARCHAR,
    data blob,
    PRIMARY KEY (bucket, id))
    WITH default_time_to_live = 300
    AND transactions = {'enabled': 'false'};

Documentation

Index

Constants

View Source
const (
	// TypeLabel is for labeling metrics; if there is a single metric for
	// successful queries, the typeLabel and corresponding type can be used
	// when incrementing the metric.
	TypeLabel  = "type"
	InsertType = "insert"
	DeleteType = "delete"
	ReadType   = "read"
	PingType   = "ping"
)
View Source
const (
	ItemOwnerHeaderKey  = "X-Midt-Owner"
	AdminTokenHeaderKey = "X-Midt-Admin-Token"
	XmidtErrorHeaderKey = "X-Midt-Error"
)

Request and Response Headers

View Source
const DefaultTTL = 60 * 5

5 minutes

View Source
const YearTTL = 60 * 24 * 365

1 year

Variables

View Source
var ErrCasting = errors.New("casting error due to middleware wiring mistake")

ErrCasting indicates there was a middleware wiring mistake with the go-kit style encoders.

Functions

func FilterOwner added in v0.2.0

func FilterOwner(value map[string]OwnableItem, owner string) map[string]OwnableItem

Types

type BadRequestErr added in v0.3.6

type BadRequestErr struct {
	Message string
}

func (BadRequestErr) Error added in v0.3.6

func (bre BadRequestErr) Error() string

func (BadRequestErr) StatusCode added in v0.3.6

func (bre BadRequestErr) StatusCode() int

type ForbiddenRequestErr added in v0.3.8

type ForbiddenRequestErr struct {
	Message string
}

func (ForbiddenRequestErr) Error added in v0.3.8

func (f ForbiddenRequestErr) Error() string

func (ForbiddenRequestErr) StatusCode added in v0.3.8

func (f ForbiddenRequestErr) StatusCode() int

type Handler

type Handler http.Handler

type InternalError added in v0.2.1

type InternalError struct {
	Reason    interface{}
	Retryable bool
}

func (InternalError) Error added in v0.2.1

func (ie InternalError) Error() string

func (InternalError) StatusCode added in v0.2.1

func (ie InternalError) StatusCode() int

type KeyItemPairRequest added in v0.2.0

type KeyItemPairRequest struct {
	model.Key
	OwnableItem
	Method string
}

type KeyNotFoundError

type KeyNotFoundError struct {
	Key model.Key
}

func (KeyNotFoundError) Error

func (knfe KeyNotFoundError) Error() string

func (KeyNotFoundError) StatusCode

func (knfe KeyNotFoundError) StatusCode() int

type OwnableItem added in v0.2.0

type OwnableItem struct {
	model.Item
	Owner string `json:"owner"`
}

type S

type S interface {
	Push(key model.Key, item OwnableItem) error
	Get(key model.Key) (OwnableItem, error)
	Delete(key model.Key) (OwnableItem, error)
	GetAll(bucket string) (map[string]OwnableItem, error)
}

type StoreIn

type StoreIn struct {
	fx.In

	Store S
}

StoreIn is the set of dependencies for this package's components

type StoreOut

type StoreOut struct {
	fx.Out

	// SetItemHandler is the http.Handler to update an item in the store.
	SetItemHandler Handler `name:"setHandler"`

	// SetKeyHandler is the http.Handler to fetch an individual item from the store.
	GetItemHandler Handler `name:"getHandler"`

	// GetAllItems is the http.Handler to fetch all items from the store for a given bucket.
	GetAllItemsHandler Handler `name:"getAllHandler"`

	// DeletItems is the http.Handler to delete a certain item.
	DeleteKeyHandler Handler `name:"deleteHandler"`
}

StoreOut is the set of components emitted by this package

func Provide

func Provide(unmarshaller config.Unmarshaller, in StoreIn) StoreOut

Provide is an uber/fx style provider for this package's components

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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