Documentation
¶
Index ¶
- Variables
- func AssertTrue(b bool)
- func AssertTruef(b bool, format string, args ...interface{})
- func Check(err error)
- func Check2(_ interface{}, err error)
- func CompareKeys(key1 []byte, key2 []byte) int
- func Copy(a []byte) []byte
- func CreateSyncedFile(filename string, sync bool) (*os.File, error)
- func KeyWithTs(key []byte, ts uint64) []byte
- func Madvise(b []byte, readhead bool) error
- func Mmap(fd *os.File, wirtable bool, size int64) ([]byte, error)
- func Munmap(b []byte) 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 ParseKey(key []byte) []byte
- func ParseTs(key []byte) uint64
- func Safecopy(a []byte, src []byte) []byte
- func SameKey(src, dst []byte) bool
- func Wrap(err error) error
- func Wrapf(err error, format string, args ...interface{}) error
- type Closer
- type Iterator
- type MergeIterator
- type Slice
- type ValueStruct
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // LSMSize has size of the LSM in bytes LSMSize *expvar.Map // VlogSize has size of the value log in bytes VlogSize *expvar.Map // PendingWrites tracks the number of pending writes. PendingWrites *expvar.Map // NumReads has cumulative number of reads NumReads *expvar.Int // NumWrites has cumulative number of writes NumWrites *expvar.Int // NumBytesRead has cumulative number of bytes read NumBytesRead *expvar.Int // NumBytesWritten has cumulative number of bytes written NumBytesWritten *expvar.Int // NumLSMGets is number of LMS gets NumLSMGets *expvar.Map // NumLSMBloomHits is number of LMS bloom hits NumLSMBloomHits *expvar.Map // NumGets is number of gets NumGets *expvar.Int // NumPuts is number of puts NumPuts *expvar.Int // NumBlockedPuts is number of blocked puts NumBlockedPuts *expvar.Int // NumMemtableGets is number of memtable gets NumMemtableGets *expvar.Int )
View Source
var ( // CastagnoliCrcTable is a CRC32 polynomial table CastagnoliCrcTable = crc32.MakeTable(crc32.Castagnoli) )
View Source
var ErrEOF = errors.New("End of mapped region")
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 OpenExistingSyncedFile ¶
Types ¶
type Closer ¶
type Closer struct {
// contains filtered or unexported fields
}
另一种并发控制的写法
func (*Closer) AddRunning ¶
AddRunning Add()'s delta to the WaitGroup.
func (*Closer) HasBeenClosed ¶
func (lc *Closer) HasBeenClosed() <-chan struct{}
HasBeenClosed gets signaled when Signal() is called.
func (*Closer) SignalAndWait ¶
func (lc *Closer) SignalAndWait()
SignalAndWait calls Signal(), then Wait().
type Iterator ¶
type Iterator interface { Next() Rewind() Seek(key []byte) Key() []byte Value() ValueStruct Valid() bool Close() error // All iterators should be closed so that file garbage collection works }
type MergeIterator ¶
type MergeIterator struct {
// contains filtered or unexported fields
}
MergeIterator merges multiple iterators.
func NewMergeIterator ¶
func NewMergeIterator(iters []Iterator, reversed bool) *MergeIterator
func (*MergeIterator) Close ¶
func (s *MergeIterator) Close() error
func (*MergeIterator) Key ¶
func (s *MergeIterator) Key() []byte
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) Valid ¶
func (s *MergeIterator) Valid() bool
func (*MergeIterator) Value ¶
func (s *MergeIterator) Value() ValueStruct
type Slice ¶
type Slice struct {
// contains filtered or unexported fields
}
Slice holds a reusable buf, will reallocate if you request a larger size than ever before. One problem is with n distinct sizes in random order it'll reallocate log(n) times.
type ValueStruct ¶
type ValueStruct struct { Meta byte UserMeta byte ExpiresAt uint64 Value []byte Version uint64 // This field is not serialized. Only for internal usage. }
func (*ValueStruct) Decode ¶
func (v *ValueStruct) Decode(b []byte)
func (*ValueStruct) Encode ¶
func (v *ValueStruct) Encode(b []byte)
func (*ValueStruct) EncodeTo ¶
func (v *ValueStruct) EncodeTo(buf *bytes.Buffer)
func (*ValueStruct) EncodedSize ¶
func (v *ValueStruct) EncodedSize() uint16
Click to show internal directories.
Click to hide internal directories.