Documentation ¶
Index ¶
- Variables
- func CompressBlock(tp CompressionType, input, dst []byte) ([]byte, bool)
- func DecompressBlock(tp CompressionType, input, dst []byte) ([]byte, error)
- type BlockBasedTableBuilder
- type BlockBasedTableOptions
- type ChecksumType
- type CompactedEvent
- type Comparator
- type CompressionType
- type FixedPrefixSliceTransform
- type FixedSuffixSliceTransform
- type InternalKey
- type NoopSliceTransform
- type PropsBlockBuilder
- type PropsInjector
- type SliceTransform
- type SstFileIterator
- type SstFileWriter
- type TableProperties
- type ValueType
Constants ¶
This section is empty.
Variables ¶
var ( ErrChecksumMismatch = errors.New("Checksum mismatch") ErrMagicNumberMismatch = errors.New("Magic number mismatch") )
Error
var ( ErrKeyOrder = errors.New("Keys must be added in order") ErrNotSupportType = errors.New("Value type is not supported") )
Error
var ErrDecompress = errors.New("Error during decompress")
ErrDecompress is returned when there is error during decompress.
Functions ¶
func CompressBlock ¶
func CompressBlock(tp CompressionType, input, dst []byte) ([]byte, bool)
CompressBlock compresses input into dst. If you have a buffer to use, you can pass it to prevent allocation. If it is too small, or if nil is passed, a new buffer will be allocated and returned.
func DecompressBlock ¶
func DecompressBlock(tp CompressionType, input, dst []byte) ([]byte, error)
DecompressBlock decompresses input into dst. If you have a buffer to use, you can pass it to prevent allocation. If it is too small, or if nil is passed, a new buffer will be allocated and returned.
Types ¶
type BlockBasedTableBuilder ¶
type BlockBasedTableBuilder struct {
// contains filtered or unexported fields
}
BlockBasedTableBuilder is used in building a block-based table.
func NewBlockBasedTableBuilder ¶
func NewBlockBasedTableBuilder(f *os.File, opts *BlockBasedTableOptions) *BlockBasedTableBuilder
NewBlockBasedTableBuilder makes a new BlockBasedTableBuilder.
func (*BlockBasedTableBuilder) Add ¶
func (b *BlockBasedTableBuilder) Add(key, value []byte) error
Add adds a key-value pair to the BlockBasedTableBuilder.
func (*BlockBasedTableBuilder) Finish ¶
func (b *BlockBasedTableBuilder) Finish() error
Finish finishes the BlockBasedTableBuilder.
type BlockBasedTableOptions ¶
type BlockBasedTableOptions struct { BlockSize int BlockSizeDeviation int BlockRestartInterval int IndexBlockRestartInterval int BlockAlign bool CompressionType CompressionType ChecksumType ChecksumType EnableIndexCompression bool CreationTime uint64 OldestKeyTime uint64 PropsInjectors []PropsInjector BloomBitsPerKey int BloomNumProbes int WholeKeyFiltering bool PrefixExtractorName string PrefixExtractor SliceTransform Comparator Comparator BufferSize int BytesPerSync int RateLimiter *rate.Limiter }
BlockBasedTableOptions represents block-based table options.
func NewDefaultBlockBasedTableOptions ¶
func NewDefaultBlockBasedTableOptions(cmp Comparator) *BlockBasedTableOptions
NewDefaultBlockBasedTableOptions creates a default BlockBasedTableOptions object.
type ChecksumType ¶
type ChecksumType uint8
ChecksumType defines the type of check sum.
const ( ChecksumNone ChecksumType = 0x0 ChecksumCRC32 ChecksumType = 0x1 ChecksumXXHash ChecksumType = 0x2 )
ChecksumType
type CompactedEvent ¶
type CompactedEvent struct { OutputLevel int TotalInputBytes int TotalOutputBytes int StartKey []byte EndKey []byte }
CompactedEvent represents a compacted event.
type Comparator ¶
Comparator represents a compare function.
func (Comparator) CompareInternalKey ¶
func (c Comparator) CompareInternalKey(key1, key2 []byte) int
CompareInternalKey compares two keys order by:
increasing user key (according to user-supplied comparator) decreasing sequence number decreasing type (though sequence# should be enough to disambiguate)
type CompressionType ¶
type CompressionType uint8
CompressionType specifies how a block should be compressed.
const ( CompressionNone CompressionType = 0x0 CompressionSnappy CompressionType = 0x1 CompressionLz4 CompressionType = 0x4 CompressionZstd CompressionType = 0x7 )
CompressionType
func (CompressionType) String ¶
func (tp CompressionType) String() string
String provides a string representation of the compression type.
type FixedPrefixSliceTransform ¶
type FixedPrefixSliceTransform struct {
// contains filtered or unexported fields
}
FixedPrefixSliceTransform represents the fixed prefix SliceTransform.
func NewFixedPrefixSliceTransform ¶
func NewFixedPrefixSliceTransform(prefixLen int) *FixedPrefixSliceTransform
NewFixedPrefixSliceTransform returns a new fixed prefix SliceTransform.
func (*FixedPrefixSliceTransform) InDomain ¶
func (st *FixedPrefixSliceTransform) InDomain(key []byte) bool
InDomain implements the SliceTransform InDomain method.
func (*FixedPrefixSliceTransform) InRange ¶
func (st *FixedPrefixSliceTransform) InRange(key []byte) bool
InRange implements the SliceTransform InRange method.
func (*FixedPrefixSliceTransform) Transform ¶
func (st *FixedPrefixSliceTransform) Transform(key []byte) []byte
Transform implements the SliceTransform Transform method.
type FixedSuffixSliceTransform ¶
type FixedSuffixSliceTransform struct {
// contains filtered or unexported fields
}
FixedSuffixSliceTransform represents the fixed suffix SliceTransform.
func NewFixedSuffixSliceTransform ¶
func NewFixedSuffixSliceTransform(suffixLen int) *FixedSuffixSliceTransform
NewFixedSuffixSliceTransform returns a new fixed suffix SliceTransform.
func (*FixedSuffixSliceTransform) InDomain ¶
func (st *FixedSuffixSliceTransform) InDomain(key []byte) bool
InDomain implements the SliceTransform InDomain method.
func (*FixedSuffixSliceTransform) InRange ¶
func (st *FixedSuffixSliceTransform) InRange(key []byte) bool
InRange implements the SliceTransform InRange method.
func (*FixedSuffixSliceTransform) Transform ¶
func (st *FixedSuffixSliceTransform) Transform(key []byte) []byte
Transform implements the SliceTransform Transform method.
type InternalKey ¶
InternalKey is a key used for the sst.
func (*InternalKey) Decode ¶
func (ikey *InternalKey) Decode(encoded []byte)
Decode decodes the InternalKey.
func (*InternalKey) Encode ¶
func (ikey *InternalKey) Encode() []byte
Encode encodes the InternalKey.
type NoopSliceTransform ¶
type NoopSliceTransform struct{}
NoopSliceTransform represents the noop SliceTransform.
func NewNoopSliceTransform ¶
func NewNoopSliceTransform() *NoopSliceTransform
NewNoopSliceTransform returns a new noop SliceTransform.
func (*NoopSliceTransform) InDomain ¶
func (st *NoopSliceTransform) InDomain(key []byte) bool
InDomain implements the SliceTransform InDomain method.
func (*NoopSliceTransform) InRange ¶
func (st *NoopSliceTransform) InRange(key []byte) bool
InRange implements the SliceTransform InRange method.
func (*NoopSliceTransform) Transform ¶
func (st *NoopSliceTransform) Transform(key []byte) []byte
Transform implements the SliceTransform Transform method.
type PropsBlockBuilder ¶
type PropsBlockBuilder struct {
// contains filtered or unexported fields
}
PropsBlockBuilder represents a properties block builder.
func (*PropsBlockBuilder) Add ¶
func (b *PropsBlockBuilder) Add(name string, value []byte)
Add adds an []byte value with the given name.
func (*PropsBlockBuilder) AddString ¶
func (b *PropsBlockBuilder) AddString(name, value string)
AddString adds an string value with the given name.
func (*PropsBlockBuilder) AddUint64 ¶
func (b *PropsBlockBuilder) AddUint64(name string, value uint64)
AddUint64 adds an uint64 value with the given name.
func (*PropsBlockBuilder) Finish ¶
func (b *PropsBlockBuilder) Finish() []byte
Finish finishes the PropsBlockBuilder.
type PropsInjector ¶
type PropsInjector func(*PropsBlockBuilder)
PropsInjector is a function of properties injector.
type SliceTransform ¶
type SliceTransform interface { Transform([]byte) []byte InDomain([]byte) bool InRange([]byte) bool }
SliceTransform can be used as a extractor.
type SstFileIterator ¶
type SstFileIterator struct {
// contains filtered or unexported fields
}
SstFileIterator is an iterator for an SST file.
func NewSstFileIterator ¶
func NewSstFileIterator(f *os.File) (*SstFileIterator, error)
NewSstFileIterator returns a new SstFileIterator.
func (*SstFileIterator) Err ¶
func (it *SstFileIterator) Err() error
Err returns the SstFileIterator err
func (*SstFileIterator) Key ¶
func (it *SstFileIterator) Key() InternalKey
Key returns the key associated with the current SstFileIterator
func (*SstFileIterator) Next ¶
func (it *SstFileIterator) Next()
Next moves the SstFileIterator to the next key.
func (*SstFileIterator) SeekToFirst ¶
func (it *SstFileIterator) SeekToFirst()
SeekToFirst moves the iterator to the first key.
func (*SstFileIterator) Valid ¶
func (it *SstFileIterator) Valid() bool
Valid returns whether the SstFileIterator is exhausted.
func (*SstFileIterator) Value ¶
func (it *SstFileIterator) Value() []byte
Value returns the value associated with the current SstFileIterator
type SstFileWriter ¶
type SstFileWriter struct {
// contains filtered or unexported fields
}
SstFileWriter is used to create sst files that can be added to database later.
func NewSstFileWriter ¶
func NewSstFileWriter(f *os.File, opts *BlockBasedTableOptions) *SstFileWriter
NewSstFileWriter creates an SstFileWriter object.
func (*SstFileWriter) Delete ¶
func (w *SstFileWriter) Delete(key []byte) error
Delete deletes a key-value pair from SstFileWriter.
func (*SstFileWriter) Finish ¶
func (w *SstFileWriter) Finish() error
Finish finishes the SstFileWriter.
func (*SstFileWriter) Merge ¶
func (w *SstFileWriter) Merge(key, value []byte) error
Merge merges a key-value pair.
func (*SstFileWriter) Put ¶
func (w *SstFileWriter) Put(key, value []byte) error
Put puts a key-value pair to SstFileWriter.
type TableProperties ¶
type TableProperties struct { DataSize uint64 IndexSize uint64 FilterSize uint64 RawKeySize uint64 RawValueSize uint64 NumDataBlocks uint64 NumEntries uint64 ColumnFamilyID uint64 ColumnFamilyName string CompressionName string FilterPolicyName string CreationTime uint64 OldestKeyTime uint64 PrefixExtractorName string }
TableProperties represents table properties.