Skip to main content

rustolio_db/
lib.rs

1//
2// SPDX-License-Identifier: MPL-2.0
3//
4// Copyright (c) 2026 Tobias Binnewies. All rights reserved.
5//
6// This Source Code Form is subject to the terms of the Mozilla Public
7// License, v. 2.0. If a copy of the MPL was not distributed with this
8// file, You can obtain one at http://mozilla.org/MPL/2.0/.
9//
10
11mod error;
12// mod hasher;
13mod key;
14mod test_utils;
15mod value;
16
17#[cfg(not(target_arch = "wasm32"))]
18mod store;
19
20use rustolio_utils::prelude::*;
21
22pub mod client;
23
24pub use error::{Error, Result};
25pub use key::{Key, KeyType};
26pub use value::Value;
27
28const DATA_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/data");
29
30#[cfg(not(target_arch = "wasm32"))]
31#[derive(Debug, service::Service)]
32pub struct Service {
33    store_service: store::Service,
34}
35
36#[cfg(not(target_arch = "wasm32"))]
37impl Default for Service {
38    fn default() -> Self {
39        Self::new()
40    }
41}
42
43impl Service {
44    pub fn new() -> Self {
45        Service {
46            store_service: store::Service::new(1_000, DATA_DIR.into()),
47        }
48    }
49}