server

package
v0.0.0-...-1be9e8e Latest Latest
Warning

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

Go to latest
Published: May 13, 2018 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxKeySize   uint32 = 4 * 1024
	MaxValueSize uint32 = 512 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Descriptor

type Descriptor struct {
	// Current is the current descriptor
	Current *pb.DescriptorProto
	// contains filtered or unexported fields
}

Descriptor describes all important DB state. Not thread-safe, access should be externally synchronized.

func LoadDescriptor

func LoadDescriptor(dir string) (*Descriptor, error)

LoadDescriptor loads the highest numbered descriptor found in dir.

func NewDescriptor

func NewDescriptor(dir string) *Descriptor

NewDescriptor returns a Descriptor for a brand new database. Most use cases should probably use LoadDescriptor instead.

func (*Descriptor) Save

func (d *Descriptor) Save() error

Save persists Descriptor to stable storage.

type Iter

type Iter interface {
	// Next advances the iterator. Returns true if there is a next value.
	Next() (bool, error)

	// Key returns the key of the current row.
	Key() string

	// Timestamp returns the timestamp of the current row.
	Timestamp() int64

	// Value returns the value of the current row.
	Value() []byte

	// Close closes the iterator.
	Close()
}

Iter is an iterator over rows.

func NewIterFromRows

func NewIterFromRows(rows []KTV) Iter

NewIterFromRows returns an Iter represents rows. rows must not be modified after.

type KTV

type KTV struct {
	Key       string
	Timestamp int64
	Value     []byte
}

type Options

type Options struct {
	SstDir            string
	MemtableFlushSize int64

	LogDir        string
	TargetLogSize int64

	// BlockCacheSize is the size of the block cache. 0 disables the cache.
	BlockCacheSize int64

	DescriptorDir string
}

func DefaultOptions

func DefaultOptions(baseDir string) Options

type Server

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

func NewServer

func NewServer(opts Options) *Server

func (*Server) Get

func (s *Server) Get(ctx context.Context, req *pb.GetRequest) (*pb.GetResponse, error)

func (*Server) Set

func (s *Server) Set(ctx context.Context, req *pb.SetRequest) (*pb.SetResponse, error)

Jump to

Keyboard shortcuts

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