Documentation
¶
Overview ¶
Package mcdb contains multiple Constant Databases (DJB's cdb), as one cdb can only contain 4GiB maximum.
This is a thin wrapper over github.com/colinmarc/cdb.
Index ¶
Constants ¶
const ( FileName = "mcdb-v%d-%d,%b.cdb" FileNameV0 = "mcdb-%d,%b.cdb" )
const DefaultVersion = Version(1)
Variables ¶
This section is empty.
Functions ¶
func Dump ¶ added in v0.4.0
Dump the given data key, value pair in cdbmake format ("+%d,%d:%s->%s\n", len(key), len(value), key, value)
Types ¶
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator iterates through all keys of all CDB files.
func (*Iterator) Dump ¶ added in v0.1.0
Dump the current Iterator position data in cdbmake format ("+%d,%d:%s->%s\n", len(key), len(value), key, value).
func (*Iterator) Next ¶
Next advances the iterator, if possible.
It reads the next key/value pair and advances the iterator one record. It returns false when the scan stops, either by reaching the end of the database or an error. After Next returns false, the Err method will return any error that occurred while iterating.
type Reader ¶
type Reader struct { Config // contains filtered or unexported fields }
Reader is a reader for multiple CDB files.
func (*Reader) Dump ¶ added in v0.1.0
Dump all the underlying data in cdbmake format ("+%d,%d:%s->%s\n", len(key), len(value), key, value)
func (*Reader) DumpContext ¶ added in v0.3.0
DumpContext dumps all the underlying data in cdbmake format ("+%d,%d:%s->%s\n", len(key), len(value), key, value)
type Writer ¶
type Writer struct { Config // contains filtered or unexported fields }
Writer is the writer. It needs the number of tables beforehand.
func NewWriter ¶
NewWriter returns a new Writer.
The next power-of-two number of tables are created, so for example with n=3, 4 tables are created, containing maximum 16GiB of data.
If n<=0 then automatic growing is enabled, with the starting number of tables being abs(n)
func (*Writer) Load ¶ added in v0.1.0
Load the Writer from cdbmake format ("+%d,%d:%s->%s\n", len(key), len(value), key, value).
func (*Writer) LoadContext ¶ added in v0.3.0
LoadContext the Writer from cdbmake format ("+%d,%d:%s->%s\n", len(key), len(value), key, value).