y

package
v0.0.0-...-cb5117c Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// These are cumulative
	NumGets         *expvar.Int
	NumPuts         *expvar.Int
	NumReads        *expvar.Int
	NumWrites       *expvar.Int
	NumBytesRead    *expvar.Int
	NumBytesWritten *expvar.Int
	NumMemtableGets *expvar.Int
	NumLSMGets      *expvar.Map
	NumLSMBloomHits *expvar.Map
)

Functions

func AssertTrue

func AssertTrue(b bool)

AssertTrue asserts that b is true. Otherwise, it would log fatal.

func AssertTruef

func AssertTruef(b bool, format string, args ...interface{})

AssertTruef is AssertTrue with extra info.

func Check

func Check(err error)

Check logs fatal if err != nil.

func Check2

func Check2(_ interface{}, err error)

Check2 acts as convenience wrapper around Check, using the 2nd argument as error.

func OpenSyncedFile

func OpenSyncedFile(filename string, sync bool) (*os.File, error)

func Safecopy

func Safecopy(a []byte, src []byte) []byte

func Wrap

func Wrap(err error) error

Wrap wraps errors from external lib.

func Wrapf

func Wrapf(err error, format string, args ...interface{}) error

Wrapf is Wrap with extra info.

Types

type Closer

type Closer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewCloser

func NewCloser() *Closer

func (*Closer) Get

func (c *Closer) Get(name string) *LevelCloser

func (*Closer) Register

func (c *Closer) Register(name string) *LevelCloser

func (*Closer) SignalAll

func (c *Closer) SignalAll()

func (*Closer) WaitForAll

func (c *Closer) WaitForAll()

type DirectoryLockGuard

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

DirectoryLockGuard holds a lock on a directory and a pid file inside. The pid file isn't part of the locking mechanism, it's just advisory.

func AcquireDirectoryLock

func AcquireDirectoryLock(dirPath string, pidFileName string) (*DirectoryLockGuard, error)

AcquireDirectoryLock gets an exclusive lock on the directory (using flock). It writes our pid to dirPath/pidFileName for convenience.

func (*DirectoryLockGuard) Release

func (guard *DirectoryLockGuard) Release() error

Release deletes the pid file and releases our lock on the directory.

type Iterator

type Iterator interface {
	Next()
	Rewind()
	Seek(key []byte)
	Key() []byte
	Value() ValueStruct
	Valid() bool
	Name() string // Mainly for debug or testing.

	// All iterators should be closed so that file garbage collection works.
	Close() error
}

Iterator is an interface for a basic iterator.

type LevelCloser

type LevelCloser struct {
	Name string
	// contains filtered or unexported fields
}

func (*LevelCloser) AddRunning

func (lc *LevelCloser) AddRunning(delta int32)

func (*LevelCloser) Done

func (lc *LevelCloser) Done()

func (*LevelCloser) GotSignal

func (lc *LevelCloser) GotSignal() bool

func (*LevelCloser) HasBeenClosed

func (lc *LevelCloser) HasBeenClosed() <-chan struct{}

func (*LevelCloser) Signal

func (lc *LevelCloser) Signal()

func (*LevelCloser) SignalAndWait

func (lc *LevelCloser) SignalAndWait()

func (*LevelCloser) Wait

func (lc *LevelCloser) Wait()

type MergeIterator

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

MergeIterator merges multiple iterators. NOTE: MergeIterator owns the array of iterators and is responsible for closing them.

func NewMergeIterator

func NewMergeIterator(iters []Iterator, reversed bool) *MergeIterator

NewMergeIterator returns a new MergeIterator from a list of Iterators.

func (*MergeIterator) Close

func (s *MergeIterator) Close() error

func (*MergeIterator) Key

func (s *MergeIterator) Key() []byte

func (*MergeIterator) Name

func (s *MergeIterator) Name() string

func (*MergeIterator) Next

func (s *MergeIterator) Next()

Next returns the next element. If it is the same as the current key, ignore it.

func (*MergeIterator) Rewind

func (s *MergeIterator) Rewind()

Rewind seeks to first element (or last element for reverse iterator).

func (*MergeIterator) Seek

func (s *MergeIterator) Seek(key []byte)

Seek brings us to element with key >= given key.

func (*MergeIterator) Valid

func (s *MergeIterator) Valid() bool

Valid returns whether the MergeIterator is at a valid element.

func (*MergeIterator) Value

func (s *MergeIterator) Value() ValueStruct

type SafeMutex

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

func (*SafeMutex) AssertLock

func (s *SafeMutex) AssertLock()

func (*SafeMutex) AssertRLock

func (s *SafeMutex) AssertRLock()

func (*SafeMutex) Lock

func (s *SafeMutex) Lock()

func (*SafeMutex) RLock

func (s *SafeMutex) RLock()

func (*SafeMutex) RUnlock

func (s *SafeMutex) RUnlock()

func (*SafeMutex) Unlock

func (s *SafeMutex) Unlock()

type Slice

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

func (*Slice) Resize

func (s *Slice) Resize(sz int) []byte

type ValueStruct

type ValueStruct struct {
	Value      []byte
	Meta       byte
	CASCounter uint16
}

Jump to

Keyboard shortcuts

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