Documentation
¶
Overview ¶
Package cdb provides a native implementation of cdb, a constant key/value database with some very nice properties.
For more information on cdb, see the original design doc at http://cr.yp.to/cdb.html.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrTooMuchData = errors.New("CDB files are limited to 4GB of data")
Functions ¶
Types ¶
type CDB ¶
type CDB struct {
// contains filtered or unexported fields
}
CDB represents an open CDB database. It can only be used for reads; to create a database, use Writer.
func New ¶
New opens a new CDB instance for the given io.ReaderAt. It can only be used for reads; to create a database, use Writer.
If hasher is nil, it will default to the CDB hash function. If a database was created with a particular hash function, that same hash function must be passed to New, or the database will return incorrect results.
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator represents a sequential iterator over a CDB database.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer provides an API for creating a CDB database record by record.
Close or Freeze must be called to finalize the database, or the resulting file will be invalid.
func Create ¶
Create opens a CDB database at the given path. If the file exists, it will be overwritten.
func NewWriter ¶
NewWriter opens a CDB database for the given io.WriteSeeker.
If hasher is nil, it will default to the CDB hash function.
func (*Writer) Close ¶
Close finalizes the database, then closes it to further writes.
Close or Freeze must be called to finalize the database, or the resulting file will be invalid.