Documentation ¶
Index ¶
- Constants
- Variables
- func AssertTrue(b bool)
- func AssertTruef(b bool, format string, args ...interface{})
- func Check(err error)
- func Check2(_ interface{}, err error)
- func CreateSyncedFile(filename string, sync bool) (*os.File, error)
- func OpenExistingSyncedFile(filename string, sync bool) (*os.File, error)
- func OpenSyncedFile(filename string, sync bool) (*os.File, error)
- func OpenTruncFile(filename string, sync bool) (*os.File, error)
- func Safecopy(a []byte, src []byte) []byte
- func ValueStructSerializedSize(size uint16) int
- func Wrap(err error) error
- func Wrapf(err error, format string, args ...interface{}) error
- type Closer
- type Iterator
- type LevelCloser
- type MergeIterator
- type SafeMutex
- type Slice
- type ValueStruct
Constants ¶
const ( MetaSize = 1 UserMetaSize = 1 CasSize = 8 )
Constants used in serialization sizes, and in ValueStruct serialization
Variables ¶
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 )
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 ¶
AssertTruef is AssertTrue with extra info.
func Check2 ¶
func Check2(_ interface{}, err error)
Check2 acts as convenience wrapper around Check, using the 2nd argument as error.
func CreateSyncedFile ¶
CreateSyncedFile creates a new file (using O_EXCL), errors if it already existed.
func OpenExistingSyncedFile ¶
OpenExistingSyncedFile opens an existing file, errors if it doesn't exist.
func OpenSyncedFile ¶
OpenSyncedFile creates the file if one doesn't exist.
func ValueStructSerializedSize ¶
Converts a value size to the full serialized size of value + metadata.
Types ¶
type Closer ¶
func (*Closer) Get ¶
func (c *Closer) Get(name string) *LevelCloser
func (*Closer) Register ¶
func (c *Closer) Register(name string) *LevelCloser
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()
type ValueStruct ¶
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