mem

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogPath

func SetLogPath(path string)

SetLogPath sets the folder in which all of the log are to be stored. The log directory is the same as the sstable directory.

Types

type MEM

type MEM struct {
	// contains filtered or unexported fields
}

MEM represents the in-memory data

func CreateTableFromLog

func CreateTableFromLog(logFilePath string) (*MEM, error)

CreateTableFromLog constructs a memory table from the contents of a log file. This is used to check if some memtables were left in-memory when closing.

func New

func New() *MEM

New creates a new instance of a memory table

func (*MEM) AppendToLog

func (m *MEM) AppendToLog(key, value string) error

AppendToLog takes in a key-value pair and appends that to the file pointer.

func (*MEM) ConvertIntoEntries

func (m *MEM) ConvertIntoEntries() []*entries.Entry

ConvertIntoEntries converts the database key-value pairs into entries which are then used to write values to the disk

func (*MEM) DeleteLogFile

func (m *MEM) DeleteLogFile() error

DeleteLogFile deletes the log file after all of the values have been stored into an sstable

func (*MEM) Get

func (m *MEM) Get(key string) (string, bool)

Get finds a value in the table and returns a status on if the item is found.

func (*MEM) GetTree

func (m *MEM) GetTree() *redblacktree.Tree

GetTree returns the tree of the table. This is used for copying the data for flushing

func (*MEM) PopulateLogFile

func (m *MEM) PopulateLogFile() error

PopulateLogFile opens/creates the log file, and it handles settings the logFile file-pointer to the file with the logFilePath

func (*MEM) Put

func (m *MEM) Put(key, val string) error

Put adds a value to the data

func (*MEM) Remove

func (m *MEM) Remove() error

Remove removes the log file after the memtable is written into persistent storage.

func (*MEM) Size

func (m *MEM) Size() int64

Size returns the amount of elements in the table

Jump to

Keyboard shortcuts

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