Documentation ¶
Index ¶
- Constants
- Variables
- type DB
- func (db *DB) Begin(readOnly bool) (*Txn, error)
- func (db *DB) Close() error
- func (db *DB) Compaction() error
- func (db *DB) Del(key []byte) error
- func (db *DB) Get(key []byte) (*Entry, error)
- func (db *DB) Notify(key string, value []byte, entryType watch.EventType)
- func (db *DB) Put(key []byte, value []byte) error
- func (db *DB) PutWithExpiration(key []byte, value []byte, duration time.Duration) error
- func (db *DB) Watch(ctx context.Context, key string)
- type DataFile
- func (df *DataFile) Close() error
- func (df *DataFile) ReadAt(off int64) (*Entry, error)
- func (df *DataFile) ReadBatch(off int64) ([]*Entry, []uint32, int64, error)
- func (df *DataFile) ReadEntryAt(off int64, entrySize int) (*Entry, error)
- func (df *DataFile) ReadGarbageSize(data []byte) error
- func (df *DataFile) Sync() error
- func (df *DataFile) WriteAt(data []byte, off int64) (int, error)
- func (df *DataFile) WriteGarbageSize(length uint32) error
- type DataPos
- type Entry
- type EntryType
- type Fd
- type GarbageManager
- type GarbageMetaData
- type HashTable
- type Index
- type MetaData
- type Options
- type RWManager
- type Txn
Constants ¶
View Source
const ( GarbageManagerFreeListSize = 1024 GarbageManagerFileName = "gm" GarbageManagerRecordSize = 9 )
View Source
const ( DBDirectory = "/apexdb" MaxDataFileSize = 64 * 1024 * 1024 CompactionInternal = 8 * time.Hour GarbageRation = 0.3 GarbageManagerBufSize = 8 * 1024 * 1024 )
View Source
const (
DataFileSuffix = ".apex"
)
View Source
const EntryMetaSize = 2 + 4 + 8 + 8 + 4 + 4
Variables ¶
View Source
var ( ErrKeyIsEmpty = errors.New("the key is empty") ErrKeyNotExist = errors.New("the key dose not exist") ErrDataFileNotExist = errors.New("the data file dose not exist") ErrCompacting = errors.New("compacting in progress") )
View Source
var ( ErrGarbageMetaDataNotExist = errors.New("the garbage meta data not exist") ErrGarbageFreeListEmpty = errors.New("the garbage free list is empty") )
View Source
var ( ErrDBClosed = errors.New("db already closed") ErrTxnCommitted = errors.New("txn already committed") ErrTxnReadOnly = errors.New("txn is read only") )
View Source
var (
ErrEntryWrong = errors.New("the data of entry is wrong")
)
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) Compaction ¶
func (*DB) PutWithExpiration ¶
type DataFile ¶
type DataFile struct {
// contains filtered or unexported fields
}
func (*DataFile) ReadEntryAt ¶
func (*DataFile) ReadGarbageSize ¶
func (*DataFile) WriteGarbageSize ¶
type Entry ¶
func (*Entry) DecodeLogEntry ¶
func (*Entry) DecodeLogEntryMeta ¶
func (*Entry) EncodeLogEntry ¶
type GarbageManager ¶
type GarbageManager struct {
// contains filtered or unexported fields
}
func NewGarbageManager ¶
func NewGarbageManager(path string, bufSize int) (*GarbageManager, error)
type GarbageMetaData ¶
type GarbageMetaData struct {
// contains filtered or unexported fields
}
type Index ¶
type Options ¶
type Options struct { Sync bool Path string MaxDataFileSize uint32 CompactionInternal time.Duration GarbageRate float64 GarbageManagerBufSize int }
func DefaultOptions ¶
func DefaultOptions() *Options
Source Files ¶
Click to show internal directories.
Click to hide internal directories.