Documentation ¶
Index ¶
- Constants
- Variables
- type DB
- type Index
- type Keydir
- type LogRecord
- type Options
- type Type
- type Wal
- func (l *Wal) ActiveSegmentID() uint32
- func (l *Wal) Close() error
- func (l *Wal) Iter(segmentStart, segmentEnd uint32, f walker) error
- func (l *Wal) OpenNewActiveSegment() error
- func (l *Wal) Read(keydir Keydir) ([]byte, error)
- func (l *Wal) RemoveOldSegments(maxSegmentID uint32) error
- func (l *Wal) SegmentFileName(segId uint32) string
- func (l *Wal) Sync() error
- func (l *Wal) Write(data []byte) (Keydir, error)
Constants ¶
View Source
const ( KB = 1024 MB = 1024 * KB GB = 1024 * MB CronExprEveryHour = "0 0 0/1 * * ?" CronExprEveryMinute = "0 0/1 * * * ?" )
Variables ¶
View Source
var ( ErrKeyNotFound = errors.New("mewdb: key not found") ErrKeyIsEmpty = errors.New("mewdb: key is empty") ErrDatabaseIsUsing = errors.New("mewdb: create flock file error, database is using") ErrDatabaseIsClosed = errors.New("mewdb: database is closed") ErrMergeIsRunning = errors.New("mewdb: merge is running") )
View Source
var DefaultOptions = Options{ DirPath: "mewdb", MergeCronExpr: CronExprEveryHour, Logger: slog.Default(), SegmentSize: GB, SegmentFileExt: ".SEG", }
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB represents a MEWDB database instance built on BITCASK model. See https://en.wikipedia.org/wiki/Bitcask for more details.
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index
type Keydir ¶
type Keydir = *wal.ChunkPosition
type Wal ¶
type Wal struct {
// contains filtered or unexported fields
}
Wal is write ahead log for mewdb.
func (*Wal) ActiveSegmentID ¶
func (*Wal) Iter ¶
Iter iterate datas between segmentStart and segmentEnd, this is a internal function.
func (*Wal) OpenNewActiveSegment ¶
func (*Wal) RemoveOldSegments ¶
RemoveOldSegments remove all segments which is less than maxSegmentID.
func (*Wal) SegmentFileName ¶
Click to show internal directories.
Click to hide internal directories.