Documentation
¶
Overview ¶
Package goiterator is a generated protocol buffer package.
It is generated from these files:
iterator.proto
It has these top-level messages:
Index ¶
- Variables
- func ForEach(itr KVKVForwardIterator, fn func(k, v []byte))
- type AddableIndexedLengthBuffer
- type AddableLengthBuffer
- type BaseBufferIterator
- func (self *BaseBufferIterator) Err() (err error)
- func (self *BaseBufferIterator) InnerNext()
- func (self *BaseBufferIterator) InnerValid() bool
- func (self *BaseBufferIterator) Reset()
- func (self *BaseBufferIterator) SetErr(err error)
- func (self *BaseBufferIterator) SetReadahead(readaheadSize, readaheadCnt uint64)
- func (self *BaseBufferIterator) SetReadaheadCnt(readaheadCnt uint64)
- func (self *BaseBufferIterator) SetReadaheadSize(readaheadSize uint64)
- type BasePositionedDataBuffer
- func (self *BasePositionedDataBuffer) Clear()
- func (self *BasePositionedDataBuffer) Cnt() uint64
- func (self *BasePositionedDataBuffer) GetBuffer() []byte
- func (self *BasePositionedDataBuffer) SetBuffer(buf []byte)
- func (self *BasePositionedDataBuffer) ToForwardKVLengthBufferIterator() (itr ForwardKVLengthBufferIterator, err error)
- func (self *BasePositionedDataBuffer) ToReverseKVLengthBufferIterator() (itr ReverseKVLengthBufferIterator, err error)
- func (self *BasePositionedDataBuffer) Unwrap() (data []byte, lengths []uint32, err error)
- func (self *BasePositionedDataBuffer) Wrap(data []byte, lengths []uint32) (err error)
- func (self *BasePositionedDataBuffer) WrapSize(data []byte, lengths []uint32) uint64
- type ForwardKVLengthBufferIterator
- func (self *ForwardKVLengthBufferIterator) FromPositionedDataBuffer(buf PositionedDataBuffer) (err error)
- func (self *ForwardKVLengthBufferIterator) IteratorIndex() (idx uint32)
- func (self *ForwardKVLengthBufferIterator) Key() (k []byte)
- func (self *ForwardKVLengthBufferIterator) KeyValue() (k, v []byte)
- func (self *ForwardKVLengthBufferIterator) Next()
- func (self *ForwardKVLengthBufferIterator) Reset()
- func (self *ForwardKVLengthBufferIterator) ToPositionedDataBuffer(buf PositionedDataBuffer) (err error)
- func (self *ForwardKVLengthBufferIterator) Valid() bool
- func (self *ForwardKVLengthBufferIterator) Value() (v []byte)
- type ForwardVLengthBufferIterator
- func (self *ForwardVLengthBufferIterator) FromPositionedDataBuffer(buf PositionedDataBuffer) (err error)
- func (self *ForwardVLengthBufferIterator) Next()
- func (self *ForwardVLengthBufferIterator) Reset()
- func (self *ForwardVLengthBufferIterator) ToPositionedDataBuffer(buf PositionedDataBuffer) (err error)
- func (self *ForwardVLengthBufferIterator) Valid() bool
- func (self *ForwardVLengthBufferIterator) Value() (v []byte)
- type IndexedBaseBufferIterator
- func (self *IndexedBaseBufferIterator) FromPositionedDataBuffer(buf PositionedDataBuffer) (err error)
- func (self *IndexedBaseBufferIterator) IteratorIndex() uint32
- func (self *IndexedBaseBufferIterator) SetReadaheadCnt(readaheadCnt uint64)
- func (self *IndexedBaseBufferIterator) ToPositionedDataBuffer(buf PositionedDataBuffer) (err error)
- type IteratorManager
- type IteratorSeeker
- type IteratorSortOrder
- type IteratorValidator
- type KVBaseIterator
- type KVBulkIterator
- type KVIndexedBulkIterator
- type KVIterator
- type KVIteratorLimiter
- type KVKVForwardIterator
- type KVKVForwardResultIterator
- type LengthBuffer
- func (self *LengthBuffer) Clear()
- func (self *LengthBuffer) FromPositionedDataBuffer(buf PositionedDataBuffer) (err error)
- func (self *LengthBuffer) GetBuffer() []byte
- func (self *LengthBuffer) GetLengths() []uint32
- func (self *LengthBuffer) SetBuffer(buf []byte)
- func (self *LengthBuffer) ToPositionedDataBuffer(buf PositionedDataBuffer) (err error)
- type PositionedDataBuffer
- type PositionedDataBufferIterator
- type ReverseKVLengthBufferIterator
Constants ¶
This section is empty.
Variables ¶
var IteratorSortOrder_name = map[int32]string{
0: "Natural",
1: "Asc",
-1: "Desc",
}
var IteratorSortOrder_value = map[string]int32{
"Natural": 0,
"Asc": 1,
"Desc": -1,
}
Functions ¶
func ForEach ¶
func ForEach(itr KVKVForwardIterator, fn func(k, v []byte))
ForEach iterates through itr and calls fn as long as itr is Valid.
Types ¶
type AddableIndexedLengthBuffer ¶
type AddableIndexedLengthBuffer struct {
LengthBuffer
Indexes []uint32
}
AddableIndexedLengthBuffer defines a buffer of bytes (byte slice) which stores "multiple slices". These "multiple slices" lengths are stored in the slice Lengths of type uint64
func (*AddableIndexedLengthBuffer) AddKeyValue ¶
func (self *AddableIndexedLengthBuffer) AddKeyValue(k, v []byte, index uint32)
AddKeyValue adds k and v to the own Buffer and Lengths.
func (*AddableIndexedLengthBuffer) AddValue ¶
func (self *AddableIndexedLengthBuffer) AddValue(value []byte, index uint32)
AddValue adds value to the own Buffer and Lengths.
func (*AddableIndexedLengthBuffer) AddValues ¶
func (self *AddableIndexedLengthBuffer) AddValues(values [][]byte, indexes []uint32)
AddValues adds values to the own Buffer and Lengths.
type AddableLengthBuffer ¶
type AddableLengthBuffer struct {
LengthBuffer
}
AddableLengthBuffer defines a buffer of bytes (byte slice) which stores "multiple slices". These "multiple slices" lengths are stored in the slice Lengths of type uint64
func (*AddableLengthBuffer) AddKeyValue ¶
func (self *AddableLengthBuffer) AddKeyValue(k, v []byte)
AddKeyValue adds k and v to the own Buffer and Lengths.
func (*AddableLengthBuffer) AddValue ¶
func (self *AddableLengthBuffer) AddValue(value []byte)
AddValue adds value to the own Buffer and Lengths.
func (*AddableLengthBuffer) AddValues ¶
func (self *AddableLengthBuffer) AddValues(values [][]byte)
AddValues adds values to the own Buffer and Lengths.
type BaseBufferIterator ¶
type BaseBufferIterator struct {
ForwardKVLengthBufferIterator
Order IteratorSortOrder
ReadaheadSize uint64
ReadaheadCnt uint64
// autoAdjustBuffer defines whether the readahead buffer len might be
// increased if a single key/value pair is too large for the current readahead buffer.
AutoAdjustBufferSize bool
// contains filtered or unexported fields
}
BaseBufferIterator is used to iterate over a LengthBuffer.
func CreateBaseBufferIterator ¶
func CreateBaseBufferIterator(readaheadSize, readaheadCnt uint64, autoAdjustBufferSize bool) (self BaseBufferIterator)
CreateBaseBufferIterator returns an initialized BaseBufferIterator.
func CreateBaseBufferIteratorWithBuffer ¶
func CreateBaseBufferIteratorWithBuffer( readaheadSize, readaheadCnt uint64, autoAdjustBufferSize bool, buf []byte) (self BaseBufferIterator)
CreateBaseBufferIteratorWithBuffer returns an initialized BaseBufferIterator.
func (*BaseBufferIterator) Err ¶
func (self *BaseBufferIterator) Err() (err error)
Err returns a possible error which could have occured at iteration.
func (*BaseBufferIterator) InnerNext ¶
func (self *BaseBufferIterator) InnerNext()
InnerNext sets the underlying iterator next.
func (*BaseBufferIterator) InnerValid ¶
func (self *BaseBufferIterator) InnerValid() bool
InnerValid tests whether the iterator is inner valid.
func (*BaseBufferIterator) Reset ¶
func (self *BaseBufferIterator) Reset()
Reset resets the underlying iterator.
func (*BaseBufferIterator) SetErr ¶
func (self *BaseBufferIterator) SetErr(err error)
SetErr sets a possible error which could have occured at iteration.
func (*BaseBufferIterator) SetReadahead ¶
func (self *BaseBufferIterator) SetReadahead(readaheadSize, readaheadCnt uint64)
SetReadahead sets readaheadSize and readaheadCnt which will be used for the next search. Thus no more than readaheadSize and readaheadCnt will be used next time read ahead takes place.
func (*BaseBufferIterator) SetReadaheadCnt ¶
func (self *BaseBufferIterator) SetReadaheadCnt(readaheadCnt uint64)
SetReadaheadCnt sets the readaheadCnt and if the own lengths is not large enough it gets enlarged. As KV Pairs are concrened, readaheadCnt is doubled.
func (*BaseBufferIterator) SetReadaheadSize ¶
func (self *BaseBufferIterator) SetReadaheadSize(readaheadSize uint64)
SetReadaheadSize sets the readaheadSize and if the own buffer is not large enough it gets enlarged.
type BasePositionedDataBuffer ¶
type BasePositionedDataBuffer struct {
// contains filtered or unexported fields
}
BasePositionedDataBuffer holds the data of a data buffer with separate lengths for example like defined by LengthBuffer in a single byte slice. One can define prePadSize and postPadSize in bytes on creation. This is for example useful, if you want to use the buffer to be sent over a network and a header must be prepended.
func CreateBasePositionedDataBufferByBytes ¶
func CreateBasePositionedDataBufferByBytes(buf []byte, prePadSize, postPadSize uint64) (self BasePositionedDataBuffer)
CreateBasePositionedDataBufferByBytes returns a BasePositionedDataBuffer with the empty buffer buf and prePadSize and postPadSize.
func (*BasePositionedDataBuffer) Clear ¶
func (self *BasePositionedDataBuffer) Clear()
Clear clears the internal byte slice.
func (*BasePositionedDataBuffer) Cnt ¶
func (self *BasePositionedDataBuffer) Cnt() uint64
Cnt returns the cnt of the elements in the buffer.
func (*BasePositionedDataBuffer) GetBuffer ¶
func (self *BasePositionedDataBuffer) GetBuffer() []byte
Buffer returns the used internal byte slice. (wrapped bytes).
func (*BasePositionedDataBuffer) SetBuffer ¶
func (self *BasePositionedDataBuffer) SetBuffer(buf []byte)
SetBuffer sets the underlying byte slice.
func (*BasePositionedDataBuffer) ToForwardKVLengthBufferIterator ¶
func (self *BasePositionedDataBuffer) ToForwardKVLengthBufferIterator() (itr ForwardKVLengthBufferIterator, err error)
ToForwardKVLengthBufferIterator creates a ForwardKVLengthBufferIterator from the BasePositionedDataBuffer (itself). Is a helper method.
func (*BasePositionedDataBuffer) ToReverseKVLengthBufferIterator ¶
func (self *BasePositionedDataBuffer) ToReverseKVLengthBufferIterator() (itr ReverseKVLengthBufferIterator, err error)
ToReverseKVLengthBufferIterator creates a ReverseKVLengthBufferIterator from the BasePositionedDataBuffer (itself). Is a helper method.
func (*BasePositionedDataBuffer) Unwrap ¶
func (self *BasePositionedDataBuffer) Unwrap() (data []byte, lengths []uint32, err error)
Unwrap unwraps data and lengths from its single byte slice.
type ForwardKVLengthBufferIterator ¶
type ForwardKVLengthBufferIterator struct {
LengthBuffer
ReadPos uint64
ReadBytePos uint64
Cnt uint64
Size uint64
}
ForwardKVLengthBufferIterator is an KV iterator based on LengthBuffer.
func (*ForwardKVLengthBufferIterator) FromPositionedDataBuffer ¶
func (self *ForwardKVLengthBufferIterator) FromPositionedDataBuffer(buf PositionedDataBuffer) (err error)
FromPositionedDataBuffer calls buf.Unwrap() and divides the Lengths by keys and values.
func (*ForwardKVLengthBufferIterator) IteratorIndex ¶
func (self *ForwardKVLengthBufferIterator) IteratorIndex() (idx uint32)
func (*ForwardKVLengthBufferIterator) Key ¶
func (self *ForwardKVLengthBufferIterator) Key() (k []byte)
Key returns the key the iterator currently holds.
func (*ForwardKVLengthBufferIterator) KeyValue ¶
func (self *ForwardKVLengthBufferIterator) KeyValue() (k, v []byte)
KeyValue returns the key and the value the iterator currently holds.
func (*ForwardKVLengthBufferIterator) Next ¶
func (self *ForwardKVLengthBufferIterator) Next()
Next moves the iterator position by one forward. The iterator has to be valid.
func (*ForwardKVLengthBufferIterator) Reset ¶
func (self *ForwardKVLengthBufferIterator) Reset()
Reset resets the iterator.
func (*ForwardKVLengthBufferIterator) ToPositionedDataBuffer ¶
func (self *ForwardKVLengthBufferIterator) ToPositionedDataBuffer(buf PositionedDataBuffer) (err error)
ToPositionedDataBuffer helper method and calls buf.Wrap().
func (*ForwardKVLengthBufferIterator) Valid ¶
func (self *ForwardKVLengthBufferIterator) Valid() bool
Valid returns whether the iterator has a valid element at its current position.
func (*ForwardKVLengthBufferIterator) Value ¶
func (self *ForwardKVLengthBufferIterator) Value() (v []byte)
Value returns the value the iterator currently holds.
type ForwardVLengthBufferIterator ¶
type ForwardVLengthBufferIterator struct {
ForwardKVLengthBufferIterator
}
ForwardVLengthBufferIterator is a value only iterator based on LengthBuffer.
func CreateForwardVLengthBufferIterator ¶
func CreateForwardVLengthBufferIterator(lenghtBuffer LengthBuffer) (self ForwardVLengthBufferIterator)
CreateForwardVLengthBufferIterator returns a ForwardKVLengthBufferIterator on the basis of lengthBuffer.
func (*ForwardVLengthBufferIterator) FromPositionedDataBuffer ¶
func (self *ForwardVLengthBufferIterator) FromPositionedDataBuffer(buf PositionedDataBuffer) (err error)
FromPositionedDataBuffer calls buf.Unwrap() and divides the Lengths by keys and values.
func (*ForwardVLengthBufferIterator) Next ¶
func (self *ForwardVLengthBufferIterator) Next()
Next moves the iterator position by one forward. The iterator has to be valid.
func (*ForwardVLengthBufferIterator) Reset ¶
func (self *ForwardVLengthBufferIterator) Reset()
Reset resets the iterator.
func (*ForwardVLengthBufferIterator) ToPositionedDataBuffer ¶
func (self *ForwardVLengthBufferIterator) ToPositionedDataBuffer(buf PositionedDataBuffer) (err error)
ToPositionedDataBuffer helper method and calls buf.Wrap().
func (*ForwardVLengthBufferIterator) Valid ¶
func (self *ForwardVLengthBufferIterator) Valid() bool
Valid returns whether the iterator has a valid element at its current position.
func (*ForwardVLengthBufferIterator) Value ¶
func (self *ForwardVLengthBufferIterator) Value() (v []byte)
Value returns the value the iterator currently holds.
type IndexedBaseBufferIterator ¶
type IndexedBaseBufferIterator struct {
BaseBufferIterator
// Indexes hold the index of the iterator of itrs which
// currently provides KeyValue()
Indexes []uint32
}
IndexedBaseBufferIterator is used to iterate over a LengthBuffer with indexes.
func CreateIndexedBaseBufferIterator ¶
func CreateIndexedBaseBufferIterator(readaheadSize, readaheadCnt uint64, autoAdjustBufferSize bool) (self IndexedBaseBufferIterator)
CreateBaseBufferIterator returns an initialized IndexedBaseBufferIterator.
func CreateIndexedBaseBufferIteratorWithBuffer ¶
func CreateIndexedBaseBufferIteratorWithBuffer( readaheadSize, readaheadCnt uint64, autoAdjustBufferSize bool, buf []byte) (self IndexedBaseBufferIterator)
CreateBaseBufferIteratorWithBuffer returns an initialized IndexedBaseBufferIterator.
func (*IndexedBaseBufferIterator) FromPositionedDataBuffer ¶
func (self *IndexedBaseBufferIterator) FromPositionedDataBuffer(buf PositionedDataBuffer) (err error)
FromPositionedDataBuffer calls buf.Unwrap() and divides the Lengths by keys and values.
func (*IndexedBaseBufferIterator) IteratorIndex ¶
func (self *IndexedBaseBufferIterator) IteratorIndex() uint32
IteratorIndex returns the index at current ReadPos.
func (*IndexedBaseBufferIterator) SetReadaheadCnt ¶
func (self *IndexedBaseBufferIterator) SetReadaheadCnt(readaheadCnt uint64)
SetReadaheadCnt sets the readaheadCnt and if the own lengths is not large enough it gets enlarged.
func (*IndexedBaseBufferIterator) ToPositionedDataBuffer ¶
func (self *IndexedBaseBufferIterator) ToPositionedDataBuffer(buf PositionedDataBuffer) (err error)
ToPositionedDataBuffer helper method and calls buf.Wrap().
type IteratorManager ¶
type IteratorManager interface {
// Err returns a possible error which could have occured at iteration.
Err() error
// Close closes the iterator and should release its resources.
// After the close of the iterator it is no longer (re-)usable.
Close()
// Reset resets the iterator and potentially its underlying iterator
// and ressources.
Reset()
}
IteratorManager allows to maintain the iterator.
type IteratorSeeker ¶
type IteratorSeeker interface {
// SeekToFirst sets the iterators position at the first element.
SeekToFirst()
// SeekToLast sets the iterators position after the last element.
SeekToLast()
// Seek sets the iterators position to the next key GTE(>=) k.
Seek(k []byte)
// SeekForPrev sets the iterators position to the next key LTE(<=) k.
SeekForPrev(k []byte)
}
IteratorSeeker provides the different seek methods for an Iterator
type IteratorSortOrder ¶
type IteratorSortOrder int32
const ( IteratorSortOrder_Natural IteratorSortOrder = 0 IteratorSortOrder_Asc IteratorSortOrder = 1 IteratorSortOrder_Desc IteratorSortOrder = -1 )
func (IteratorSortOrder) EnumDescriptor ¶
func (IteratorSortOrder) EnumDescriptor() ([]byte, []int)
func (IteratorSortOrder) String ¶
func (x IteratorSortOrder) String() string
type IteratorValidator ¶
type IteratorValidator interface {
// Valid returns whether the iterator has a valid element at its current position.
Valid() bool
}
IteratorValidator is used to check whether an iterator is valid.
type KVBaseIterator ¶
type KVBaseIterator interface {
IteratorValidator
// Key returns the current key of the iterator.
Key() (k []byte)
// Value returns the current value of the iterator.
Value() (v []byte)
// KeyValue returns the current key and value of the iterator.
KeyValue() (k, v []byte)
// Next moves the iterator position by one forward.
Next()
}
KVBaseIterator
type KVBulkIterator ¶
type KVBulkIterator interface {
KVIterator
// NextTo iterates with Next() up to readaheadSize or readaheadCnt and fills data into buf.
NextTo(buf PositionedDataBuffer, readaheadSize, readaheadCnt uint64, iteratorSortOrder IteratorSortOrder)
// PrevTo iterates with Prev() up to readaheadSize or readaheadCnt and fills data into buf.
PrevTo(buf PositionedDataBuffer, readaheadSize, readaheadCnt uint64, iteratorSortOrder IteratorSortOrder)
}
KVBulkIterator type is a KVIterator with additional "readahead" functions. Where the readahead data is stored in a PositionedDataBuffer.
type KVIndexedBulkIterator ¶
type KVIndexedBulkIterator interface {
KVBulkIterator
// IteratorIndex returns the index of the iterator "element"
// that currently provides Key(), Value(), KeyValue().
// Default implementations with a single "element" should
// always return 0.
IteratorIndex() (idx uint32)
}
KVIndexedBulkIterator is a KVBulkIterator that also provides "index" information. NextTo and PrevTo should always include this information in the PositionedDataBuffer buf.
type KVIterator ¶
type KVIterator interface {
IteratorManager
IteratorSeeker
KVBaseIterator
// Prev moves the iterator position by one backward.
Prev()
}
KVIterator is an iterator for key values, which is loosely based on the rocksdb iterator idea.
type KVIteratorLimiter ¶
type KVIteratorLimiter interface {
SetLimitKey(limitKey []byte)
}
KVIteratorLimiter can limit the maximum/minimum key to be iterated.
type KVKVForwardIterator ¶
type KVKVForwardIterator interface {
// KeyValue returns the current key and value of the iterator.
KeyValue() (k, v []byte)
// Valid returns whether the iterator has a valid element at its current position.
Valid() bool
// Next moves the iterator position by one forward.
Next()
}
KVKVForwardIterator defines basic forward KV iterator functionality.
type KVKVForwardResultIterator ¶
type KVKVForwardResultIterator interface {
KVKVForwardIterator
Values() (values [][]byte)
}
KVKVForwardResultIterator defines basic forward KV iterator functionality.
type LengthBuffer ¶
LengthBuffer defines a buffer of bytes (byte slice) which stores "multiple slices". These "multiple slices" lengths are stored in the slice Lengths of type uint64
func (*LengthBuffer) Clear ¶
func (self *LengthBuffer) Clear()
Clear resets the LengthBuffers elements
func (*LengthBuffer) FromPositionedDataBuffer ¶
func (self *LengthBuffer) FromPositionedDataBuffer(buf PositionedDataBuffer) (err error)
FromPositionedDataBuffer helper method and calls buf.Unwrap().
func (*LengthBuffer) GetBuffer ¶
func (self *LengthBuffer) GetBuffer() []byte
Buffer returns the used internal byte slice. (wrapped bytes).
func (*LengthBuffer) GetLengths ¶
func (self *LengthBuffer) GetLengths() []uint32
GetLengths returns the used internal byte slice. (wrapped bytes).
func (*LengthBuffer) SetBuffer ¶
func (self *LengthBuffer) SetBuffer(buf []byte)
SetBuffer sets the underlying byte slice.
func (*LengthBuffer) ToPositionedDataBuffer ¶
func (self *LengthBuffer) ToPositionedDataBuffer(buf PositionedDataBuffer) (err error)
ToPositionedDataBuffer helper method and calls buf.Wrap().
type PositionedDataBuffer ¶
type PositionedDataBuffer interface {
// Wrap wraps data and lengths to its single byte slice.
Wrap(data []byte, lengths []uint32) (err error)
// Unwrap unwraps data and lengths from its single byte slice.
Unwrap() (data []byte, lengths []uint32, err error)
GetBuffer() []byte
SetBuffer(data []byte)
Clear()
}
PositionedDataBuffer holds the data of a data buffer with separate lengths for example like defined by LengthBuffer in a single byte slice. One can define prePadSize and postPadSize in bytes on creation. This is for example useful, if you want to use the buffer to be sent over a network and a header must be prepended.
type PositionedDataBufferIterator ¶
type PositionedDataBufferIterator interface {
FromPositionedDataBuffer(buf PositionedDataBuffer) (err error)
ToPositionedDataBuffer(buf PositionedDataBuffer) (err error)
Valid() bool
Reset()
Next()
Key() (k []byte)
Value() (v []byte)
KeyValue() (k, v []byte)
IteratorIndex() (idx uint32)
}
type ReverseKVLengthBufferIterator ¶
type ReverseKVLengthBufferIterator struct {
ForwardKVLengthBufferIterator
}
ReverseKVLengthBufferIterator is an iterator based on LengthBuffer with reverse order.
func (*ReverseKVLengthBufferIterator) FromPositionedDataBuffer ¶
func (self *ReverseKVLengthBufferIterator) FromPositionedDataBuffer(buf PositionedDataBuffer) (err error)
func (*ReverseKVLengthBufferIterator) Next ¶
func (self *ReverseKVLengthBufferIterator) Next()
Next moves the iterator position by one forward. The iterator has to be valid.
func (*ReverseKVLengthBufferIterator) Reset ¶
func (self *ReverseKVLengthBufferIterator) Reset()
Reset resets the iterator.
func (*ReverseKVLengthBufferIterator) Valid ¶
func (self *ReverseKVLengthBufferIterator) Valid() bool
Valid returns whether the iterator has a valid element at its current position.