Versions in this module Expand all Collapse all v0 v0.1.2 Jan 24, 2024 Changes in this version type Db + func (db *Db) CloseWatch() error + func (db *Db) NewWatch() (chan WatcherEvent, error) + func (db *Db) SendWatchEvent(w WatcherEvent) error + type EventType string + const Create + const Delete + const Update type Options + ShouldWatch bool + WatchQueueSize int + type WatcherEvent struct + BatchId *ksuid.KSUID + EventTimestamp time.Time + EventType EventType + Key []byte + NewValue []byte + OldValue []byte + func NewCreateWatcherEvent(key, oldValue, newValue []byte, batchId *ksuid.KSUID) WatcherEvent + func NewDeleteWatcherEvent(key, oldValue, newValue []byte, batchId *ksuid.KSUID) WatcherEvent + func NewUpdateWatcherEvent(key, oldValue, newValue []byte, batchId *ksuid.KSUID) WatcherEvent v0.1.1 Jan 3, 2024 Changes in this version + const CrcOffset + const CrcSize + const DeleteFlagSize + const EXIT_NOT_OK + const EXIT_OK + const INITIAL_KEY_VALUE_ENTRY_OFFSET + const INITIAL_SEGMENT_OFFSET + const KeySizeSize + const TstampSize + const ValueSizeSize + var ERROR_BATCH_CLOSED = errors.New("batch is closed") + var ERROR_CANNOT_CLOSE_CLOSED_BATCH = errors.New("cannot close closed batch") + var ERROR_CANNOT_READ_FILE = errors.New("error reading file") + var ERROR_CRC_DOES_NOT_MATCH = errors.New("crc does not match. corrupted datafile") + var ERROR_DB_CLOSED = errors.New("database is closed") + var ERROR_KEY_NOT_FOUND = errors.New("key expired or does not exist") + var ERROR_KEY_VALUE_SIZE_EXCEEDED = errors.New(fmt.Sprintf("exceeded limit of %d bytes", BlockSize)) + var ERROR_NO_ACTIVE_FILE_OPENED = errors.New("no file opened for writing") + var ERROR_OFFSET_EXCEEDED_FILE_SIZE = errors.New("offset exceeded file size") + type Batch struct + func (b *Batch) Close() error + func (b *Batch) Commit() error + func (b *Batch) Delete(k []byte) error + func (b *Batch) Exists(k []byte) (bool, error) + func (b *Batch) Get(k []byte) ([]byte, error) + func (b *Batch) Rollback() error + func (b *Batch) Set(k []byte, v []byte) ([]byte, error) + func (b *Batch) SetWithTTL(k []byte, v []byte, ttl time.Duration) ([]byte, error) type Db + func (db *Db) KeyReader(prefix string, handler func(k []byte)) + func (db *Db) KeyValueReader(keyPrefix string, handler func(k []byte, v []byte)) (bool, error) + func (db *Db) NewBatch() (*Batch, error) + func (db *Db) SetWithTTL(k []byte, v []byte, ttl time.Duration) (interface{}, error) type KeyValueEntry + func (kv *KeyValueEntry) PayloadToByte() []byte v0.1.0 Dec 22, 2023 Changes in this version + const ActiveKeyValueEntryDatafileSuffix + const BTreeDegree + const BlockSize + const CANNOT_READ_FILE + const DELETED_FLAG_BYTE_VALUE + const DELETED_FLAG_SET_VALUE + const DELETED_FLAG_UNSET_VALUE + const DatafileThreshold + const DefaultDataDir + const DeleteFlagOffset + const EB + const GB + const InactiveKeyValueEntryDataFileSuffix + const KB + const KEY_EXPIRES_IN_DEFAULT + const KEY_NOT_FOUND + const KeySizeOffset + const KeyValueEntryHintfileSuffix + const LRU_SIZE + const LRU_TTL + const MB + const NO_ACTIVE_FILE_OPENED + const OFFSET_EXCEEDED_FILE_SIZE + const PB + const StaticChunkSize + const TB + const TempDataFilePattern + const TempInactiveDataFilePattern + const TotalStaticChunkSize + const TstampOffset + const ValueSizeOffset + var KEY_VALUE_SIZE_EXCEEDED = fmt.Sprintf("exceeded limit of %d bytes", BlockSize) + type BTree struct + func (b *BTree) Delete(key []byte) *KeyValuePair + func (b *BTree) Get(key []byte) *KeyDirValue + func (b *BTree) List() []*KeyValuePair + func (b *BTree) Set(key []byte, value KeyDirValue) *KeyDirValue + type Block struct + type BlockOffsetPair struct + type Db struct + func NewDb(dirPath string) *Db + func Open(opts *Options) (*Db, error) + func (db *Db) All() []*KeyValuePair + func (db *Db) Close() error + func (db *Db) Delete(key []byte) error + func (db *Db) Get(key []byte) ([]byte, error) + func (db *Db) Set(kv *KeyValuePair) (interface{}, error) + func (db *Db) Sync() error + type KeyDirValue struct + func NewKeyDirValue(offset, size, tstamp int64, path string) *KeyDirValue + type KeyValueEntry struct + func NewKeyValueEntry(deleted byte, offset, ksz, vsz, size int64, k, v []byte) *KeyValueEntry + func (s *KeyValueEntry) Key() []byte + func (s *KeyValueEntry) StaticChunkSize() int + func (s *KeyValueEntry) ToByte() []byte + func (s *KeyValueEntry) Value() []byte + type KeyValuePair struct + Key []byte + Ttl time.Duration + Value interface{} + type Options struct + IsMerge bool + MergeFilePath string + Path string + type Segment struct