table

package
v0.0.64 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0, NCSA Imports: 6 Imported by: 9

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.

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

type KVProto struct{ keyvalue.DB }

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.

func (*KVProto) Close added in v0.0.9

func (t *KVProto) Close(ctx context.Context) error

Close implements part of the Proto interface.

func (*KVProto) Lookup

func (t *KVProto) Lookup(ctx context.Context, key []byte, msg proto.Message) error

Lookup implements part of the Proto interface.

func (*KVProto) LookupValues added in v0.0.63

func (t *KVProto) LookupValues(ctx context.Context, key []byte, m proto.Message, f func(proto.Message) error) error

LookupValues implements part of the ProtoLookup interface.

func (*KVProto) Put

func (t *KVProto) Put(ctx context.Context, key []byte, msg proto.Message) error

Put 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.

Jump to

Keyboard shortcuts

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