common

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrunePrefixes

func PrunePrefixes(prefixes []string) []string

PrunePrefixes will return all the top level prefixes from a given list so that any enumerate on these prefixes will not end up returning duplicate keys

func ToBytes

func ToBytes(val interface{}) ([]byte, error)

ToBytes converts to value to a byte slice.

Types

type BaseKvdb

type BaseKvdb struct {
	// LockTimeout is the maximum time any lock can be held
	LockTimeout time.Duration
	// FatalCb invoked for fatal errors
	FatalCb kvdb.FatalErrorCB
	// contains filtered or unexported fields
}

BaseKvdb provides common functionality across kvdb types

func (*BaseKvdb) CheckLockTimeout

func (b *BaseKvdb) CheckLockTimeout(
	key string,
	startTime time.Time,
	lockTimeout time.Duration,
)

CheckLockTimeout checks lock timeout.

func (*BaseKvdb) DeserializeAll

func (b *BaseKvdb) DeserializeAll(out []byte) (kvdb.KVPairs, error)

DeserializeAll Unmarshals a byte stream created from serializeAll into the kvdb tree.

func (*BaseKvdb) GetLockTimeout

func (b *BaseKvdb) GetLockTimeout() time.Duration

GetLockTimeout gets lock timeout.

func (*BaseKvdb) LockTimedout

func (b *BaseKvdb) LockTimedout(key string)

LockTimedout does lock timedout.

func (*BaseKvdb) SerializeAll

func (b *BaseKvdb) SerializeAll(kvps kvdb.KVPairs) ([]byte, error)

SerializeAll Serializes all key value pairs to a byte array.

func (*BaseKvdb) SetFatalCb

func (b *BaseKvdb) SetFatalCb(f kvdb.FatalErrorCB)

SetFatalCb callback is invoked when an unrecoverable KVDB error happens.

func (*BaseKvdb) SetLockTimeout

func (b *BaseKvdb) SetLockTimeout(timeout time.Duration)

SetLockTimeout has property such that if the lock is held past this duration, then a configured fatal callback is called.

type WatchUpdateQueue

type WatchUpdateQueue interface {
	// Enqueue will enqueue an update. It is non-blocking.
	Enqueue(key string, kvp *kvdb.KVPair, err error)
	// Dequeue will either return an element from front of the queue or
	// will block until element becomes available
	Dequeue() (string, *kvdb.KVPair, error)
}

WatchUpdateQueue is a producer consumer queue.

func NewWatchUpdateQueue

func NewWatchUpdateQueue() WatchUpdateQueue

NewWatchUpdateQueue returns WatchUpdateQueue

Jump to

Keyboard shortcuts

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