Documentation ¶
Overview ¶
Qdb is a fast persistent storage database.
The records are binary blobs that can have a variable length, up to 4GB.
The key must be a unique 64-bit value, most likely a hash of the actual key.
They data is stored on a disk, in a folder specified during the call to NewDB(). There are can be three possible files in that folder
- qdb.0, qdb.1 - these files store a compact version of the entire database
- qdb.log - this one stores the changes since the most recent qdb.0 or qdb.1
Index ¶
- Constants
- type DB
- func (db *DB) Browse(walk func(key KeyType, value []byte) bool)
- func (db *DB) Close()
- func (db *DB) Count() (l int)
- func (db *DB) Defrag() (doing bool)
- func (db *DB) Del(key KeyType)
- func (db *DB) Get(key KeyType) (value []byte)
- func (db *DB) Load()
- func (db *DB) NoSync()
- func (db *DB) Put(key KeyType, value []byte)
- func (db *DB) Sync()
- type KeyType
Constants ¶
View Source
const KeySize = 8
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct { // If NeverKeepInMem is set to true, the engine will never keep DB records // in memory, but will laways need to read them from disk. NeverKeepInMem bool // Set this function if you want to be able to decide whether a specific // record should be kept in memory, or freed after loaded, thus will need // to be taken from disk whenever needed next time. KeepInMem func(v []byte) bool // contains filtered or unexported fields }
func (*DB) Browse ¶
Browses through all teh DB records calling teh walk function for each record. If the walk function returns false, it aborts the browsing and returns.
func (*DB) Close ¶
func (db *DB) Close()
Close the database. Writes all the pending changes to disk.
func (*DB) Defrag ¶
Defragments the DB on the disk. Return true if defrag hes been performed, and false if was not needed.
Click to show internal directories.
Click to hide internal directories.