Documentation
¶
Overview ¶
Package logindex is an ordered key-value index on a storage Device that keeps the whole table in memory and writes it as a log.
A commit flushes the device's earlier writes and then appends one record to the current log file with a flush. An ordered commit appends its record without either flush. Recovery replays records only while their sequence continues, so a crash loses at most a suffix of the ordered commits. A checkpoint writes the table to a checkpoint file and then a manifest naming that checkpoint and the first log file written after it, and removes the files the manifest no longer names. Recovery loads the manifest's checkpoint and replays the later log records in sequence order.
The table is a memtable, whose snapshots serve read transactions without locks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Index ¶
type Index struct {
// Table serves the transactions.
*memtable.Table
// contains filtered or unexported fields
}
Index is the log-structured index.
type Options ¶
type Options struct {
// CheckpointBytes is the log length that starts a checkpoint once the log
// is also longer than half the last checkpoint. Zero selects 4 MiB.
CheckpointBytes int64
// Foreground runs each checkpoint inside the commit that starts it and
// returns its error from that commit, which fixes the device call order.
Foreground bool
}
Options configures an Index.