Skip to content

Commit

Permalink
rocksdb
Browse files Browse the repository at this point in the history
  • Loading branch information
snowmead committed Sep 21, 2024
1 parent 926bfdb commit 1784431
Show file tree
Hide file tree
Showing 8 changed files with 447 additions and 705 deletions.
88 changes: 7 additions & 81 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ tokio = { version = "1.32.0", features = ["full"] }
tracing = "0.1.37"
serde_json = "1.0.107"
serde = { version = "1.0.188", features = ["derive"] }
redis = { version = "0.25.0", features = [
"tokio-comp",
"tokio-rustls-comp",
"json",
], optional = true }
rocksdb = { version = "0.22.0", features = [
"multi-threaded-cf",
], optional = true }
Expand All @@ -42,5 +37,4 @@ aquamarine = "0.3.2"
tiktoken-rs = "0.5.8"

[features]
redis = ["dep:redis"]
rocksdb = ["dep:rocksdb"]
7 changes: 3 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ use num_traits::{
SaturatingSub, ToPrimitive, Unsigned,
};
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use tracing::{debug, error, instrument, trace};
use tracing::{error, trace};

pub mod architecture;
pub mod loom;
Expand All @@ -73,11 +73,10 @@ mod mock;
#[cfg(test)]
mod tests;

use num_traits::Zero;
pub use storage::TapestryChestHandler;
use types::{LoomError, SummaryModelTokens, WeaveError, ASSISTANT_ROLE, SYSTEM_ROLE};
use types::{LoomError, SummaryModelTokens, WeaveError};

use crate::types::{PromptModelRequest, PromptModelTokens, WrapperRole};
use crate::types::{PromptModelTokens, WrapperRole};

pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;

Expand Down
21 changes: 0 additions & 21 deletions src/storage/common.rs

This file was deleted.

9 changes: 3 additions & 6 deletions src/storage/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
use async_trait::async_trait;
use serde::de::DeserializeOwned;
use serde::{de::DeserializeOwned, Serialize};
use std::fmt::{Debug, Display};

use crate::{Config, TapestryFragment, TapestryId};

pub(crate) mod common;
#[cfg(feature = "redis")]
pub mod redis;
#[cfg(feature = "rocksdb")]
pub mod rocksdb;

Expand Down Expand Up @@ -48,7 +45,7 @@ pub trait TapestryChestHandler<T: Config> {
/// Save tapestry metadata.
///
/// Based on application use cases, you can add aditional data for a given [`TapestryId`]
async fn save_tapestry_metadata<TID: TapestryId, M: ToString + Debug + Clone + Send + Sync>(
async fn save_tapestry_metadata<TID: TapestryId, M: Serialize + Debug + Clone + Send + Sync>(
&self,
tapestry_id: TID,
metadata: M,
Expand All @@ -75,7 +72,7 @@ pub trait TapestryChestHandler<T: Config> {
instance: Option<u64>,
) -> crate::Result<Option<TapestryFragment<T>>>;
/// Retrieves the last tapestry metadata, or a metadata at a specified instance.
async fn get_tapestry_metadata<TID: TapestryId, M: DeserializeOwned>(
async fn get_tapestry_metadata<TID: TapestryId, M: DeserializeOwned + Send + Sync>(
&self,
tapestry_id: TID,
) -> crate::Result<Option<M>>;
Expand Down
Loading

0 comments on commit 1784431

Please sign in to comment.