summaryrefslogtreecommitdiff
path: root/crates/store/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/store/src/lib.rs')
-rw-r--r--crates/store/src/lib.rs23
1 files changed, 16 insertions, 7 deletions
diff --git a/crates/store/src/lib.rs b/crates/store/src/lib.rs
index f780b6fb..06f2aca0 100644
--- a/crates/store/src/lib.rs
+++ b/crates/store/src/lib.rs
@@ -194,13 +194,6 @@ pub struct Stores {
pub blob_stores: AHashMap<String, BlobStore>,
pub fts_stores: AHashMap<String, FtsStore>,
pub lookup_stores: AHashMap<String, LookupStore>,
- pub lookups: AHashMap<String, Arc<Lookup>>,
-}
-
-#[derive(Clone)]
-pub struct Lookup {
- pub store: LookupStore,
- pub query: String,
}
#[derive(Clone)]
@@ -235,11 +228,17 @@ pub enum FtsStore {
#[derive(Clone)]
pub enum LookupStore {
Store(Store),
+ Query(Arc<QueryStore>),
Memory(Arc<MemoryStore>),
#[cfg(feature = "redis")]
Redis(Arc<RedisStore>),
}
+pub struct QueryStore {
+ pub store: LookupStore,
+ pub query: String,
+}
+
#[cfg(feature = "sqlite")]
impl From<SqliteStore> for Store {
fn from(store: SqliteStore) -> Self {
@@ -364,6 +363,16 @@ impl<'x> Value<'x> {
}
}
+impl From<LookupKey> for String {
+ fn from(value: LookupKey) -> Self {
+ let key = match value {
+ LookupKey::Key(key) | LookupKey::Counter(key) => key,
+ };
+ String::from_utf8(key)
+ .unwrap_or_else(|err| String::from_utf8_lossy(&err.into_bytes()).into_owned())
+ }
+}
+
#[derive(Clone, Debug)]
pub struct Row {
pub values: Vec<Value<'static>>,