Documentation ¶
Overview ¶
Package table implements lookup table interfaces for protobufs.
Index ¶
- Variables
- type BufferedProto
- type KVProto
- func (t *KVProto) Buffered() BufferedProto
- func (t *KVProto) Close(ctx context.Context) error
- func (t *KVProto) Lookup(ctx context.Context, key []byte, msg proto.Message) error
- func (t *KVProto) LookupValues(ctx context.Context, key []byte, m proto.Message, f func(proto.Message) error) error
- func (t *KVProto) Put(ctx context.Context, key []byte, msg proto.Message) error
- type Proto
- type ProtoLookup
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.
View Source
var ErrStopLookup = errors.New("stop lookup")
ErrStopLookup should be returned from the function passed to LookupValues when the client wants no further values.
Functions ¶
This section is empty.
Types ¶
type BufferedProto ¶ added in v0.0.16
type BufferedProto interface { // Put marshals msg and writes it as the value for the given key. Put(ctx context.Context, key []byte, msg proto.Message) error // Flush sends all buffered writes to the underlying table. Flush(ctx context.Context) error }
BufferedProto buffers calls to Put to provide a high throughput write interface to a Proto table.
type KVProto ¶
KVProto implements a Proto table using a keyvalue.DB.
func (*KVProto) Buffered ¶ added in v0.0.16
func (t *KVProto) Buffered() BufferedProto
Buffered implements part of the Proto interface.
type Proto ¶
type Proto interface { ProtoLookup // Put marshals msg and writes it as the value for the given key. Put(ctx context.Context, key []byte, msg proto.Message) error // Buffered returns a buffered write interface. Buffered() BufferedProto // Close release the underlying resources for the table. Close(context.Context) error }
Proto is a key-value direct lookup table with protobuf values.
type ProtoLookup ¶ added in v0.0.28
type ProtoLookup interface { // Lookup unmarshals the value for the given key into msg, returning any // error. If the key was not found, ErrNoSuchKey is returned. Lookup(ctx context.Context, key []byte, msg proto.Message) error // Lookup unmarshals the values for the given key into new proto.Message using // m, returning any error. If the key was not found, f is never called. LookupValues(ctx context.Context, key []byte, m proto.Message, f func(msg proto.Message) error) error }
ProtoLookup is a read-only key-value direct lookup table with protobuf values.
Click to show internal directories.
Click to hide internal directories.