y

package
v0.0.0-...-f407625 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MetaSize     = 1
	UserMetaSize = 1
	CasSize      = 8
)

Constants used in serialization sizes, and in ValueStruct serialization

Variables

View Source
var (
	LSMSize  *expvar.Map
	VlogSize *expvar.Map

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

	// CastagnoliCrcTable is a CRC32 polynomial table
	CastagnoliCrcTable = crc32.MakeTable(crc32.Castagnoli)
)

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 CreateSyncedFile

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

CreateSyncedFile creates a new file (using O_EXCL), errors if it already existed.

func OpenExistingSyncedFile

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

OpenExistingSyncedFile opens an existing file, errors if it doesn't exist.

func OpenSyncedFile

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

OpenSyncedFile creates the file if one doesn't exist.

func OpenTruncFile

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

func Safecopy

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

func ValueStructSerializedSize

func ValueStructSerializedSize(size uint16) int

Converts a value size to the full serialized size of value + metadata.

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 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
	UserMeta   byte
	CASCounter uint64
}

func (*ValueStruct) DecodeEntireSlice

func (v *ValueStruct) DecodeEntireSlice(b []byte)

DecodeEntireSlice uses the length of the slice to infer the length of the Value field.

func (*ValueStruct) Encode

func (v *ValueStruct) Encode(b []byte)

Encode expects a slice of length at least v.EncodedSize().

func (*ValueStruct) EncodedSize

func (v *ValueStruct) EncodedSize() int

Jump to

Keyboard shortcuts

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