Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewKVStoreTemplateFuncMap ¶ added in v1.2.3
NewKVStoreTemplateFuncMap creates a template.FuncMap for accessing a Storage
Types ¶
type InmemoryStorage ¶ added in v0.0.13
type InmemoryStorage struct {
// contains filtered or unexported fields
}
InmemoryStorage is an implementation of Storage using local in-memory storage
func NewInmemoryStorage ¶ added in v0.0.13
func NewInmemoryStorage() *InmemoryStorage
NewInmemoryStorage creates a new instance of InmemoryStorage
func (*InmemoryStorage) Get ¶ added in v1.2.3
func (s *InmemoryStorage) Get(store, key string) (interface{}, error)
Get returns a value for a given key
func (*InmemoryStorage) GetAll ¶ added in v1.2.3
func (s *InmemoryStorage) GetAll(store string) (map[string]interface{}, error)
GetAll returns all values for a given store
func (*InmemoryStorage) Put ¶ added in v1.2.3
func (s *InmemoryStorage) Put(store, key string, val interface{}) error
Put stores a value for a given key
func (*InmemoryStorage) Shutdown ¶ added in v1.3.0
func (s *InmemoryStorage) Shutdown() error
Shutdown does nothing for InmemoryStorage
type RequestHandler ¶ added in v0.0.13
type RequestHandler struct {
// contains filtered or unexported fields
}
RequestHandler implements an http API to access a Storage
func NewRequestHandler ¶ added in v0.0.13
func NewRequestHandler(pathPrefix string, storage Storage, logLevel string) *RequestHandler
NewRequestHandler creates an instance of RequestHandler
func (*RequestHandler) AddRoutes ¶ added in v0.0.13
func (r *RequestHandler) AddRoutes(router *mux.Router)
AddRoutes adds mux.Routes for the http API to a given mux.Router
type Storage ¶ added in v0.0.13
type Storage interface { GetAll(store string) (map[string]interface{}, error) Put(store, key string, val interface{}) error Get(store, key string) (interface{}, error) Shutdown() error }
Storage is *the* interface for the key value store
There can be implementations using: - a local in-memory storage , - multiple servers for a distributed - a database like redis