Crates.io | smol_db_common |
lib.rs | smol_db_common |
version | 1.5.0-beta.1 |
source | src |
created_at | 2023-08-09 00:01:18.500827 |
updated_at | 2024-04-17 19:32:00.298954 |
description | A common library shared between packages that use smol_db |
homepage | https://github.com/CoryRobertson/smol_db |
repository | https://github.com/CoryRobertson/smol_db |
max_upload_size | |
id | 939648 |
size | 153,928 |
A database client and server designed for small databases that simply need quick setup and deletion, read and write. The goal of this database is to use it in most of my other projects when applicable, and make it as easy to use as possible. The database's structure is simply a hashmap.
smol_db is not designed to be extremely secure, most of its use cases are exist on the local network, where security can less necessary.
While the program has opt-in packet encryption, I still do not recommend this program for any high security applications.
If there are any improvements that can be made to security that come to my mind, I will slowly implement them as I get around to those ideas. access keys are not stored in a hash or encrypted format, and therefore should not be assumed to be safe or secure when stored.
db:
build: https://github.com/CoryRobertson/smol_db.git#main
image: smol_db_server
ports:
- "8222:8222"
container_name: "smol_db_server_instance1"
restart: unless-stopped
volumes:
- "./smol_db:/data"
To create a smol_db_server instance, the above docker compose example can be used, or the server package can be built from source and run on the server computer. After creating an instance of the server on either bare-metal or a docker container, simply connect to it using the smol_db_client library, or through the smol_db_viewer. Images below outline what the smol_db_viewer looks like and what screens are available.
use smol_db_client::SmolDbClient;
fn main() {
// server is assumed to be running on localhost on port 8222
let mut client = SmolDbClient::new("localhost:8222").unwrap();
let data = "super cool user data";
let _ = client.set_access_key("readme_db_key".to_string()).unwrap();
let _ = client.create_db("cool_db_name", DBSettings::default()).unwrap();
let _ = client.write_db("cool_db_name", "cool_data_location", data).unwrap();
match client.read_db("cool_db_name","cool_data_location") {
SuccessReply(response_data) => {
assert_eq!(&response_data, data);
}
SuccessNoData => {
assert!(false);
}
}
}