store

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package store provides store commands.

Index

Constants

View Source
const (
	// CommandName package command name.
	CommandName = "store"
	// PutCommandMethod command method.
	PutCommandMethod = "Put"
	// GetCommandMethod command method.
	GetCommandMethod = "Get"
	// QueryCommandMethod command method.
	QueryCommandMethod = "Query"
	// DeleteCommandMethod command method.
	DeleteCommandMethod = "Delete"
	// FlushCommandMethod command method.
	FlushCommandMethod = "Flush"
)
View Source
const (
	// InvalidRequestErrorCode is typically a code for validation errors.
	InvalidRequestErrorCode = command.Code(iota + command.Store)
	// PutErrorCode is typically a code for Put errors.
	PutErrorCode
	// GetErrorCode is typically a code for Get errors.
	GetErrorCode
	// QueryErrorCode is typically a code for Query errors.
	QueryErrorCode
	// DeleteErrorCode is typically a code for Delete errors.
	DeleteErrorCode
	// FlushErrorCode is typically a code for Flush errors.
	FlushErrorCode
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

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

Command is controller command for store.

func New

func New(p Provider) (*Command, error)

New returns new store controller command instance.

func (*Command) Delete

func (c *Command) Delete(rw io.Writer, req io.Reader) command.Error

Delete deletes a record with a given key.

func (*Command) Flush

func (c *Command) Flush(rw io.Writer, _ io.Reader) command.Error

Flush data in all currently open stores.

func (*Command) Get

func (c *Command) Get(rw io.Writer, req io.Reader) command.Error

Get fetches the record based on key.

func (*Command) GetHandlers

func (c *Command) GetHandlers() []command.Handler

GetHandlers returns list of all commands supported by this controller command.

func (*Command) Put

func (c *Command) Put(rw io.Writer, req io.Reader) command.Error

Put stores the key, value and (optional) tags.

func (*Command) Query added in v0.1.6

func (c *Command) Query(rw io.Writer, req io.Reader) command.Error

Query retrieves data according to given expression.

type DeleteRequest

type DeleteRequest struct {
	Key string `json:"key"`
}

DeleteRequest model

This is used for deleting data from the store.

type GetRequest

type GetRequest struct {
	Key string `json:"key"`
}

GetRequest model

This is used for getting data (value or tags) from the store.

type GetResponse

type GetResponse struct {
	Result []byte `json:"result"`
}

GetResponse model

Represents a response of Get command.

type Provider

type Provider interface {
	StorageProvider() storage.Provider
}

Provider describes dependencies for the client.

type PutRequest

type PutRequest struct {
	Key   string        `json:"key"`
	Value []byte        `json:"value"`
	Tags  []storage.Tag `json:"tags"`
}

PutRequest model

This is used for putting data in the store.

type QueryRequest added in v0.1.6

type QueryRequest struct {
	Expression string `json:"expression"`
	PageSize   int    `json:"pageSize"`
}

QueryRequest model

This is used for getting data (values only, without tags) from the store.

type QueryResponse added in v0.1.6

type QueryResponse struct {
	Results [][]byte `json:"results"`
}

QueryResponse model

Represents a response of Query command.

Jump to

Keyboard shortcuts

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