sstable

package
v0.0.0-...-2976f93 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MaxTableSize = 1 << 20

If the buffer exceeds this size it is writen to disk

Variables

This section is empty.

Functions

This section is empty.

Types

type SSTable

type SSTable struct {
	Tree        *redblacktree.Tree // Mappings to the key offsets in the file.
	Filename    string             // the file in which the sstable is stored
	BloomFilter *bloom.BloomFilter
	// contains filtered or unexported fields
}

SSTable represents a sorted list of key-value pairs stored in a given file.

func ConstructFromMemtable

func ConstructFromMemtable(directory string, mem *mem.MEM) (*SSTable, error)

ConstructFromMemtable takes creates a sstable with the corrent offset map from a memory table

func FromTree

func FromTree(directory string, tree *redblacktree.Tree) (*SSTable, error)

FromTree creates a sstable and fills the offsets from a tree

func NewSSTable

func NewSSTable(name string) *SSTable

NewSSTable creates a sstable instance with a filename pointing to the sstable.

func NewSSTableWithFilter

func NewSSTableWithFilter(name string, filter *bloom.BloomFilter) *SSTable

NewSSTableWithFilter returns a sstable with a given filename and filter

func ParseSSTableFromFile

func ParseSSTableFromFile(path string) (*SSTable, error)

ParseSSTableFromFile takes in a file path and parses that file's bloom filter file and it also scans all of the entries in the file and then creates the offset map.

func (*SSTable) AppendToTable

func (ss *SSTable) AppendToTable(e *entries.Entry) error

AppendToFile adds the given entry to the end of a table and adds that to the bloom filter

func (*SSTable) Close

func (ss *SSTable) Close() error

func (*SSTable) Get

func (ss *SSTable) Get(key string) (string, bool)

Get finds a key from the list of sstable files.

func (*SSTable) GetFilterFilename

func (ss *SSTable) GetFilterFilename() string

GetFilterFilename removes the .ss suffix and returns the same file with the .fltr name.

func (*SSTable) ParseFilterFromDirectory

func (ss *SSTable) ParseFilterFromDirectory() error

ParseFilterFromTable reads a filter file containing the data for a bloom filter and then builds the sstables bloom filter from it.

func (*SSTable) PopulateReadOnlyFile

func (ss *SSTable) PopulateReadOnlyFile() error

PopulateReadOnlyFile populates the 'file' field in the sstable for faster access

func (*SSTable) ReadFromOffset

func (ss *SSTable) ReadFromOffset(key string) (string, error)

ReadFromOffset is an optimized read function that reads for the offset map the part of the sstable where the key-value pair is. This of course consumes more memory, but the read performance is better.

func (*SSTable) WriteFilterToDisk

func (ss *SSTable) WriteFilterToDisk() error

WriteFilterToDisk takes the bloom filter and places it into disk

Jump to

Keyboard shortcuts

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