Documentation ¶
Overview ¶
Package cdbmap reads and writes cdb ("constant database") files.
See the original cdb specification and C implementation by D. J. Bernstein at http://cr.yp.to/cdb.html.
Index ¶
- Constants
- Variables
- func Dump(w io.Writer, r io.Reader) (err error)
- func FromFile(filename string) (map[string][]string, error)
- func Make(w io.WriteSeeker, r io.Reader) (err error)
- func Read(r io.ReaderAt) (map[string][]string, error)
- func ToFile(m map[string][]string, f string) (err error)
- func Write(m map[string][]string, w io.WriteSeeker) (err error)
Constants ¶
const (
HeaderSize = uint32(256 * 8)
)
Variables ¶
var BadFormatError = errors.New("bad format")
Functions ¶
func Dump ¶
Dump reads the cdb-formatted data in r and dumps it as a series of formatted records (+klen,dlen:key->data\n) and a final newline to w. The output of Dump is suitable as input to Make. See http://cr.yp.to/cdb/cdbmake.html for details on the record format.
func FromFile ¶
FromFile is a convenience function that reads a CDB-formatted file from the specified filename, and returns the CDB contents in map[string][]string form (or an error if the map can't be written for some reason).
func Make ¶
func Make(w io.WriteSeeker, r io.Reader) (err error)
Make reads cdb-formatted records from r and writes a cdb-format database to w. See the documentation for Dump for details on the input record format.
Types ¶
This section is empty.