store

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 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"
	// GetCommandMethod command method.
	GetCommandMethod = "Get"
	// PutCommandMethod command method.
	PutCommandMethod = "Put"
	// IteratorCommandMethod command method.
	IteratorCommandMethod = "Iterator"
	// 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)
	// GetErrorCode is typically a code for Get errors.
	GetErrorCode
	// PutErrorCode is typically a code for Put errors.
	PutErrorCode
	// IteratorErrorCode is typically a code for Iterator errors.
	IteratorErrorCode
	// DeleteErrorCode is typically a code for Delete errors.
	DeleteErrorCode
)

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, req io.Reader) command.Error

Flush data.

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) Iterator

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

Iterator retrieves data according to given start and end keys.

func (*Command) Put

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

Put stores the key and the record.

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 from the store

type GetResponse

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

GetResponse model

Represents a response of Get command.

type IteratorRequest

type IteratorRequest struct {
	StartKey string `json:"start_key"`
	EndKey   string `json:"end_key"`
}

IteratorRequest model

This is used for getting data from the store.

type IteratorResponse

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

IteratorResponse model

Represents a response of Iterator 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"`
}

PutRequest model

This is used for putting data to the store

Jump to

Keyboard shortcuts

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