gokvstore

package module
v0.0.0-...-4bfbf91 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2018 License: MIT Imports: 13 Imported by: 0

README

A wrapper for standardised kv and range store/db access.

Build Status GoDoc codecov Go Report Card

Communication data structures are defined in kv.proto

Currently only rocksdb is implemented.

Example

RocksDB remote:

	// allocate rocksStore
	rocksStore := rocks.NewRocksStore()
	// kv wrapper around the rocksStore
	kvRocksStore := rocks.NewRocksKVStoreDefault(rocksStore)
	// options for rocksStore
	dbOpts := rocks.NewDefaultEventsOptions()
	dbOpts.SetCreateIfMissing(true)
	dbOpts.SetCreateIfMissingColumnFamilies(true)
	// init the rocksStore.
	err = rocksStore.InitWithColumnFamilies(dbOpts, storeDir, cfNames)
	goerror.PanicOnError(err)

	server, err = plain.NewServerAddr("tcp", &addr, kvRocksStore, true,
		func(err error) {
			log.Println("Server error", err)
		},
		func(err error) {
			log.Println("Connection error", err)
		},
		1024*1024*16, 1024*1024*16)
	goerror.PanicOnError(err)

	err = server.Start()
	goerror.PanicOnError(err)

	// allocate and init the wrapped client
	client, err = plain.NewClientStoreInitDefaultStart(addr, 1024*1024*16)
	goerror.PanicOnError(err)

	// allocate a write batch to be written to the server
	batch := client.WriteBatch(nil)

	// the writebatch be used via ColumnFamilies
	cf1, _ := client.ColumnFamilyHandleByName("table1")
	cf2, _ := client.ColumnFamilyHandleByName("table2")
	err = cf1.PutToWriteBatch([]byte("mykey"), []byte("myvalue"), batch)
	goerror.PanicOnError(err)
	err = cf2.PutToWriteBatch([]byte("myotherkey"), []byte("myothervalue"), batch)
	goerror.PanicOnError(err)

	// you can batch much more Put or also Delete actions here...
	// err = cf2.DeleteToWriteBatch([]byte("myotherkey"), batch)
	// goerror.PanicOnError(err)

	// write the batch synced
	// batch is no longer usable (see doc)
	// data is written to the underlying RocksDB
	err = client.WriteWriteBatch(batch)
	goerror.PanicOnError(err)

	// use the client to retrieve ... also for multiple cfs at once
	cfKeys := []gokvstore.CFKeys{
		{
			CF:   cf1,
			Keys: [][]byte{[]byte("mykey")},
		},

		{
			CF:   cf2,
			Keys: [][]byte{[]byte("myotherkey")},
		},

		{
			CF:   cf2,
			Keys: [][]byte{[]byte("mynonexistingkey")},
		},
	}

	// get our result
	var result goiterator.KVKVForwardResultIterator
	result, err = client.GetMulti(cfKeys...)
	goerror.PanicOnError(err)

	for ; result.Valid(); result.Next() {
		k, v := result.KeyValue()
		log.Infoln("result value", string(k), string(v))
	}

Install


If you use engine/rocks, you'll need to build RocksDB v5.8+ on your machine.

Limitations / Potential problems

Endianness is ignored and unsafe is used to copy structs and int types.

Documentation

Overview

Package gokvstore is a generated protocol buffer package.

It is generated from these files:

kv.proto

It has these top-level messages:

IteratorCommandInfoTypes
Request
Response
PutElement
PutCommand
PutCommandResponse
DeleteElement
DeleteCommand
DeleteCommandResponse
ContextSetting
Settings
SettingsQuery
SettingsQueryResponse
SettingsCommand
SettingsCommandResponse
IteratorElementInfo
IteratorElement
IteratorQuery
IteratorQueryResponse
ReplaySetting
GetElement
GetQuery
GetQueryResponse
PipelinedCommand
PipelinedCommandResponse

Index

Constants

View Source
const ContextNameIndexPrefix = "i://"

After this the next four bytes can be interpreted as uint16 in machine byte order

Variables

View Source
var (
	ErrInvalidLengthKv = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowKv   = fmt.Errorf("proto: integer overflow")
)
View Source
var DeleteCommandType_name = map[int32]string{
	0: "DeleteKey",
	1: "DeleteRange",
}
View Source
var DeleteCommandType_value = map[string]int32{
	"DeleteKey":   0,
	"DeleteRange": 1,
}
View Source
var ErrContextNotFound = NewDefaultError(uint32(KVErrorCode_ContextNotFound), KVErrorCode_ContextNotFound.String())
View Source
var ErrDeleteRangeKeyCountsNotMatch = NewDefaultError(
	uint32(KVErrorCode_DeleteRangeKeyCountsNotMatch), KVErrorCode_DeleteRangeKeyCountsNotMatch.String())
View Source
var ErrDeleteRangeOverlap = NewDefaultError(uint32(KVErrorCode_DeleteRangeOverlap), KVErrorCode_DeleteRangeOverlap.String())
View Source
var ErrIteratorTypesInvalid = NewDefaultError(uint32(KVErrorCode_IteratorTypesInvalid), KVErrorCode_IteratorTypesInvalid.String())
View Source
var ErrKeyInvalid = NewDefaultError(uint32(KVErrorCode_KeyInvalid), KVErrorCode_KeyInvalid.String())
View Source
var ErrNotWritable = NewDefaultError(uint32(KVErrorCode_NotWritable), KVErrorCode_NotWritable.String())
View Source
var ErrReadaheadInvalid = NewDefaultError(uint32(KVErrorCode_ReadaheadInvalid), KVErrorCode_ReadaheadInvalid.String())
View Source
var ErrWrongCommandType = NewDefaultError(uint32(KVErrorCode_WrongCommandType), KVErrorCode_WrongCommandType.String())
View Source
var GetReturnFormat_name = map[int32]string{
	0: "OmitEmpty",
	1: "AddEmpty",
}
View Source
var GetReturnFormat_value = map[string]int32{
	"OmitEmpty": 0,
	"AddEmpty":  1,
}
View Source
var IteratorCommandInfoType_name = map[int32]string{
	0: "None",
	1: "SeekToFirst",
	2: "SeekToLast",
	3: "Seek",
	4: "SeekForPrev",
	5: "Next",
	6: "Prev",
	7: "Close",
	8: "ReplayStart",
	9: "ReplayStop",
}
View Source
var IteratorCommandInfoType_value = map[string]int32{
	"None":        0,
	"SeekToFirst": 1,
	"SeekToLast":  2,
	"Seek":        3,
	"SeekForPrev": 4,
	"Next":        5,
	"Prev":        6,
	"Close":       7,
	"ReplayStart": 8,
	"ReplayStop":  9,
}
View Source
var KVCommandType_name = map[int32]string{
	0:  "KVEcho",
	1:  "KVPing",
	2:  "KVPong",
	3:  "KVStatusQuery",
	4:  "KVGetQuery",
	5:  "KVIteratorQuery",
	11: "KVPutCommand",
	12: "KVDeleteCommand",
	21: "KVSettingsCommand",
	22: "KVSettingsQuery",
	31: "KVPipeline",
}
View Source
var KVCommandType_value = map[string]int32{
	"KVEcho":            0,
	"KVPing":            1,
	"KVPong":            2,
	"KVStatusQuery":     3,
	"KVGetQuery":        4,
	"KVIteratorQuery":   5,
	"KVPutCommand":      11,
	"KVDeleteCommand":   12,
	"KVSettingsCommand": 21,
	"KVSettingsQuery":   22,
	"KVPipeline":        31,
}
View Source
var KVErrorCode_name = map[int32]string{
	0: "WrongCommandType",
	1: "WrongPipelineCommandType",
	2: "ContextNotFound",
	3: "DeleteRangeOverlap",
	4: "DeleteRangeKeyCountsNotMatch",
	5: "IteratorTypesInvalid",
	6: "ReadaheadInvalid",
	7: "NotWritable",
	8: "KeyInvalid",
}
View Source
var KVErrorCode_value = map[string]int32{
	"WrongCommandType":             0,
	"WrongPipelineCommandType":     1,
	"ContextNotFound":              2,
	"DeleteRangeOverlap":           3,
	"DeleteRangeKeyCountsNotMatch": 4,
	"IteratorTypesInvalid":         5,
	"ReadaheadInvalid":             6,
	"NotWritable":                  7,
	"KeyInvalid":                   8,
}
View Source
var ReplaySpeed_name = map[int32]string{
	0: "ReplaySpeed_Original",
	1: "ReplaySpeed_AFAP",
	2: "ReplaySpeed_Random",
	3: "ReplaySpeed_Variation",
}
View Source
var ReplaySpeed_value = map[string]int32{
	"ReplaySpeed_Original":  0,
	"ReplaySpeed_AFAP":      1,
	"ReplaySpeed_Random":    2,
	"ReplaySpeed_Variation": 3,
}

Functions

func CreateColumnFamilyHandleContextNameIndexString

func CreateColumnFamilyHandleContextNameIndexString(idx uint16) string

CreateColumnFamilyHandleContextNameIndexString creates a string of length 6 which is preceded by ContextNameIndexPrefix and followed by uint16 of idx in machine byte order.

func IteratorTypesAddIteratorCommandInfoType

func IteratorTypesAddIteratorCommandInfoType(types uint64, it IteratorCommandInfoType) uint64

IteratorTypesAddIteratorCommandInfoType adds "it" to types.

func IteratorTypesIsIteratorCommandInfoType

func IteratorTypesIsIteratorCommandInfoType(types uint64, it IteratorCommandInfoType) bool

IteratorTypesIsIteratorCommandInfoType checks whether "it" is present in types.

func IteratorTypesIsOtherIteratorCommandInfoType

func IteratorTypesIsOtherIteratorCommandInfoType(types uint64, it IteratorCommandInfoType) bool

IteratorTypesIsOtherIteratorCommandInfoType checks whether an other type than "it" is present in types.

func IteratorTypesSetAll

func IteratorTypesSetAll(types uint64, its ...IteratorCommandInfoType) uint64

func IteratorTypesSetIteratorCommandInfoType

func IteratorTypesSetIteratorCommandInfoType(types uint64, it IteratorCommandInfoType) uint64

IteratorTypesSetIteratorCommandInfoType set "it" as the types, all other types are cleared. The new types are returned.

func IteratorTypesUnsetIteratorCommandInfoType

func IteratorTypesUnsetIteratorCommandInfoType(types uint64, it IteratorCommandInfoType) uint64

IteratorTypesUnsetIteratorCommandInfoType removes "it" from types, all other types stay the same. The new types are returned.

func NewErrCommandTypeAtIdx

func NewErrCommandTypeAtIdx(wrongCommandType string, idx int) *DefaultError

NewErrCommandTypeAtIdx allocates a new DefaultError with code uint32(KVErrorCode_WrongCommandType).

func NewErrContextNotFound

func NewErrContextNotFound(wrongContextName string) *DefaultError

NewErrContextNotFound allocates a new DefaultError with code uint32(KVErrorCode_ContextNotFound).

func NewErrContextNotFoundAtElemIdx

func NewErrContextNotFoundAtElemIdx(wrongContextName string, idx int) *DefaultError

NewErrContextNotFoundAtElemIdx allocates a new DefaultError with code uint32(KVErrorCode_ContextNotFound).

func NewErrIteratorTypesInvalid

func NewErrIteratorTypesInvalid(types uint64, expectedTypes ...IteratorCommandInfoType) *DefaultError

NewErrIteratorTypesInvalid allocates a new DefaultError with code uint32(KVErrorCode_IteratorTypesInvalid).

func NewErrKeyInvalid

func NewErrKeyInvalid(what string, value uint64) *DefaultError

NewErrReadaheadInvalid allocates a new DefaultError with code uint32(KVErrorCode_KeyInvalid).

func NewErrReadaheadInvalid

func NewErrReadaheadInvalid(what string, value uint64) *DefaultError

NewErrReadaheadInvalid allocates a new DefaultError with code uint32(KVErrorCode_ReadaheadInvalid).

Types

type CFHandle

type CFHandle interface {
	UnderlyingHandle() interface{}
	Name() string
	Get(key []byte) (value []byte, err error)
	GetMulti(keys [][]byte) (values [][]byte, err error)

	// Iterator creates and allocates a new KVIndexedBulkIterator
	// with the given elems as basis, the implementation is dependent
	// on the underlying store.
	Iterator(
		sortOrder goiterator.IteratorSortOrder,
		readaheadLimitByteSize uint64,
		readaheadLimitCnt uint64,
		elems ...IteratorElementInfo) goiterator.KVIndexedBulkIterator

	PutToWriteBatch(key, value []byte, batch WriteBatch) (err error)
	PutMultiToWriteBatch(keys, values [][]byte, batch WriteBatch) (err error)

	DeleteToWriteBatch(key []byte, batch WriteBatch) (err error)
	DeleteMultiToWriteBatch(keys [][]byte, batch WriteBatch) (err error)
	DeleteBetweenToWriteBatch(
		begKey, endKey []byte, returnDeletedKeys bool, batch WriteBatch) (deletedKeys [][]byte, err error)
}

func ColumnFamilyHandleByContextName

func ColumnFamilyHandleByContextName(
	handles []CFHandle,
	contextName string,
) (handle CFHandle, id int)

ColumnFamilyHandleByContextName searches a ColumnFamilyHandle by name considering a potential index, preceded by ContextNameIndexPrefix.

type CFKeys

type CFKeys struct {
	CF   CFHandle
	Keys [][]byte
}

CFKeys defines certain keys for a single CFHandle.

type CFKeysValues

type CFKeysValues struct {
	CF     CFHandle
	Keys   [][]byte
	Values [][]byte
}

CFKeysValues defines certain keys and values for a single CFHandle.

type CommandHandle

type CommandHandle interface {
	MarshalSerializer
	ErrorsProvider

	// KVCommandType returns the KVCommandType of the CommandHandle.
	KVCommandType() KVCommandType

	// Reset, resets the CommandHandle for reuse.
	// Currently not tested, allocate new objects to be sure.
	Reset()
}

CommandHandle defines a basic command. All handles must implement this interface. MarshalSerializer is used for communication between processes. But both the sending and receiving process might overwrite this method and use its own implementation.

type ContextSetting

type ContextSetting struct {
	Path   string            `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
	Params map[string]string `` /* 146-byte string literal not displayed */
}

ContextSetting defines the settings for a context. Context here can be defined as a table / column family / bucket ... .

func (*ContextSetting) Descriptor

func (*ContextSetting) Descriptor() ([]byte, []int)

func (*ContextSetting) GetParams

func (m *ContextSetting) GetParams() map[string]string

func (*ContextSetting) Marshal

func (m *ContextSetting) Marshal() (dAtA []byte, err error)

func (*ContextSetting) MarshalTo

func (m *ContextSetting) MarshalTo(dAtA []byte) (int, error)

func (*ContextSetting) ProtoMessage

func (*ContextSetting) ProtoMessage()

func (*ContextSetting) Reset

func (m *ContextSetting) Reset()

func (*ContextSetting) Size

func (m *ContextSetting) Size() (n int)

func (*ContextSetting) String

func (m *ContextSetting) String() string

func (*ContextSetting) Unmarshal

func (m *ContextSetting) Unmarshal(dAtA []byte) error

type DeleteCommand

type DeleteCommand struct {
	Elems   []DeleteElement `protobuf:"bytes,1,rep,name=elems" json:"elems"`
	Timeout int64           `protobuf:"varint,2,opt,name=timeout,proto3" json:"timeout,omitempty"`
	// contextPath is implementation dependent and could be DB or DB/table, DSN etc.
	ContextPath string `protobuf:"bytes,3,opt,name=contextPath,proto3" json:"contextPath,omitempty"`
	Sync        bool   `protobuf:"varint,4,opt,name=sync,proto3" json:"sync,omitempty"`
}

DeleteCommand is used to define a delete action on a store.

func (*DeleteCommand) Descriptor

func (*DeleteCommand) Descriptor() ([]byte, []int)

func (*DeleteCommand) GetElems

func (m *DeleteCommand) GetElems() []DeleteElement

func (*DeleteCommand) Marshal

func (m *DeleteCommand) Marshal() (dAtA []byte, err error)

func (*DeleteCommand) MarshalTo

func (m *DeleteCommand) MarshalTo(dAtA []byte) (int, error)

func (*DeleteCommand) ProtoMessage

func (*DeleteCommand) ProtoMessage()

func (*DeleteCommand) Reset

func (m *DeleteCommand) Reset()

func (*DeleteCommand) Size

func (m *DeleteCommand) Size() (n int)

func (*DeleteCommand) String

func (m *DeleteCommand) String() string

func (*DeleteCommand) Unmarshal

func (m *DeleteCommand) Unmarshal(dAtA []byte) error

type DeleteCommandHandle

type DeleteCommandHandle interface {
	WriteCommandHandle
	DeleteCommand() *DeleteCommand
	SetDeletedKeys(deletedKeys [][]byte)
}

type DeleteCommandResponse

type DeleteCommandResponse struct {
	Response    `protobuf:"bytes,1,opt,name=response,embedded=response" json:"response"`
	DeletedKeys [][]byte          `protobuf:"bytes,2,rep,name=deletedKeys" json:"deletedKeys,omitempty"`
	EventID     uint64            `protobuf:"varint,3,opt,name=eventID,proto3" json:"eventID,omitempty"`
	Params      map[string]string `` /* 146-byte string literal not displayed */
}

DeleteCommandResponse is the response for a DeleteCommand.

func (*DeleteCommandResponse) Descriptor

func (*DeleteCommandResponse) Descriptor() ([]byte, []int)

func (*DeleteCommandResponse) GetParams

func (m *DeleteCommandResponse) GetParams() map[string]string

func (*DeleteCommandResponse) Marshal

func (m *DeleteCommandResponse) Marshal() (dAtA []byte, err error)

func (*DeleteCommandResponse) MarshalTo

func (m *DeleteCommandResponse) MarshalTo(dAtA []byte) (int, error)

func (*DeleteCommandResponse) ProtoMessage

func (*DeleteCommandResponse) ProtoMessage()

func (*DeleteCommandResponse) Reset

func (m *DeleteCommandResponse) Reset()

func (*DeleteCommandResponse) Size

func (m *DeleteCommandResponse) Size() (n int)

func (*DeleteCommandResponse) String

func (m *DeleteCommandResponse) String() string

func (*DeleteCommandResponse) Unmarshal

func (m *DeleteCommandResponse) Unmarshal(dAtA []byte) error

type DeleteCommandType

type DeleteCommandType int32

DeleteCommandType defines the type of a delete for each element of a DeleteCommand.

const (
	DeleteCommandType_DeleteKey   DeleteCommandType = 0
	DeleteCommandType_DeleteRange DeleteCommandType = 1
)

func (DeleteCommandType) EnumDescriptor

func (DeleteCommandType) EnumDescriptor() ([]byte, []int)

func (DeleteCommandType) String

func (x DeleteCommandType) String() string

type DeleteElement

type DeleteElement struct {
	ContextPath       string            `protobuf:"bytes,1,opt,name=contextPath,proto3" json:"contextPath,omitempty"`
	DeleteCommandType DeleteCommandType `protobuf:"varint,2,opt,name=deleteCommandType,proto3,enum=gokvstore.DeleteCommandType" json:"deleteCommandType,omitempty"`
	Keys              [][]byte          `protobuf:"bytes,3,rep,name=keys" json:"keys,omitempty"`
	EndKeys           [][]byte          `protobuf:"bytes,4,rep,name=endKeys" json:"endKeys,omitempty"`
	ReturnDeletedKeys bool              `protobuf:"varint,5,opt,name=returnDeletedKeys,proto3" json:"returnDeletedKeys,omitempty"`
}

DeleteElement is an element used by DeleteCommand. Multiple elements might be "chained".

func (*DeleteElement) Descriptor

func (*DeleteElement) Descriptor() ([]byte, []int)

func (*DeleteElement) Marshal

func (m *DeleteElement) Marshal() (dAtA []byte, err error)

func (*DeleteElement) MarshalTo

func (m *DeleteElement) MarshalTo(dAtA []byte) (int, error)

func (*DeleteElement) ProtoMessage

func (*DeleteElement) ProtoMessage()

func (*DeleteElement) Reset

func (m *DeleteElement) Reset()

func (*DeleteElement) Size

func (m *DeleteElement) Size() (n int)

func (*DeleteElement) String

func (m *DeleteElement) String() string

func (*DeleteElement) Unmarshal

func (m *DeleteElement) Unmarshal(dAtA []byte) error

type DirectIterateStore

type DirectIterateStore interface {
	StoreContextProvider
	// CreateIterator creates a new iterator for the handle.
	CreateIterator(handle IteratorQueryHandle)
	// ModifyIterator modifies the handle iterator if necessary.
	ModifyIterator(handle IteratorQueryHandle)
}

type DirectIteratorQueryStore

type DirectIteratorQueryStore interface {
	Iterate(handle IteratorQueryHandle)
}

type DirectKVCommandStore

type DirectKVCommandStore interface {
	// Put inserts the handles elements into the store.
	Put(handle PutCommandHandle)
	// Delete removes the handles elements from the store.
	Delete(handle DeleteCommandHandle)
	// Pipelined tries to run multiple commands in row.
	Pipelined(handle PipelineCommandHandle)
}

type DirectKVQueryStore

type DirectKVQueryStore interface {
	// Get applies the handle on the store.
	// On success the resulting values of the handles keys
	// are stored int the handles ResponseData.
	Get(handle GetQueryHandle)
	// Iterate applies the handle on the store.
	// On success the resulting key value pairs
	// are stored int the handles ResponseData.
	Iterate(handle IteratorQueryHandle)
	// GetSettings gets the stores settings according to the handle query.
	GetSettings(handle SettingsQueryHandle)
}

type DirectKVRequestProviderStore

type DirectKVRequestProviderStore interface {
	StoreContextProvider
	DirectKVRequestStore
}

type DirectKVRequestStore

type DirectKVRequestStore interface {
	DirectKVQueryStore
	DirectKVCommandStore
}

type DirectKVStore

DirectKVStore the direct version of the KVStore writes data to and reads data from the a store via CommandHandle(s).

type DirectSettingsProviderStore

type DirectSettingsProviderStore interface {
	StoreContextProvider
	// GetSettings gets the settings of the store.
	GetSettings(handle SettingsQueryHandle)
}

type GetElement

type GetElement struct {
	// contextPath is implementation dependent and could be DB or DB/table, DSN etc.
	// if no contextPath is given, the one of the request is taken.
	ContextPath string   `protobuf:"bytes,1,opt,name=contextPath,proto3" json:"contextPath,omitempty"`
	Keys        [][]byte `protobuf:"bytes,2,rep,name=keys" json:"keys,omitempty"`
}

GetElement is an element used by GetQuery. Multiple elements might be "chained".

func (*GetElement) Descriptor

func (*GetElement) Descriptor() ([]byte, []int)

func (*GetElement) Marshal

func (m *GetElement) Marshal() (dAtA []byte, err error)

func (*GetElement) MarshalTo

func (m *GetElement) MarshalTo(dAtA []byte) (int, error)

func (*GetElement) ProtoMessage

func (*GetElement) ProtoMessage()

func (*GetElement) Reset

func (m *GetElement) Reset()

func (*GetElement) Size

func (m *GetElement) Size() (n int)

func (*GetElement) String

func (m *GetElement) String() string

func (*GetElement) Unmarshal

func (m *GetElement) Unmarshal(dAtA []byte) error

type GetQuery

type GetQuery struct {
	Elems           []GetElement    `protobuf:"bytes,1,rep,name=elems" json:"elems"`
	GetReturnFormat GetReturnFormat `protobuf:"varint,2,opt,name=getReturnFormat,proto3,enum=gokvstore.GetReturnFormat" json:"getReturnFormat,omitempty"`
	// contextPath is implementation dependent and could be DB or DB/table etc.
	ContextPath string `protobuf:"bytes,3,opt,name=contextPath,proto3" json:"contextPath,omitempty"`
	WithEmpty   bool   `protobuf:"varint,4,opt,name=withEmpty,proto3" json:"withEmpty,omitempty"`
}

GetQuery is used to define a get action on a store.

func (*GetQuery) Descriptor

func (*GetQuery) Descriptor() ([]byte, []int)

func (*GetQuery) GetElems

func (m *GetQuery) GetElems() []GetElement

func (*GetQuery) Marshal

func (m *GetQuery) Marshal() (dAtA []byte, err error)

func (*GetQuery) MarshalTo

func (m *GetQuery) MarshalTo(dAtA []byte) (int, error)

func (*GetQuery) ProtoMessage

func (*GetQuery) ProtoMessage()

func (*GetQuery) Reset

func (m *GetQuery) Reset()

func (*GetQuery) Size

func (m *GetQuery) Size() (n int)

func (*GetQuery) String

func (m *GetQuery) String() string

func (*GetQuery) Unmarshal

func (m *GetQuery) Unmarshal(dAtA []byte) error

type GetQueryHandle

type GetQueryHandle interface {
	CommandHandle
	LargeCommandInfo
	ResponseData() goiterator.PositionedDataBuffer
	SetResponseData(resData goiterator.PositionedDataBuffer)
	GetQuery() *GetQuery
}

type GetQueryResponse

type GetQueryResponse struct {
	Response `protobuf:"bytes,1,opt,name=response,embedded=response" json:"response"`
	Params   map[string]string `` /* 146-byte string literal not displayed */
}

GetQueryResponse is a possible response for a GetQuery.

func (*GetQueryResponse) Descriptor

func (*GetQueryResponse) Descriptor() ([]byte, []int)

func (*GetQueryResponse) GetParams

func (m *GetQueryResponse) GetParams() map[string]string

func (*GetQueryResponse) Marshal

func (m *GetQueryResponse) Marshal() (dAtA []byte, err error)

func (*GetQueryResponse) MarshalTo

func (m *GetQueryResponse) MarshalTo(dAtA []byte) (int, error)

func (*GetQueryResponse) ProtoMessage

func (*GetQueryResponse) ProtoMessage()

func (*GetQueryResponse) Reset

func (m *GetQueryResponse) Reset()

func (*GetQueryResponse) Size

func (m *GetQueryResponse) Size() (n int)

func (*GetQueryResponse) String

func (m *GetQueryResponse) String() string

func (*GetQueryResponse) Unmarshal

func (m *GetQueryResponse) Unmarshal(dAtA []byte) error

type GetReturnFormat

type GetReturnFormat int32

GetReturnFormat defines the format for the values returned by GetQuery.

const (
	GetReturnFormat_OmitEmpty GetReturnFormat = 0
	GetReturnFormat_AddEmpty  GetReturnFormat = 1
)

func (GetReturnFormat) EnumDescriptor

func (GetReturnFormat) EnumDescriptor() ([]byte, []int)

func (GetReturnFormat) String

func (x GetReturnFormat) String() string

type IteratorCommandInfoType

type IteratorCommandInfoType int32

IteratorCommandInfoType is the type of the iterator command. Multiple might be applicable at once.

const (
	IteratorCommandInfoType_None        IteratorCommandInfoType = 0
	IteratorCommandInfoType_SeekToFirst IteratorCommandInfoType = 1
	IteratorCommandInfoType_SeekToLast  IteratorCommandInfoType = 2
	IteratorCommandInfoType_Seek        IteratorCommandInfoType = 3
	IteratorCommandInfoType_SeekForPrev IteratorCommandInfoType = 4
	IteratorCommandInfoType_Next        IteratorCommandInfoType = 5
	IteratorCommandInfoType_Prev        IteratorCommandInfoType = 6
	IteratorCommandInfoType_Close       IteratorCommandInfoType = 7
	IteratorCommandInfoType_ReplayStart IteratorCommandInfoType = 8
	IteratorCommandInfoType_ReplayStop  IteratorCommandInfoType = 9
)

func IteratorCommandInfoSeekTypes

func IteratorCommandInfoSeekTypes() (types []IteratorCommandInfoType)

IteratorCommandInfoSeekTypes returns all IteratorCommandInfoTypes with a _Seek.. prefix.

func (IteratorCommandInfoType) EnumDescriptor

func (IteratorCommandInfoType) EnumDescriptor() ([]byte, []int)

func (IteratorCommandInfoType) String

func (x IteratorCommandInfoType) String() string

type IteratorCommandInfoTypes

type IteratorCommandInfoTypes struct {
	IteratorCommandInfoType []IteratorCommandInfoType `` /* 139-byte string literal not displayed */
}

IteratorCommandInfoTypes a list / slice of IteratorCommandInfoType.

func (*IteratorCommandInfoTypes) Descriptor

func (*IteratorCommandInfoTypes) Descriptor() ([]byte, []int)

func (*IteratorCommandInfoTypes) Marshal

func (m *IteratorCommandInfoTypes) Marshal() (dAtA []byte, err error)

func (*IteratorCommandInfoTypes) MarshalTo

func (m *IteratorCommandInfoTypes) MarshalTo(dAtA []byte) (int, error)

func (*IteratorCommandInfoTypes) ProtoMessage

func (*IteratorCommandInfoTypes) ProtoMessage()

func (*IteratorCommandInfoTypes) Reset

func (m *IteratorCommandInfoTypes) Reset()

func (*IteratorCommandInfoTypes) Size

func (m *IteratorCommandInfoTypes) Size() (n int)

func (*IteratorCommandInfoTypes) String

func (m *IteratorCommandInfoTypes) String() string

func (*IteratorCommandInfoTypes) Unmarshal

func (m *IteratorCommandInfoTypes) Unmarshal(dAtA []byte) error

type IteratorElement

type IteratorElement struct {
	IteratorElementInfo `protobuf:"bytes,1,opt,name=IteratorElementInfo,embedded=IteratorElementInfo" json:"IteratorElementInfo"`
}

IteratorElement is an element used by IteratorQuery. Multiple elements might be "chained".

func (*IteratorElement) Descriptor

func (*IteratorElement) Descriptor() ([]byte, []int)

func (*IteratorElement) Marshal

func (m *IteratorElement) Marshal() (dAtA []byte, err error)

func (*IteratorElement) MarshalTo

func (m *IteratorElement) MarshalTo(dAtA []byte) (int, error)

func (*IteratorElement) ProtoMessage

func (*IteratorElement) ProtoMessage()

func (*IteratorElement) Reset

func (m *IteratorElement) Reset()

func (*IteratorElement) Size

func (m *IteratorElement) Size() (n int)

func (*IteratorElement) String

func (m *IteratorElement) String() string

func (*IteratorElement) Unmarshal

func (m *IteratorElement) Unmarshal(dAtA []byte) error

type IteratorElementInfo

type IteratorElementInfo struct {
	// contextPath is implementation dependent and could be DB or DB/table, DSN etc.
	ContextPath string `protobuf:"bytes,1,opt,name=contextPath,proto3" json:"contextPath,omitempty"`
	// beginKey is the key which is seeked to when Seek or SeekForPrev is set, it is GTE (>=) or LTE (<=).
	// if not set, the parent beginKey will be used.
	BeginKey []byte `protobuf:"bytes,2,opt,name=beginKey,proto3" json:"beginKey,omitempty"`
	// limitKey is the last key used by the source iterator and is LT (<)
	// the key which is used at max, requires an explicit comparator or implementation.
	// if not set, the parent limitKey will be used.
	LimitKey []byte `protobuf:"bytes,3,opt,name=limitKey,proto3" json:"limitKey,omitempty"`
	// how often should be iterated from the lastKey to be on right key
	// if not set, the parent beginKeyOffsCnt will be used.
	BeginKeyOffsCnt uint64 `protobuf:"varint,4,opt,name=beginKeyOffsCnt,proto3" json:"beginKeyOffsCnt,omitempty"`
}

IteratorElementInfo it the basic information of an IteratorElement.

func IteratorElementInfosFromTopicIDs

func IteratorElementInfosFromTopicIDs(topicIDs []event.TopicID) (elems []IteratorElementInfo)

func (*IteratorElementInfo) Descriptor

func (*IteratorElementInfo) Descriptor() ([]byte, []int)

func (*IteratorElementInfo) Marshal

func (m *IteratorElementInfo) Marshal() (dAtA []byte, err error)

func (*IteratorElementInfo) MarshalTo

func (m *IteratorElementInfo) MarshalTo(dAtA []byte) (int, error)

func (*IteratorElementInfo) ProtoMessage

func (*IteratorElementInfo) ProtoMessage()

func (*IteratorElementInfo) Reset

func (m *IteratorElementInfo) Reset()

func (*IteratorElementInfo) Size

func (m *IteratorElementInfo) Size() (n int)

func (*IteratorElementInfo) String

func (m *IteratorElementInfo) String() string

func (*IteratorElementInfo) Unmarshal

func (m *IteratorElementInfo) Unmarshal(dAtA []byte) error

type IteratorQuery

type IteratorQuery struct {
	IteratorElementInfo `protobuf:"bytes,1,opt,name=IteratorElementInfo,embedded=IteratorElementInfo" json:"IteratorElementInfo"`
	// returnFormat is an implementation specific format.
	ReturnFormat uint64 `protobuf:"varint,2,opt,name=returnFormat,proto3" json:"returnFormat,omitempty"`
	// iteratorID will be set on the first IteratorCommand
	IteratorID uint64 `protobuf:"varint,3,opt,name=iteratorID,proto3" json:"iteratorID,omitempty"`
	// iteratorTypes is a bitfield of IteratorCommandInfoType.
	IteratorTypes uint64 `protobuf:"varint,4,opt,name=iteratorTypes,proto3" json:"iteratorTypes,omitempty"`
	Direction     uint64 `protobuf:"varint,5,opt,name=direction,proto3" json:"direction,omitempty"`
	// timeoutDurationMs specifies the timeout duration of the iterator in milliseconds.
	TimeoutDurationMs int64 `protobuf:"varint,6,opt,name=timeoutDurationMs,proto3" json:"timeoutDurationMs,omitempty"`
	// keyPrefix specifies the prefix which might be used for the iterator.
	KeyPrefix []byte `protobuf:"bytes,7,opt,name=keyPrefix,proto3" json:"keyPrefix,omitempty"`
	// keySuffix specifies the prefix which might be used for the iterator.
	KeySuffix []byte `protobuf:"bytes,8,opt,name=keySuffix,proto3" json:"keySuffix,omitempty"`
	// keyType is an implementation specific key type.
	KeyType                string                       `protobuf:"bytes,9,opt,name=keyType,proto3" json:"keyType,omitempty"`
	Elems                  []IteratorElementInfo        `protobuf:"bytes,11,rep,name=elems" json:"elems"`
	ReadaheadLimitKey      []byte                       `protobuf:"bytes,12,opt,name=readaheadLimitKey,proto3" json:"readaheadLimitKey,omitempty"`
	ReadaheadByteSize      uint64                       `protobuf:"varint,13,opt,name=readaheadByteSize,proto3" json:"readaheadByteSize,omitempty"`
	ReadaheadLimitByteSize uint64                       `protobuf:"varint,14,opt,name=readaheadLimitByteSize,proto3" json:"readaheadLimitByteSize,omitempty"`
	ReadaheadLimitCnt      uint64                       `protobuf:"varint,15,opt,name=readaheadLimitCnt,proto3" json:"readaheadLimitCnt,omitempty"`
	IteratorSortOrder      goiterator.IteratorSortOrder `protobuf:"varint,16,opt,name=IteratorSortOrder,proto3,enum=goiterator.IteratorSortOrder" json:"IteratorSortOrder,omitempty"`
	IsTailing              bool                         `protobuf:"varint,17,opt,name=isTailing,proto3" json:"isTailing,omitempty"`
	ReplaySetting          *ReplaySetting               `protobuf:"bytes,18,opt,name=replaySetting" json:"replaySetting,omitempty"`
	Params                 map[string]string            `` /* 147-byte string literal not displayed */
	Extension              []byte                       `protobuf:"bytes,20,opt,name=extension,proto3" json:"extension,omitempty"`
}

IteratorQuery is used to create seek and modify an iterator on the store.

func (*IteratorQuery) AddIteratorCommandInfoType

func (self *IteratorQuery) AddIteratorCommandInfoType(it IteratorCommandInfoType)

AddIteratorCommandInfoType adds "it" to the own IteratorTypes.

func (*IteratorQuery) Descriptor

func (*IteratorQuery) Descriptor() ([]byte, []int)

func (*IteratorQuery) GetElems

func (m *IteratorQuery) GetElems() []IteratorElementInfo

func (*IteratorQuery) GetParams

func (m *IteratorQuery) GetParams() map[string]string

func (*IteratorQuery) GetReplaySetting

func (m *IteratorQuery) GetReplaySetting() *ReplaySetting

func (*IteratorQuery) IsIteratorCommandInfoType

func (self *IteratorQuery) IsIteratorCommandInfoType(it IteratorCommandInfoType) bool

IsIteratorCommandInfoType checks whether "it" is present in the own IteratorTypes.

func (*IteratorQuery) IsOtherIteratorCommandInfoType

func (self *IteratorQuery) IsOtherIteratorCommandInfoType(it IteratorCommandInfoType) bool

IsIteratorCommandInfoType checks whether an other type than "it" is present in the own IteratorTypes.

func (*IteratorQuery) Marshal

func (m *IteratorQuery) Marshal() (dAtA []byte, err error)

func (*IteratorQuery) MarshalTo

func (m *IteratorQuery) MarshalTo(dAtA []byte) (int, error)

func (*IteratorQuery) ProtoMessage

func (*IteratorQuery) ProtoMessage()

func (*IteratorQuery) Reset

func (m *IteratorQuery) Reset()

func (*IteratorQuery) SetIteratorCommandInfoType

func (self *IteratorQuery) SetIteratorCommandInfoType(it IteratorCommandInfoType)

AddIteratorCommandInfoType set "it" as the own IteratorTypes, all other types are cleared.

func (*IteratorQuery) Size

func (m *IteratorQuery) Size() (n int)

func (*IteratorQuery) String

func (m *IteratorQuery) String() string

func (*IteratorQuery) Unmarshal

func (m *IteratorQuery) Unmarshal(dAtA []byte) error

func (*IteratorQuery) UnsetIteratorCommandInfoType

func (self *IteratorQuery) UnsetIteratorCommandInfoType(it IteratorCommandInfoType)

UnsetIteratorCommandInfoType removes "it" from the own IteratorTypes, all other types stay the same.

type IteratorQueryHandle

type IteratorQueryHandle interface {
	CommandHandle
	LargeCommandInfo
	ResponseData() goiterator.PositionedDataBuffer
	SetResponseData(resData goiterator.PositionedDataBuffer)
	UnderlyingIteratorHandle() (itr goiterator.KVBulkIterator)
	SetUnderlyingIteratorHandle(itr goiterator.KVBulkIterator)
	IteratorQuery() *IteratorQuery
}

type IteratorQueryResponse

type IteratorQueryResponse struct {
	Response   `protobuf:"bytes,1,opt,name=response,embedded=response" json:"response"`
	IteratorID uint64            `protobuf:"varint,2,opt,name=iteratorID,proto3" json:"iteratorID,omitempty"`
	LastKey    []byte            `protobuf:"bytes,3,opt,name=lastKey,proto3" json:"lastKey,omitempty"`
	Params     map[string]string `` /* 146-byte string literal not displayed */
}

IteratorResponse in binary representation is followed by a KVEventBuffer of data.

func (*IteratorQueryResponse) Descriptor

func (*IteratorQueryResponse) Descriptor() ([]byte, []int)

func (*IteratorQueryResponse) GetParams

func (m *IteratorQueryResponse) GetParams() map[string]string

func (*IteratorQueryResponse) Marshal

func (m *IteratorQueryResponse) Marshal() (dAtA []byte, err error)

func (*IteratorQueryResponse) MarshalTo

func (m *IteratorQueryResponse) MarshalTo(dAtA []byte) (int, error)

func (*IteratorQueryResponse) ProtoMessage

func (*IteratorQueryResponse) ProtoMessage()

func (*IteratorQueryResponse) Reset

func (m *IteratorQueryResponse) Reset()

func (*IteratorQueryResponse) Size

func (m *IteratorQueryResponse) Size() (n int)

func (*IteratorQueryResponse) String

func (m *IteratorQueryResponse) String() string

func (*IteratorQueryResponse) Unmarshal

func (m *IteratorQueryResponse) Unmarshal(dAtA []byte) error

type KVCommandStore

type KVCommandStore interface {
	DirectKVCommandStore
	// PutKey puts the value for the key.
	PutKey(key, value []byte, cf CFHandle) (err error)
	// PutMulti puts the values for the keys.
	// If possible atomically.
	PutMulti(cfKeysValues ...CFKeysValues) (err error)
	// DeleteKey deletes the value associated with the key.
	DeleteKey(key []byte, cf CFHandle) (err error)
	// DeleteMulti deletes the valuse associated with the keys.
	// If possible atomically.
	DeleteMulti(cfKeys ...CFKeys) (err error)
}

KVCommandStore is the primary wrapper to write data to a store / storage.

type KVCommandType

type KVCommandType int32
const (
	KVCommandType_KVEcho            KVCommandType = 0
	KVCommandType_KVPing            KVCommandType = 1
	KVCommandType_KVPong            KVCommandType = 2
	KVCommandType_KVStatusQuery     KVCommandType = 3
	KVCommandType_KVGetQuery        KVCommandType = 4
	KVCommandType_KVIteratorQuery   KVCommandType = 5
	KVCommandType_KVPutCommand      KVCommandType = 11
	KVCommandType_KVDeleteCommand   KVCommandType = 12
	KVCommandType_KVSettingsCommand KVCommandType = 21
	KVCommandType_KVSettingsQuery   KVCommandType = 22
	// KVPipeline can pipeline more commands
	KVCommandType_KVPipeline KVCommandType = 31
)

func (KVCommandType) EnumDescriptor

func (KVCommandType) EnumDescriptor() ([]byte, []int)

func (KVCommandType) String

func (x KVCommandType) String() string

type KVErrorCode

type KVErrorCode int32

KVErrorCode defines the error codes for the gokvstore package.

const (
	KVErrorCode_WrongCommandType             KVErrorCode = 0
	KVErrorCode_WrongPipelineCommandType     KVErrorCode = 1
	KVErrorCode_ContextNotFound              KVErrorCode = 2
	KVErrorCode_DeleteRangeOverlap           KVErrorCode = 3
	KVErrorCode_DeleteRangeKeyCountsNotMatch KVErrorCode = 4
	KVErrorCode_IteratorTypesInvalid         KVErrorCode = 5
	KVErrorCode_ReadaheadInvalid             KVErrorCode = 6
	KVErrorCode_NotWritable                  KVErrorCode = 7
	KVErrorCode_KeyInvalid                   KVErrorCode = 8
)

func (KVErrorCode) EnumDescriptor

func (KVErrorCode) EnumDescriptor() ([]byte, []int)

func (KVErrorCode) String

func (x KVErrorCode) String() string

type KVQueryCommandStore

type KVQueryCommandStore interface {
	StoreContextProvider
	KVQueryStore
	KVCommandStore
}

KVQueryCommandStore is the primary wrapper to write data to and read data from a store / storage.

type KVQueryStore

type KVQueryStore interface {
	DirectKVQueryStore
	// Get returns the value associated with the key of the given cf.
	GetKey(key []byte, cf CFHandle) (value []byte, err error)
	// GetMulti returns the values associated with the keys of the given cfs.
	// Keys which are not found are returned as empty slice.
	// The returned result is not thread safe and if you use its
	// Keys or Values further, you have to copy these to new slices.
	GetMulti(cfKeys ...CFKeys) (result goiterator.KVKVForwardResultIterator, err error)
	// Iterator creates and allocates a new KVBulkIterator
	// with the given elems as basis, the implementation is dependent
	// on the underlying store.
	// if multiple elems are specified other cfs might be used as well.
	Iterator(
		cf CFHandle,
		sortOrder goiterator.IteratorSortOrder,
		readaheadLimitByteSize uint64,
		readaheadLimitCnt uint64,
		elems ...IteratorElementInfo) goiterator.KVIndexedBulkIterator
}

KVQueryStore is the primary wrapper to read data from a store / storage.

type KVStore

type KVStore interface {
	StoreContextProvider
}

KVStore is the primary wrapper to write data to and read data from a store / storage via CFHandles.

type LargeCommandInfo

type LargeCommandInfo interface {
	// PreDataPadByteSize returns the byte size of the pad before the data set later
	// via SetResponseData.
	PreDataPadByteSize() (size uint64)
	// PostDataPadByteSize returns the byte size of the pad after the data set later
	// via SetResponseData.
	PostDataPadByteSize() (size uint64)
}

LargeCommandInfo.

type LoggingDirectKVRequestStore

type LoggingDirectKVRequestStore struct {
}

LoggingDirectKVRequestStore implements a DirectKVRequestStore which only logs the methods.

func (*LoggingDirectKVRequestStore) Delete

func (self *LoggingDirectKVRequestStore) Delete(handle DeleteCommandHandle)

func (*LoggingDirectKVRequestStore) Get

func (self *LoggingDirectKVRequestStore) Get(handle GetQueryHandle)

func (*LoggingDirectKVRequestStore) GetSettings

func (self *LoggingDirectKVRequestStore) GetSettings(handle SettingsQueryHandle)

func (*LoggingDirectKVRequestStore) Iterate

func (self *LoggingDirectKVRequestStore) Iterate(handle IteratorQueryHandle)

func (*LoggingDirectKVRequestStore) Pipelined

func (self *LoggingDirectKVRequestStore) Pipelined(handle PipelineCommandHandle)

func (*LoggingDirectKVRequestStore) Put

type PipelineCommandHandle

type PipelineCommandHandle interface {
	WriteCommandHandle
	PipelinedCommand() *PipelinedCommand
	PipelinedCommandResponse() *PipelinedCommandResponse
	CommandHandles() (handles []CommandHandle)
	SetCommandHandles(handles ...CommandHandle) (err error)
	// ConcurrencyHint returns the number of threads / routines to be used for processing
	// the pipeline command. Its only a hint and might be ignored.
	ConcurrencyHint() uint64
}

type PipelinedCommand

type PipelinedCommand struct {
	CommandTypes []KVCommandType `protobuf:"varint,1,rep,packed,name=commandTypes,enum=gokvstore.KVCommandType" json:"commandTypes,omitempty"`
	Commands     [][]byte        `protobuf:"bytes,2,rep,name=commands" json:"commands,omitempty"`
	// concurrencyHint may be accepted or not.
	// it, for example can tell how many threads or routines
	// should be used.
	ConcurrencyHint uint64 `protobuf:"varint,3,opt,name=concurrencyHint,proto3" json:"concurrencyHint,omitempty"`
	Sync            bool   `protobuf:"varint,4,opt,name=sync,proto3" json:"sync,omitempty"`
}

PipelinedCommand is used to define multiple (write) actions on a store.

func (*PipelinedCommand) Descriptor

func (*PipelinedCommand) Descriptor() ([]byte, []int)

func (*PipelinedCommand) Marshal

func (m *PipelinedCommand) Marshal() (dAtA []byte, err error)

func (*PipelinedCommand) MarshalTo

func (m *PipelinedCommand) MarshalTo(dAtA []byte) (int, error)

func (*PipelinedCommand) ProtoMessage

func (*PipelinedCommand) ProtoMessage()

func (*PipelinedCommand) Reset

func (m *PipelinedCommand) Reset()

func (*PipelinedCommand) Size

func (m *PipelinedCommand) Size() (n int)

func (*PipelinedCommand) String

func (m *PipelinedCommand) String() string

func (*PipelinedCommand) Unmarshal

func (m *PipelinedCommand) Unmarshal(dAtA []byte) error

type PipelinedCommandResponse

type PipelinedCommandResponse struct {
	Response     `protobuf:"bytes,1,opt,name=response,embedded=response" json:"response"`
	CommandTypes []KVCommandType `protobuf:"varint,2,rep,packed,name=commandTypes,enum=gokvstore.KVCommandType" json:"commandTypes,omitempty"`
	Commands     [][]byte        `protobuf:"bytes,3,rep,name=commands" json:"commands,omitempty"`
}

PipelinedCommandResponse is the response for a PipelinedCommand.

func (*PipelinedCommandResponse) Descriptor

func (*PipelinedCommandResponse) Descriptor() ([]byte, []int)

func (*PipelinedCommandResponse) Marshal

func (m *PipelinedCommandResponse) Marshal() (dAtA []byte, err error)

func (*PipelinedCommandResponse) MarshalTo

func (m *PipelinedCommandResponse) MarshalTo(dAtA []byte) (int, error)

func (*PipelinedCommandResponse) ProtoMessage

func (*PipelinedCommandResponse) ProtoMessage()

func (*PipelinedCommandResponse) Reset

func (m *PipelinedCommandResponse) Reset()

func (*PipelinedCommandResponse) Size

func (m *PipelinedCommandResponse) Size() (n int)

func (*PipelinedCommandResponse) String

func (m *PipelinedCommandResponse) String() string

func (*PipelinedCommandResponse) Unmarshal

func (m *PipelinedCommandResponse) Unmarshal(dAtA []byte) error

type PutCommand

type PutCommand struct {
	Elems       []PutElement `protobuf:"bytes,1,rep,name=elems" json:"elems"`
	CommandType uint64       `protobuf:"varint,2,opt,name=commandType,proto3" json:"commandType,omitempty"`
	Timeout     int64        `protobuf:"varint,3,opt,name=timeout,proto3" json:"timeout,omitempty"`
	// contextPath is implementation dependent and could be DB or DB/table, DSN etc.
	ContextPath string `protobuf:"bytes,4,opt,name=contextPath,proto3" json:"contextPath,omitempty"`
	Sync        bool   `protobuf:"varint,5,opt,name=sync,proto3" json:"sync,omitempty"`
	Sequential  bool   `protobuf:"varint,6,opt,name=sequential,proto3" json:"sequential,omitempty"`
	// deleteBetween can only be used if sequential is true
	// and means that elements(elems) are considered to be sequential
	// and that the data in the stroe between elems[0] and elems[len(elems)-1]
	// should be deleted ... if possible(allowed by) atomically together with
	// the inseration.
	DeleteBetween bool `protobuf:"varint,7,opt,name=deleteBetween,proto3" json:"deleteBetween,omitempty"`
	// useCommandContextPath if true the contextPath is used, otherwise each elements`
	// contextPath is used, or if sequential and false the first elems element`s is used
	UseCommandContextPath bool `protobuf:"varint,8,opt,name=useCommandContextPath,proto3" json:"useCommandContextPath,omitempty"`
}

PutCommand is used to define a put action on a store.

func (*PutCommand) Descriptor

func (*PutCommand) Descriptor() ([]byte, []int)

func (*PutCommand) GetElems

func (m *PutCommand) GetElems() []PutElement

func (*PutCommand) Marshal

func (m *PutCommand) Marshal() (dAtA []byte, err error)

func (*PutCommand) MarshalTo

func (m *PutCommand) MarshalTo(dAtA []byte) (int, error)

func (*PutCommand) ProtoMessage

func (*PutCommand) ProtoMessage()

func (*PutCommand) Reset

func (m *PutCommand) Reset()

func (*PutCommand) Size

func (m *PutCommand) Size() (n int)

func (*PutCommand) String

func (m *PutCommand) String() string

func (*PutCommand) Unmarshal

func (m *PutCommand) Unmarshal(dAtA []byte) error

type PutCommandHandle

type PutCommandHandle interface {
	WriteCommandHandle
	PutCommand() *PutCommand
	SetDeletedKeys(deletedKeys [][]byte)
}

type PutCommandResponse

type PutCommandResponse struct {
	Response    `protobuf:"bytes,1,opt,name=Response,embedded=Response" json:"Response"`
	DeletedKeys [][]byte `protobuf:"bytes,2,rep,name=deletedKeys" json:"deletedKeys,omitempty"`
	// eventID only for use with a supported eventstore.
	EventID uint64            `protobuf:"varint,3,opt,name=eventID,proto3" json:"eventID,omitempty"`
	Params  map[string]string `` /* 146-byte string literal not displayed */
}

PutCommandResponse is the response for a PutCommand.

func (*PutCommandResponse) Descriptor

func (*PutCommandResponse) Descriptor() ([]byte, []int)

func (*PutCommandResponse) GetParams

func (m *PutCommandResponse) GetParams() map[string]string

func (*PutCommandResponse) Marshal

func (m *PutCommandResponse) Marshal() (dAtA []byte, err error)

func (*PutCommandResponse) MarshalTo

func (m *PutCommandResponse) MarshalTo(dAtA []byte) (int, error)

func (*PutCommandResponse) ProtoMessage

func (*PutCommandResponse) ProtoMessage()

func (*PutCommandResponse) Reset

func (m *PutCommandResponse) Reset()

func (*PutCommandResponse) Size

func (m *PutCommandResponse) Size() (n int)

func (*PutCommandResponse) String

func (m *PutCommandResponse) String() string

func (*PutCommandResponse) Unmarshal

func (m *PutCommandResponse) Unmarshal(dAtA []byte) error

type PutElement

type PutElement struct {
	// contextPath is implementation dependent and could be DB or DB/table, DSN etc.
	// if no contextPath is given, the one of the request is taken.
	ContextPath       string   `protobuf:"bytes,1,opt,name=contextPath,proto3" json:"contextPath,omitempty"`
	Keys              [][]byte `protobuf:"bytes,2,rep,name=keys" json:"keys,omitempty"`
	Values            [][]byte `protobuf:"bytes,3,rep,name=values" json:"values,omitempty"`
	ReturnDeletedKeys bool     `protobuf:"varint,4,opt,name=returnDeletedKeys,proto3" json:"returnDeletedKeys,omitempty"`
}

PutElement is an element used by PutCommand. Multiple elements might be "chained".

func (*PutElement) Descriptor

func (*PutElement) Descriptor() ([]byte, []int)

func (*PutElement) Marshal

func (m *PutElement) Marshal() (dAtA []byte, err error)

func (*PutElement) MarshalTo

func (m *PutElement) MarshalTo(dAtA []byte) (int, error)

func (*PutElement) ProtoMessage

func (*PutElement) ProtoMessage()

func (*PutElement) Reset

func (m *PutElement) Reset()

func (*PutElement) Size

func (m *PutElement) Size() (n int)

func (*PutElement) String

func (m *PutElement) String() string

func (*PutElement) Unmarshal

func (m *PutElement) Unmarshal(dAtA []byte) error

type ReplaySetting

type ReplaySetting struct {
	ReplayTargetPath        string      `protobuf:"bytes,1,opt,name=replayTargetPath,proto3" json:"replayTargetPath,omitempty"`
	ReplayInterval          int64       `protobuf:"varint,2,opt,name=replayInterval,proto3" json:"replayInterval,omitempty"`
	ReplayIntervalVariation int64       `protobuf:"varint,3,opt,name=replayIntervalVariation,proto3" json:"replayIntervalVariation,omitempty"`
	ReplaySpeed             ReplaySpeed `protobuf:"varint,4,opt,name=replaySpeed,proto3,enum=gokvstore.ReplaySpeed" json:"replaySpeed,omitempty"`
}

ReplaySetting is used for publishing automatically. if replaySpeed == ReplaySpeed_Random replayInterval is the maximum interval and replayIntervalVariation is the minimum

func (*ReplaySetting) Descriptor

func (*ReplaySetting) Descriptor() ([]byte, []int)

func (*ReplaySetting) Marshal

func (m *ReplaySetting) Marshal() (dAtA []byte, err error)

func (*ReplaySetting) MarshalTo

func (m *ReplaySetting) MarshalTo(dAtA []byte) (int, error)

func (*ReplaySetting) ProtoMessage

func (*ReplaySetting) ProtoMessage()

func (*ReplaySetting) Reset

func (m *ReplaySetting) Reset()

func (*ReplaySetting) Size

func (m *ReplaySetting) Size() (n int)

func (*ReplaySetting) String

func (m *ReplaySetting) String() string

func (*ReplaySetting) Unmarshal

func (m *ReplaySetting) Unmarshal(dAtA []byte) error

type ReplaySpeed

type ReplaySpeed int32

ReplaySpeed defines the "speed" for a replay.

const (
	ReplaySpeed_ReplaySpeed_Original ReplaySpeed = 0
	ReplaySpeed_ReplaySpeed_AFAP     ReplaySpeed = 1
	// ReplaySpeed_Random
	ReplaySpeed_ReplaySpeed_Random    ReplaySpeed = 2
	ReplaySpeed_ReplaySpeed_Variation ReplaySpeed = 3
)

func (ReplaySpeed) EnumDescriptor

func (ReplaySpeed) EnumDescriptor() ([]byte, []int)

func (ReplaySpeed) String

func (x ReplaySpeed) String() string

type Request

type Request struct {
}

Request is a basic request type.

func (*Request) Descriptor

func (*Request) Descriptor() ([]byte, []int)

func (*Request) Marshal

func (m *Request) Marshal() (dAtA []byte, err error)

func (*Request) MarshalTo

func (m *Request) MarshalTo(dAtA []byte) (int, error)

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) Size

func (m *Request) Size() (n int)

func (*Request) String

func (m *Request) String() string

func (*Request) Unmarshal

func (m *Request) Unmarshal(dAtA []byte) error

type Response

type Response struct {
	goerror.DefaultErrorList `protobuf:"bytes,1,opt,name=errorList,embedded=errorList" json:"errorList"`
}

Response is a basic response type.

func (*Response) Descriptor

func (*Response) Descriptor() ([]byte, []int)

func (*Response) Marshal

func (m *Response) Marshal() (dAtA []byte, err error)

func (*Response) MarshalTo

func (m *Response) MarshalTo(dAtA []byte) (int, error)

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) Size

func (m *Response) Size() (n int)

func (*Response) String

func (m *Response) String() string

func (*Response) Unmarshal

func (m *Response) Unmarshal(dAtA []byte) error

type Settings

type Settings struct {
	Contexts []ContextSetting `protobuf:"bytes,1,rep,name=contexts" json:"contexts"`
}

Settings are the settings of a store.

func (*Settings) Descriptor

func (*Settings) Descriptor() ([]byte, []int)

func (*Settings) GetContexts

func (m *Settings) GetContexts() []ContextSetting

func (*Settings) Marshal

func (m *Settings) Marshal() (dAtA []byte, err error)

func (*Settings) MarshalTo

func (m *Settings) MarshalTo(dAtA []byte) (int, error)

func (*Settings) ProtoMessage

func (*Settings) ProtoMessage()

func (*Settings) Reset

func (m *Settings) Reset()

func (*Settings) Size

func (m *Settings) Size() (n int)

func (*Settings) String

func (m *Settings) String() string

func (*Settings) Unmarshal

func (m *Settings) Unmarshal(dAtA []byte) error

type SettingsCommand

type SettingsCommand struct {
	ReturnOldValues bool              `protobuf:"varint,2,opt,name=returnOldValues,proto3" json:"returnOldValues,omitempty"`
	Params          map[string]string `` /* 146-byte string literal not displayed */
}

SettingsCommand is used to modify the settings of a store.

func (*SettingsCommand) Descriptor

func (*SettingsCommand) Descriptor() ([]byte, []int)

func (*SettingsCommand) GetParams

func (m *SettingsCommand) GetParams() map[string]string

func (*SettingsCommand) Marshal

func (m *SettingsCommand) Marshal() (dAtA []byte, err error)

func (*SettingsCommand) MarshalTo

func (m *SettingsCommand) MarshalTo(dAtA []byte) (int, error)

func (*SettingsCommand) ProtoMessage

func (*SettingsCommand) ProtoMessage()

func (*SettingsCommand) Reset

func (m *SettingsCommand) Reset()

func (*SettingsCommand) Size

func (m *SettingsCommand) Size() (n int)

func (*SettingsCommand) String

func (m *SettingsCommand) String() string

func (*SettingsCommand) Unmarshal

func (m *SettingsCommand) Unmarshal(dAtA []byte) error

type SettingsCommandHandle

type SettingsCommandHandle interface {
	CommandHandle
	SettingsCommand() *SettingsCommand
}

type SettingsCommandResponse

type SettingsCommandResponse struct {
	SettingsQueryResponse `protobuf:"bytes,1,opt,name=srr,embedded=srr" json:"srr"`
}

SettingsCommandResponse is the response for a SettingsCommand.

func (*SettingsCommandResponse) Descriptor

func (*SettingsCommandResponse) Descriptor() ([]byte, []int)

func (*SettingsCommandResponse) Marshal

func (m *SettingsCommandResponse) Marshal() (dAtA []byte, err error)

func (*SettingsCommandResponse) MarshalTo

func (m *SettingsCommandResponse) MarshalTo(dAtA []byte) (int, error)

func (*SettingsCommandResponse) ProtoMessage

func (*SettingsCommandResponse) ProtoMessage()

func (*SettingsCommandResponse) Reset

func (m *SettingsCommandResponse) Reset()

func (*SettingsCommandResponse) Size

func (m *SettingsCommandResponse) Size() (n int)

func (*SettingsCommandResponse) String

func (m *SettingsCommandResponse) String() string

func (*SettingsCommandResponse) Unmarshal

func (m *SettingsCommandResponse) Unmarshal(dAtA []byte) error

type SettingsQuery

type SettingsQuery struct {
	ReturnAll bool              `protobuf:"varint,1,opt,name=returnAll,proto3" json:"returnAll,omitempty"`
	Params    map[string]string `` /* 146-byte string literal not displayed */
}

SettingsQuery is used to query the settings of a store.

func (*SettingsQuery) Descriptor

func (*SettingsQuery) Descriptor() ([]byte, []int)

func (*SettingsQuery) GetParams

func (m *SettingsQuery) GetParams() map[string]string

func (*SettingsQuery) Marshal

func (m *SettingsQuery) Marshal() (dAtA []byte, err error)

func (*SettingsQuery) MarshalTo

func (m *SettingsQuery) MarshalTo(dAtA []byte) (int, error)

func (*SettingsQuery) ProtoMessage

func (*SettingsQuery) ProtoMessage()

func (*SettingsQuery) Reset

func (m *SettingsQuery) Reset()

func (*SettingsQuery) Size

func (m *SettingsQuery) Size() (n int)

func (*SettingsQuery) String

func (m *SettingsQuery) String() string

func (*SettingsQuery) Unmarshal

func (m *SettingsQuery) Unmarshal(dAtA []byte) error

type SettingsQueryHandle

type SettingsQueryHandle interface {
	CommandHandle
	SettingsQuery() *SettingsQuery
	SettingsQueryResponse() *SettingsQueryResponse
}

type SettingsQueryResponse

type SettingsQueryResponse struct {
	Response `protobuf:"bytes,1,opt,name=response,embedded=response" json:"response"`
	Settings Settings          `protobuf:"bytes,2,opt,name=settings" json:"settings"`
	Params   map[string]string `` /* 146-byte string literal not displayed */
}

SettingsQueryResponse is the response for a SettingsQuery.

func (*SettingsQueryResponse) Descriptor

func (*SettingsQueryResponse) Descriptor() ([]byte, []int)

func (*SettingsQueryResponse) GetParams

func (m *SettingsQueryResponse) GetParams() map[string]string

func (*SettingsQueryResponse) GetSettings

func (m *SettingsQueryResponse) GetSettings() Settings

func (*SettingsQueryResponse) Marshal

func (m *SettingsQueryResponse) Marshal() (dAtA []byte, err error)

func (*SettingsQueryResponse) MarshalTo

func (m *SettingsQueryResponse) MarshalTo(dAtA []byte) (int, error)

func (*SettingsQueryResponse) ProtoMessage

func (*SettingsQueryResponse) ProtoMessage()

func (*SettingsQueryResponse) Reset

func (m *SettingsQueryResponse) Reset()

func (*SettingsQueryResponse) Size

func (m *SettingsQueryResponse) Size() (n int)

func (*SettingsQueryResponse) String

func (m *SettingsQueryResponse) String() string

func (*SettingsQueryResponse) Unmarshal

func (m *SettingsQueryResponse) Unmarshal(dAtA []byte) error

type StoreContextProvider

type StoreContextProvider interface {
	WriteBatchProvider
	ColumnFamilyHandles() (cfHandles []CFHandle)
	ColumnFamilyHandleByName(contextPath string) (handle CFHandle, index int)
}

StoreContextProvider can allocate and write a WriteBatch which can be used with CFHandle(s)/contextx. A CFHandle corresponds to a column family / table /bucket.

type WriteBatch

type WriteBatch interface {
	// AddCommand adds the command to the writable commands.
	AddCommand(command CommandHandle) (err error)
	// Clear clears the WriteBatch for reuse.
	Clear()
	// Count returns the count of the underlying commands or elements.
	Count() uint64
}

WriteBatch a batch for individual write commands.

type WriteBatchCreator

type WriteBatchCreator interface {
	// WriteBatch allocates and returns a new WriteBatch according to the
	// settings given with the handle. Handle can be nil and then default
	// settings are used.
	WriteBatch(handle WriteCommandHandle) WriteBatch
}

WriteBatchCreator can allocate a new WriteBatch.

type WriteBatchProvider

type WriteBatchProvider interface {
	WriteBatchCreator
	// WriteWriteBatch writes the WriteBatch to the underlying store
	// and waits until done (sync).
	// It is to be expected that batch can not be used afterwards.
	WriteWriteBatch(batch WriteBatch) (err error)
}

WriteBatchProvider can allocate a new WriteBatch and also write it to the store.

type WriteCommandHandle

type WriteCommandHandle interface {
	CommandHandle
	// Synced defines whether the write should be synced
	// to disk/store/storage.
	Synced() bool
}

WriteCommandHandle defines the CommandHandle of a write.

Directories

Path Synopsis
engine

Jump to

Keyboard shortcuts

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