table

package
v0.0.0-...-1975910 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2013 License: BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package table allows read and write sorted key/value.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

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

Reader represent a table reader.

func NewReader

func NewReader(r storage.Reader, size uint64, o opt.OptionsGetter, cache cache.Namespace) (p *Reader, err error)

NewReader create new initialized table reader.

func (*Reader) ApproximateOffsetOf

func (t *Reader) ApproximateOffsetOf(key []byte) uint64

ApproximateOffsetOf approximate the offset of given key in bytes.

func (*Reader) Get

func (t *Reader) Get(key []byte, ro opt.ReadOptionsGetter) (rkey, rvalue []byte, err error)

Get lookup for given key on the table. Get returns errors.ErrNotFound if given key did not exist.

func (*Reader) NewIterator

func (t *Reader) NewIterator(ro opt.ReadOptionsGetter) iterator.Iterator

NewIterator create new iterator over the table.

type Writer

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

Writer represent a table writer.

func NewWriter

func NewWriter(w storage.Writer, o opt.OptionsGetter) *Writer

NewWriter create new initialized table writer.

func (*Writer) Add

func (t *Writer) Add(key, value []byte) (err error)

Add append key/value to the table.

func (*Writer) CountBlock

func (t *Writer) CountBlock() int

CountBlock return the number of data block written so far.

func (*Writer) Finish

func (t *Writer) Finish() (err error)

Finish finalize the table. No Add(), Flush() or Finish() is possible beyond this, doing so will raise panic.

func (*Writer) Flush

func (t *Writer) Flush() (err error)

Flush finalize and write the data block.

func (*Writer) Len

func (t *Writer) Len() int

Len return the number of records added so far.

func (*Writer) Size

func (t *Writer) Size() int

Size return the number of bytes written so far.

Jump to

Keyboard shortcuts

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