A pure-Python implementation of Basho's bitcask key-value store.
GNU General Public License version 3
This is the current feature implementation status:
- Get
- Set
- Delete
- Create/read hint file
- Merge old files
- Rotation of data files
- A Bitcask instance is a directory;
- Only one system process will open a Bitcask instance for writing at a given time;
- The Bitcask instance directory consists of many files but only one is the "active". The other files are fixed, read-only (there is a rotation process to create a new active file when a threshold is exceeded);
- Once a file is closed, either purposefully or due to server exit, it is considered immutable and will never be opened for writing again;
- The active file is only written by appending (sequential writes do not require disk seeking);
To be done.
The data file consists on entries in this format:
[crc][timestamp][key_size][value_size][key][value]
Where:
crc
: 32-bit int with crc32 of[timestamp]...[value]
timestamp
: 32-bit int with UNIX timestampkey_size
: 16-bit int with key size (in bytes)value_size
: 32-bit int with value size (in bytes)
Some highlights:
- Everything is written in big endian;
- With each write, a new entry is appeneded to the active file (even if it is an update or delete operation)
- Deletion is simply a write of a kv-pair with the "value" field filled with a "tombstone" special value (the duplication of kv-pair will be removed on the merging process);
To be done.
To be done.
To be done.
To be done.