Documentation ¶
Overview ¶
Package table implements lookup table interfaces for protobufs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoSuchKey = errors.New("no such key")
ErrNoSuchKey is returned when a value was not found for a particular key.
Functions ¶
This section is empty.
Types ¶
type Inverted ¶
type Inverted interface { io.Closer // Lookup returns a slice of []byte keys associated with the given value. If // prefix is true, all keys associated with values with val as their prefix // will be returned, otherwise val is exactly matched. Lookup(val []byte, prefix bool) ([][]byte, error) // Contains determines whether there is an association between key and val. // If prefix is true, if key is associated with any value with val as its // prefix true will be returned, otherwise val must be exactly associated with // key. Contains(key, val []byte, prefix bool) (bool, error) // Put writes an entry associating val with key. Put(key, val []byte) error }
Inverted is an inverted index lookup table for []byte values with associated []byte keys. Keys and values should not contain \000 bytes.
type KVInverted ¶
KVInverted implements an Inverted table in a keyvalue.DB.
func (*KVInverted) Contains ¶
func (i *KVInverted) Contains(key, val []byte, prefixLookup bool) (found bool, err error)
Contains implements part of the Inverted interface.
func (*KVInverted) Lookup ¶
func (i *KVInverted) Lookup(val []byte, prefixLookup bool) ([][]byte, error)
Lookup implements part of the Inverted interface.
func (*KVInverted) Put ¶
func (i *KVInverted) Put(key, val []byte) error
Put implements part of the Inverted interface.
type KVProto ¶
KVProto implements a Proto table using a keyvalue.DB.
type Proto ¶
type Proto interface { io.Closer // Lookup unmarshals the value for the given key into msg, returning any // error. If the key was not found, ErrNoSuchKey is returned. Lookup(key []byte, msg proto.Message) error // Put marshals msg and writes it as the value for the given key. Put(key []byte, msg proto.Message) error }
Proto is a key-value direct lookup table with protobuf values.
Click to show internal directories.
Click to hide internal directories.