Documentation ¶
Index ¶
- Variables
- func ScanReduceLatestWins(key []byte, values [][]byte, context []interface{}) ([]byte, []byte)
- type Element
- type EmptySSTableIterator
- type EmptySStableReader
- func (EmptySStableReader) BasePath() string
- func (EmptySStableReader) Close() error
- func (EmptySStableReader) Contains(_ []byte) bool
- func (EmptySStableReader) Get(_ []byte) ([]byte, error)
- func (EmptySStableReader) MetaData() *proto.MetaData
- func (EmptySStableReader) Scan() (SSTableIteratorI, error)
- func (EmptySStableReader) ScanRange(_ []byte, _ []byte) (SSTableIteratorI, error)
- func (EmptySStableReader) ScanStartingAt(_ []byte) (SSTableIteratorI, error)
- type MergeCompactionIterator
- type MergeContext
- type PriorityQueue
- type PriorityQueueI
- type ReadOption
- type SSTableFullScanIterator
- type SSTableIterator
- type SSTableIteratorI
- type SSTableMerger
- type SSTableMergerI
- type SSTableReader
- func (reader *SSTableReader) BasePath() string
- func (reader *SSTableReader) Close() error
- func (reader *SSTableReader) Contains(key []byte) bool
- func (reader *SSTableReader) Get(key []byte) ([]byte, error)
- func (reader *SSTableReader) MetaData() *proto.MetaData
- func (reader *SSTableReader) Scan() (SSTableIteratorI, error)
- func (reader *SSTableReader) ScanRange(keyLower []byte, keyHigher []byte) (SSTableIteratorI, error)
- func (reader *SSTableReader) ScanStartingAt(key []byte) (SSTableIteratorI, error)
- type SSTableReaderI
- type SSTableReaderOptions
- type SSTableSimpleWriter
- type SSTableSimpleWriterI
- type SSTableStreamWriter
- type SSTableStreamWriterI
- type SSTableWriterOptions
- type SuperSSTableReader
- func (s SuperSSTableReader) BasePath() string
- func (s SuperSSTableReader) Close() error
- func (s SuperSSTableReader) Contains(key []byte) bool
- func (s SuperSSTableReader) Get(key []byte) ([]byte, error)
- func (s SuperSSTableReader) MetaData() *proto.MetaData
- func (s SuperSSTableReader) Scan() (SSTableIteratorI, error)
- func (s SuperSSTableReader) ScanRange(keyLower []byte, keyHigher []byte) (SSTableIteratorI, error)
- func (s SuperSSTableReader) ScanStartingAt(key []byte) (SSTableIteratorI, error)
- type V0SSTableFullScanIterator
- type WriterOption
- func BloomExpectedNumberOfElements(n uint64) WriterOption
- func BloomFalsePositiveProbability(fpProbability float64) WriterOption
- func DataCompressionType(p int) WriterOption
- func EnableBloomFilter() WriterOption
- func IndexCompressionType(p int) WriterOption
- func WithKeyComparator(cmp skiplist.KeyComparator) WriterOption
- func WriteBasePath(p string) WriterOption
- func WriteBufferSizeBytes(bufSizeBytes int) WriterOption
Constants ¶
This section is empty.
Variables ¶
var BloomFileName = "bloom.bf.gz"
var DataFileName = "data.rio"
var Done = errors.New("no more items in iterator")
iterator pattern as described in https://github.com/GoogleCloudPlatform/google-cloud-go/wiki/Iterator-Guidelines
var IndexFileName = "index.rio"
var MetaFileName = "meta.pb.bin"
var NotFound = errors.New("key was not found")
var Version = uint32(1)
Functions ¶
func ScanReduceLatestWins ¶ added in v1.3.0
ScanReduceLatestWins is a simple version of a merge where the latest value always wins. Latest is determined by looping the context and finding the biggest value denoted by integers (assuming context is actually []int).
Types ¶
type EmptySSTableIterator ¶ added in v1.3.0
type EmptySSTableIterator struct{}
type EmptySStableReader ¶ added in v1.3.0
type EmptySStableReader struct{}
func (EmptySStableReader) BasePath ¶ added in v1.3.0
func (EmptySStableReader) BasePath() string
func (EmptySStableReader) Close ¶ added in v1.3.0
func (EmptySStableReader) Close() error
func (EmptySStableReader) Contains ¶ added in v1.3.0
func (EmptySStableReader) Contains(_ []byte) bool
func (EmptySStableReader) Get ¶ added in v1.3.0
func (EmptySStableReader) Get(_ []byte) ([]byte, error)
func (EmptySStableReader) MetaData ¶ added in v1.3.0
func (EmptySStableReader) MetaData() *proto.MetaData
func (EmptySStableReader) Scan ¶ added in v1.3.0
func (EmptySStableReader) Scan() (SSTableIteratorI, error)
func (EmptySStableReader) ScanRange ¶ added in v1.3.0
func (EmptySStableReader) ScanRange(_ []byte, _ []byte) (SSTableIteratorI, error)
func (EmptySStableReader) ScanStartingAt ¶ added in v1.3.0
func (EmptySStableReader) ScanStartingAt(_ []byte) (SSTableIteratorI, error)
type MergeCompactionIterator ¶ added in v1.3.0
type MergeCompactionIterator struct {
// contains filtered or unexported fields
}
type MergeContext ¶ added in v1.3.0
type MergeContext struct { Iterators []SSTableIteratorI IteratorContext []interface{} }
type PriorityQueue ¶ added in v1.1.0
type PriorityQueue struct {
// contains filtered or unexported fields
}
func NewPriorityQueue ¶ added in v1.1.0
func NewPriorityQueue(comp skiplist.KeyComparator) PriorityQueue
func (*PriorityQueue) Init ¶ added in v1.1.0
func (pq *PriorityQueue) Init(ctx MergeContext) error
type PriorityQueueI ¶ added in v1.1.0
type PriorityQueueI interface { Init(iterators []SSTableIteratorI) error // initializes the heap with the initial values from the Iterators Next() ([]byte, []byte, error) // next key/value/error, Done is returned when all elements are exhausted }
type ReadOption ¶
type ReadOption func(*SSTableReaderOptions)
func ReadBasePath ¶
func ReadBasePath(p string) ReadOption
func ReadWithKeyComparator ¶
func ReadWithKeyComparator(cmp skiplist.KeyComparator) ReadOption
type SSTableFullScanIterator ¶ added in v1.3.0
type SSTableFullScanIterator struct {
// contains filtered or unexported fields
}
this is an optimized iterator that does a sequential read over the index+data files instead of a sequential read on the index with a random access lookup on the data file via mmap
type SSTableIterator ¶
type SSTableIterator struct {
// contains filtered or unexported fields
}
type SSTableIteratorI ¶
type SSTableMerger ¶ added in v1.1.0
type SSTableMerger struct {
// contains filtered or unexported fields
}
func NewSSTableMerger ¶ added in v1.1.0
func NewSSTableMerger(comp skiplist.KeyComparator) SSTableMerger
func (SSTableMerger) Merge ¶ added in v1.1.0
func (m SSTableMerger) Merge(ctx MergeContext, writer SSTableStreamWriterI) error
func (SSTableMerger) MergeCompact ¶ added in v1.3.0
func (m SSTableMerger) MergeCompact(ctx MergeContext, writer SSTableStreamWriterI, reduce func([]byte, [][]byte, []interface{}) ([]byte, []byte)) error
func (SSTableMerger) MergeCompactIterator ¶ added in v1.3.0
func (m SSTableMerger) MergeCompactIterator(ctx MergeContext, reduce func([]byte, [][]byte, []interface{}) ([]byte, []byte)) (SSTableIteratorI, error)
type SSTableMergerI ¶ added in v1.1.0
type SSTableMergerI interface { // Merge merges/writes the given Iterators into a single sorted SSTable Merge(iterators []SSTableIteratorI, writer SSTableStreamWriterI) error // MergeCompact is like merge, but accumulates values for the same key and presents it as a // "reduction" function to compact values for the same key. // reduce receives a key and a slice of values - it then needs to return a single key and value. MergeCompact(iterators []SSTableIteratorI, writer SSTableStreamWriterI, reduce func([]byte, [][]byte) ([]byte, []byte)) error }
type SSTableReader ¶
type SSTableReader struct {
// contains filtered or unexported fields
}
func (*SSTableReader) BasePath ¶ added in v1.3.0
func (reader *SSTableReader) BasePath() string
func (*SSTableReader) Close ¶
func (reader *SSTableReader) Close() error
func (*SSTableReader) Contains ¶
func (reader *SSTableReader) Contains(key []byte) bool
func (*SSTableReader) MetaData ¶
func (reader *SSTableReader) MetaData() *proto.MetaData
func (*SSTableReader) Scan ¶ added in v1.1.0
func (reader *SSTableReader) Scan() (SSTableIteratorI, error)
func (*SSTableReader) ScanRange ¶
func (reader *SSTableReader) ScanRange(keyLower []byte, keyHigher []byte) (SSTableIteratorI, error)
func (*SSTableReader) ScanStartingAt ¶
func (reader *SSTableReader) ScanStartingAt(key []byte) (SSTableIteratorI, error)
type SSTableReaderI ¶
type SSTableReaderI interface { // returns true when the given key exists, false otherwise Contains(key []byte) bool // returns the value associated with the given key, NotFound as the error otherwise Get(key []byte) ([]byte, error) // Returns an iterator over the whole sorted sequence. Scan uses a more optimized version that iterates the // data file sequentially, whereas the other Scan* functions use the index and random access using mmap. Scan() (SSTableIteratorI, error) // Returns an iterator over the sorted sequence starting at the given key (inclusive if key is in the list). // Using a key that is out of the sequence range will result in either an empty iterator or the full sequence. ScanStartingAt(key []byte) (SSTableIteratorI, error) // Returns an iterator over the sorted sequence starting at the given keyLower (inclusive if key is in the list) // and until the given keyHigher was reached (inclusive if key is in the list). // Using keys that are out of the sequence range will result in either an empty iterator or the full sequence. // If keyHigher is lower than keyLower an error will be returned. ScanRange(keyLower []byte, keyHigher []byte) (SSTableIteratorI, error) // closes this sstable reader Close() error // Returns the metadata of this sstable MetaData() *proto.MetaData // Returns the base path / root path of this sstable that contains all the files. BasePath() string }
func NewSSTableReader ¶
func NewSSTableReader(readerOptions ...ReadOption) (SSTableReaderI, error)
NewSSTableReader creates a new reader. The sstable base path and comparator are mandatory: > sstables.NewSSTableReader(sstables.ReadBasePath("some_path"), sstables.ReadWithKeyComparator(some_comp))
type SSTableReaderOptions ¶
type SSTableReaderOptions struct {
// contains filtered or unexported fields
}
read/write options
type SSTableSimpleWriter ¶
type SSTableSimpleWriter struct {
// contains filtered or unexported fields
}
func NewSSTableSimpleWriter ¶
func NewSSTableSimpleWriter(writerOptions ...WriterOption) (*SSTableSimpleWriter, error)
func (*SSTableSimpleWriter) WriteSkipListMap ¶
func (writer *SSTableSimpleWriter) WriteSkipListMap(skipListMap skiplist.SkipListMapI) error
type SSTableSimpleWriterI ¶
type SSTableSimpleWriterI interface { // writes all records of that SkipList to an sstable disk structure, expects []byte as key and value WriteSkipList(skipListMap *skiplist.SkipListMap) error }
type SSTableStreamWriter ¶
type SSTableStreamWriter struct {
// contains filtered or unexported fields
}
func NewSSTableStreamWriter ¶
func NewSSTableStreamWriter(writerOptions ...WriterOption) (*SSTableStreamWriter, error)
NewSSTableStreamWriter creates a new streamed writer, the minimum options required are the base path and the comparator: > sstables.NewSSTableStreamWriter(sstables.WriteBasePath("some_existing_folder"), sstables.WithKeyComparator(some_comparator))
func (*SSTableStreamWriter) Close ¶
func (writer *SSTableStreamWriter) Close() error
func (*SSTableStreamWriter) Open ¶
func (writer *SSTableStreamWriter) Open() error
type SSTableStreamWriterI ¶
type SSTableWriterOptions ¶
type SSTableWriterOptions struct {
// contains filtered or unexported fields
}
type SuperSSTableReader ¶ added in v1.3.0
type SuperSSTableReader struct {
// contains filtered or unexported fields
}
SuperSSTableReader unifies several sstables under one single reader with the same interface. The ordering of the readers matters, it is assumed the older reader comes before the newer (ascending order).
func NewSuperSSTableReader ¶ added in v1.3.0
func NewSuperSSTableReader(readers []SSTableReaderI, comp skiplist.KeyComparator) *SuperSSTableReader
func (SuperSSTableReader) BasePath ¶ added in v1.3.0
func (s SuperSSTableReader) BasePath() string
func (SuperSSTableReader) Close ¶ added in v1.3.0
func (s SuperSSTableReader) Close() error
func (SuperSSTableReader) Contains ¶ added in v1.3.0
func (s SuperSSTableReader) Contains(key []byte) bool
func (SuperSSTableReader) Get ¶ added in v1.3.0
func (s SuperSSTableReader) Get(key []byte) ([]byte, error)
func (SuperSSTableReader) MetaData ¶ added in v1.3.0
func (s SuperSSTableReader) MetaData() *proto.MetaData
func (SuperSSTableReader) Scan ¶ added in v1.3.0
func (s SuperSSTableReader) Scan() (SSTableIteratorI, error)
func (SuperSSTableReader) ScanRange ¶ added in v1.3.0
func (s SuperSSTableReader) ScanRange(keyLower []byte, keyHigher []byte) (SSTableIteratorI, error)
func (SuperSSTableReader) ScanStartingAt ¶ added in v1.3.0
func (s SuperSSTableReader) ScanStartingAt(key []byte) (SSTableIteratorI, error)
type V0SSTableFullScanIterator ¶ added in v1.3.0
type V0SSTableFullScanIterator struct {
// contains filtered or unexported fields
}
deprecated, since this is for the v0 protobuf based sstables. this is an optimized iterator that does a sequential read over the index+data files instead of a sequential read on the index with a random access lookup on the data file via mmap
type WriterOption ¶
type WriterOption func(*SSTableWriterOptions)
func BloomExpectedNumberOfElements ¶
func BloomExpectedNumberOfElements(n uint64) WriterOption
func BloomFalsePositiveProbability ¶
func BloomFalsePositiveProbability(fpProbability float64) WriterOption
func DataCompressionType ¶
func DataCompressionType(p int) WriterOption
func EnableBloomFilter ¶
func EnableBloomFilter() WriterOption
func IndexCompressionType ¶
func IndexCompressionType(p int) WriterOption
func WithKeyComparator ¶
func WithKeyComparator(cmp skiplist.KeyComparator) WriterOption
func WriteBasePath ¶
func WriteBasePath(p string) WriterOption
func WriteBufferSizeBytes ¶ added in v1.3.0
func WriteBufferSizeBytes(bufSizeBytes int) WriterOption