Documentation ¶
Index ¶
- Constants
- type SSTable
- func ConstructFromMemtable(directory string, mem *mem.MEM) (*SSTable, error)
- func FromTree(directory string, tree *redblacktree.Tree) (*SSTable, error)
- func NewSSTable(name string) *SSTable
- func NewSSTableWithFilter(name string, filter *bloom.BloomFilter) *SSTable
- func ParseSSTableFromFile(path string) (*SSTable, error)
- func (ss *SSTable) AppendToTable(e *entries.Entry) error
- func (ss *SSTable) Close() error
- func (ss *SSTable) Get(key string) (string, bool)
- func (ss *SSTable) GetFilterFilename() string
- func (ss *SSTable) ParseFilterFromDirectory() error
- func (ss *SSTable) PopulateReadOnlyFile() error
- func (ss *SSTable) ReadFromOffset(key string) (string, error)
- func (ss *SSTable) WriteFilterToDisk() error
Constants ¶
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 ¶
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 ¶
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 ¶
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 ¶
AppendToFile adds the given entry to the end of a table and adds that to the bloom filter
func (*SSTable) GetFilterFilename ¶
GetFilterFilename removes the .ss suffix and returns the same file with the .fltr name.
func (*SSTable) ParseFilterFromDirectory ¶
ParseFilterFromTable reads a filter file containing the data for a bloom filter and then builds the sstables bloom filter from it.
func (*SSTable) PopulateReadOnlyFile ¶
PopulateReadOnlyFile populates the 'file' field in the sstable for faster access
func (*SSTable) ReadFromOffset ¶
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 ¶
WriteFilterToDisk takes the bloom filter and places it into disk