Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var NoValue = MaybeValue{Present: false, Value: nil}
Functions ¶
This section is empty.
Types ¶
type CompactionStats ¶
func (*CompactionStats) AddTimeSince ¶
func (stats *CompactionStats) AddTimeSince(start time.Time)
type Database ¶
type Database struct { Stats *CompactionStats // contains filtered or unexported fields }
A Database is a persistent key-value store.
func Open ¶
Open recovers a Database from an existing on-disk database (of course this also works following a clean shutdown).
func (*Database) Close ¶
func (db *Database) Close()
Close cleanly shuts down the database, and moreover pushes all data to tables for simple recovery.
func (*Database) Compact ¶
func (db *Database) Compact()
Compact manually triggers a full compaction of the log and tables.
func (*Database) DeleteObsoleteFiles ¶
func (db *Database) DeleteObsoleteFiles()
DeleteObsoleteFiles deletes files the database doesn't know about.
This isn't currently correctly called by recovery, but at some point it is required to clean up partially constructed tables that weren't successfully added to the database.
func (*Database) Get ¶
func (db *Database) Get(k Key) MaybeValue
type Decoder ¶
func (Decoder) FixedHandle ¶
func (r Decoder) FixedHandle() SliceHandle
func (Decoder) Handle ¶
func (r Decoder) Handle() SliceHandle
func (*Decoder) IndexEntry ¶
func (r *Decoder) IndexEntry() indexEntry
type Encoder ¶
func (*Encoder) FixedHandle ¶
func (w *Encoder) FixedHandle(h SliceHandle)
func (*Encoder) Handle ¶
func (w *Encoder) Handle(h SliceHandle)
func (*Encoder) IndexEntry ¶
func (w *Encoder) IndexEntry(e indexEntry)
type KeyUpdate ¶
type KeyUpdate struct { Key MaybeValue }
type Manifest ¶
type Manifest struct {
// contains filtered or unexported fields
}
A Manifest is a handle to a set of Tables, along with a separate on-disk data structure to track which tables are part of the database. It manages the underlying tables, recovering and writing to them as necessary, and exports an interface to create tables and install them into the manifest in a crash-safe manner.
func (*Manifest) CreateTable ¶
func (m *Manifest) CreateTable() tableCreator
CreateTable initializes a new table writer
This operation requires write permissions (for silly reasons - it only protects the identifier counter)
func (Manifest) Get ¶
func (m Manifest) Get(k Key) MaybeValue
Get reads a key from the tables managed by the manifest file.
func (*Manifest) InstallTable ¶
func (m *Manifest) InstallTable(newTable Table, youngTables []uint32, level1tables []uint32, level int)
InstallTable adds a previously created table to the tracked tables in the manifest.
Requires that the table already be stored in the right place (using m.CreateTable() and its associated operations).
This operation requires write permissions to the manifest.
type MaybeMaybeValue ¶
type MaybeMaybeValue struct { Valid bool MaybeValue }
MaybeMaybeValue is a poor man's option (option Value).
type MaybeValue ¶
func SomeValue ¶
func SomeValue(v Value) MaybeValue
type SliceHandle ¶
A SliceHandle represents a slice into a file.
This is what LevelDB calls a BlockHandle, but we don't have the same general notion of a variable-sized block.
func (SliceHandle) IsValid ¶
func (h SliceHandle) IsValid() bool
IsValid reports whether a SliceHandle is valid, which requires that it addresses a non-empty range.
type Store ¶
type Store interface { Get(k Key) MaybeValue Put(k Key, v Value) Delete(k Key) // TODO: iterator API Close() }
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
A Table is a handle to and index over a table, the basic immutable storage unit of the database (the equivalent of an SSTable in LevelDB, which is the SSTable of Bigtable).
func (Table) Get ¶
func (t Table) Get(k Key) MaybeMaybeValue
Get reads a key from the table.
Since tables represent only part of the database, this Get returns a MaybeMaybeValue to represent a key that is not part of the table, as opposed to a key the table has a deletion marker for.
func (Table) Updates ¶
func (t Table) Updates() UpdateIterator
Updates returns all the updates (puts an deletes) the table holds.
type UpdateIterator ¶
func MergeUpdates ¶
func MergeUpdates(iterators []UpdateIterator) UpdateIterator
MergeUpdates takes several iterators and produces a merged iterator.
iterators should be sorted by key, and MergeUpdates will produce an iterator that is also sorted.