cdb

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2022 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	INITIAL_POINTERS = 256
	CDB_HASH_START   = 5381
)

Variables

View Source
var (
	ErrFinished = fmt.Errorf("Finish() was already called on this writer")
)

Functions

This section is empty.

Types

type Dumper

type Dumper struct {
	// contains filtered or unexported fields
}

func NewDumper

func NewDumper(r io.ReaderAt) *Dumper

NewDumper returns a new cdb dumper.

func (*Dumper) GetEntry

func (d *Dumper) GetEntry() (k []byte, v []byte, ok bool)

GetEntry returns the next entry to dump. Both the key and value are returned, ok is set to true if data was fetched.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func New

func New(r io.ReaderAt) *Reader

New creates a new *cdb.Reader from an open read seeker.

func OpenReader

func OpenReader(cdb string) (*Reader, error)

OpenReader creates a new *cdb.Reader from a path.

func (*Reader) Close

func (r *Reader) Close() error

Close closes a previously opened file.

func (*Reader) Get

func (r *Reader) Get(k []byte) ([]byte, bool, error)

Get returns the first occurence of the given key.

func (*Reader) GetNext

func (r *Reader) GetNext() ([]byte, bool, error)

GetNext returns the next occurence of a previouly set key.

func (*Reader) SetQuery

func (r *Reader) SetQuery(k []byte) error

Set query configures this reader for a new query.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(w io.WriterAt) *Writer

NewWriter returns a new cdb writer.

func OpenWriter

func OpenWriter(cdb string) (*Writer, error)

OpenWriter creates a new file and returns a writer to it.

func (*Writer) Close

func (w *Writer) Close() error

Close closes a writer which was previously created with OpenWriter and calls 'Finish()' if required.

func (*Writer) Finish

func (w *Writer) Finish() error

Finish finalizes a cdb writer.

func (*Writer) Put

func (w *Writer) Put(k, v []byte) error

Put puts a new key into the CDB.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL