muDB
- DataBase is a simple, lightweight database that provides basic database functionalities, and can be created using the new function, which takes a path to the database file as an argument.
- The database supports basic operations such as inserting key-value pairs, retrieving values, removing entries, and clearing all data.
- It also offers advanced features like direct read/write operations at specified positions, checking if the database or buffer is empty, and optimizing the database file by removing unused space.
Example
let mut db = new;
// This will generate ./test.db and ./index_test.db if they don't exist.
db.insert;
db.insert;
let value = db.get;
assert_eq!;
db.remove;
assert_eq!;
assert!; // index is empty
assert!; // db is not empty
assert_eq!; // db: `after_valuee`
db.shrink; // remove unused space
assert!;
db.write_at.unwrap; // write to db file directly without syncing index
let data = db.read_at.unwrap; // read db file directly
assert_eq!;
db.clear_all.unwrap; // clear everything (index and db)
assert!;
assert!;
Please note that the mu_db is a simple, lightweight database and does not support complex database operations like transactions, joins, etc. It is best suited for simple key-value storage needs.