Documentation ¶
Index ¶
- Variables
- func ScanReduceLatestWins(key []byte, values [][]byte, context []int) ([]byte, []byte)
- type ChecksumError
- 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 ReadOption
- type ReduceFunc
- type SSTableFullScanIterator
- type SSTableIterator
- type SSTableIteratorI
- type SSTableMergeIteratorContext
- type SSTableMerger
- func (m SSTableMerger) Merge(iterators []SSTableMergeIteratorContext, writer SSTableStreamWriterI) (err error)
- func (m SSTableMerger) MergeCompact(iterators []SSTableMergeIteratorContext, writer SSTableStreamWriterI, ...) (err error)
- func (m SSTableMerger) MergeCompactIterator(iterators []SSTableMergeIteratorContext, reduce ReduceFunc) (SSTableIteratorI, error)
- type SSTableMergerI
- type SSTableReader
- func (reader *SSTableReader) BasePath() string
- func (reader *SSTableReader) Close() (err 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() (err 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.Comparator[[]byte]) WriterOption
- func WriteBasePath(p string) WriterOption
- func WriteBufferSizeBytes(bufSizeBytes int) WriterOption
Constants ¶
This section is empty.
Variables ¶
var BloomFileName = "bloom.bf.gz"
var ChecksumErr = ChecksumError{}
var DataFileName = "data.rio"
var Done = errors.New("no more items in iterator")
Done indicates an iterator has returned all items. 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 ChecksumError ¶ added in v1.5.0
type ChecksumError struct {
// contains filtered or unexported fields
}
func (ChecksumError) Error ¶ added in v1.5.0
func (e ChecksumError) Error() string
func (ChecksumError) Is ¶ added in v1.5.0
func (e ChecksumError) Is(err error) bool
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 ReadOption ¶
type ReadOption func(*SSTableReaderOptions)
func EnableHashCheckOnReads ¶ added in v1.5.0
func EnableHashCheckOnReads() ReadOption
EnableHashCheckOnReads will check data integrity everywhere the value is retrieved, e.g. when getting and scanning. This is off by default, in favor of checking the data integrity during load time.
func ReadBasePath ¶
func ReadBasePath(p string) ReadOption
func ReadWithKeyComparator ¶
func ReadWithKeyComparator(cmp skiplist.Comparator[[]byte]) ReadOption
func SkipHashCheckOnLoad ¶ added in v1.5.0
func SkipHashCheckOnLoad() ReadOption
SkipHashCheckOnLoad will not check hashes against data read from the datafile when loading.
func SkipInvalidHashesOnLoad ¶ added in v1.5.0
func SkipInvalidHashesOnLoad() ReadOption
SkipInvalidHashesOnLoad will not index key/value pairs that have a hash mismatch in them. The database will pretend it does not know those records.
type SSTableFullScanIterator ¶ added in v1.3.0
type SSTableFullScanIterator struct {
// contains filtered or unexported fields
}
SSTableFullScanIterator 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 SSTableMergeIteratorContext ¶ added in v1.4.0
type SSTableMergeIteratorContext struct {
// contains filtered or unexported fields
}
func NewMergeIteratorContext ¶ added in v1.4.0
func NewMergeIteratorContext(context int, iterator SSTableIteratorI) SSTableMergeIteratorContext
func (SSTableMergeIteratorContext) Context ¶ added in v1.4.0
func (s SSTableMergeIteratorContext) Context() int
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.Comparator[[]byte]) SSTableMerger
func (SSTableMerger) Merge ¶ added in v1.1.0
func (m SSTableMerger) Merge(iterators []SSTableMergeIteratorContext, writer SSTableStreamWriterI) (err error)
Merge accepts a slice of sstable iterators to merge into an already opened writer. The caller needs to close the writer.
func (SSTableMerger) MergeCompact ¶ added in v1.3.0
func (m SSTableMerger) MergeCompact(iterators []SSTableMergeIteratorContext, writer SSTableStreamWriterI, reduce ReduceFunc) (err error)
MergeCompact accepts a slice of sstable iterators to merge into an already opened writer. The caller needs to close the writer.
func (SSTableMerger) MergeCompactIterator ¶ added in v1.3.0
func (m SSTableMerger) MergeCompactIterator(iterators []SSTableMergeIteratorContext, reduce ReduceFunc) (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() (err 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 { // Contains returns true when the given key exists, false otherwise Contains(key []byte) bool // Get returns the value associated with the given key, NotFound as the error otherwise Get(key []byte) ([]byte, error) // Scan 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) // ScanStartingAt 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) // ScanRange 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) // Close closes this sstable reader Close() error // MetaData returns the metadata of this sstable MetaData() *proto.MetaData // BasePath 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)) This function will check hashes and validity of the datafile matching the index file.
type SSTableReaderOptions ¶
type SSTableReaderOptions struct {
// contains filtered or unexported fields
}
SSTableReaderOptions contains both read/write options
type SSTableSimpleWriter ¶
type SSTableSimpleWriter struct {
// contains filtered or unexported fields
}
func NewSSTableSimpleWriter ¶
func NewSSTableSimpleWriter(writerOptions ...WriterOption) (*SSTableSimpleWriter, error)
func (*SSTableSimpleWriter) WriteSkipListMap ¶
type SSTableSimpleWriterI ¶
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() (err 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.Comparator[[]byte]) *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() (err 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
}
V0SSTableFullScanIterator 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.Comparator[[]byte]) WriterOption
func WriteBasePath ¶
func WriteBasePath(p string) WriterOption
func WriteBufferSizeBytes ¶ added in v1.3.0
func WriteBufferSizeBytes(bufSizeBytes int) WriterOption