aboutsummaryrefslogtreecommitdiff
path: root/base/src
diff options
context:
space:
mode:
Diffstat (limited to 'base/src')
-rw-r--r--base/src/database.rs25
-rw-r--r--base/src/lib.rs2
2 files changed, 14 insertions, 13 deletions
diff --git a/base/src/database.rs b/base/src/database.rs
index 3971c62..9d29adb 100644
--- a/base/src/database.rs
+++ b/base/src/database.rs
@@ -10,6 +10,7 @@ use jellycommon::{
ExtendedNode, Node,
};
use log::info;
+use redb::{Database, TableDefinition};
use serde::{Deserialize, Serialize};
use std::{borrow::Borrow, fs::create_dir_all, ops::Deref, path::Path, sync::RwLock};
use tantivy::{
@@ -18,7 +19,7 @@ use tantivy::{
DateOptions, Index, IndexReader, IndexWriter, ReloadPolicy,
};
-pub use redb::*;
+pub use redb;
pub use tantivy;
pub const T_USER: TableDefinition<&str, Ser<User>> = TableDefinition::new("user");
@@ -127,11 +128,11 @@ pub trait TableExt<Key, KeyRef, Value> {
fn remove(self, db: &DataAcid, key: KeyRef) -> anyhow::Result<Option<Value>>;
}
impl<'a, 'b, 'c, Key, Value, KeyRef> TableExt<Key, KeyRef, Value>
- for TableDefinition<'a, Key, Ser<Value>>
+ for redb::TableDefinition<'a, Key, Ser<Value>>
where
- Key: Borrow<<Key as RedbValue>::SelfType<'b>> + redb::RedbKey,
+ Key: Borrow<<Key as redb::Value>::SelfType<'b>> + redb::Key,
Value: Encode + Decode + std::fmt::Debug + Serialize + for<'x> Deserialize<'x>,
- KeyRef: Borrow<<Key as redb::RedbValue>::SelfType<'c>>,
+ KeyRef: Borrow<<Key as redb::Value>::SelfType<'c>>,
{
fn get(self, db: &DataAcid, key: KeyRef) -> anyhow::Result<Option<Value>> {
let txn = db.inner.begin_read()?;
@@ -160,8 +161,8 @@ where
// pub trait TableIterExt<
// 'a,
-// Key: redb::RedbKey + 'static,
-// Value: redb::RedbValue + 'static,
+// Key: redb::redb::Key + 'static,
+// Value: redb::redb::Value + 'static,
// F: FnOnce(&redb::Range<'a, Key, Value>) -> anyhow::Result<T>,
// T: 'static,
// >
@@ -171,8 +172,8 @@ where
// impl<'a, Key, Value, F, T> TableIterExt<'a, Key, Value, F, T>
// for TableDefinition<'static, Key, Value>
// where
-// Key: redb::RedbKey,
-// Value: redb::RedbValue,
+// Key: redb::redb::Key,
+// Value: redb::redb::Value,
// F: FnOnce(&redb::Range<'a, Key, Value>) -> anyhow::Result<T>,
// T: 'static,
// {
@@ -192,7 +193,7 @@ where
#[cfg(not(feature = "db_json"))]
pub struct Ser<T>(pub T);
#[cfg(not(feature = "db_json"))]
-impl<T: Encode + Decode + std::fmt::Debug> RedbValue for Ser<T> {
+impl<T: Encode + Decode + std::fmt::Debug> redb::Value for Ser<T> {
type SelfType<'a> = Ser<T>
where
Self: 'a;
@@ -222,7 +223,7 @@ impl<T: Encode + Decode + std::fmt::Debug> RedbValue for Ser<T> {
}
fn type_name() -> redb::TypeName {
- TypeName::new("bincode")
+ redb::TypeName::new("bincode")
}
}
@@ -230,7 +231,7 @@ impl<T: Encode + Decode + std::fmt::Debug> RedbValue for Ser<T> {
#[cfg(feature = "db_json")]
pub struct Ser<T>(pub T);
#[cfg(feature = "db_json")]
-impl<T: Serialize + for<'a> Deserialize<'a> + std::fmt::Debug> RedbValue for Ser<T> {
+impl<T: Serialize + for<'a> Deserialize<'a> + std::fmt::Debug> redb::Value for Ser<T> {
type SelfType<'a> = Ser<T>
where
Self: 'a;
@@ -258,6 +259,6 @@ impl<T: Serialize + for<'a> Deserialize<'a> + std::fmt::Debug> RedbValue for Ser
}
fn type_name() -> redb::TypeName {
- TypeName::new("json")
+ redb::TypeName::new("json")
}
}
diff --git a/base/src/lib.rs b/base/src/lib.rs
index 71fa300..b90934e 100644
--- a/base/src/lib.rs
+++ b/base/src/lib.rs
@@ -4,11 +4,11 @@
Copyright (C) 2024 metamuffin <metamuffin.org>
*/
#![feature(lazy_cell)]
+pub mod assetfed;
pub mod cache;
pub mod database;
pub mod federation;
pub mod permission;
-pub mod assetfed;
use jellycommon::config::{GlobalConfig, SecretsConfig};
use std::{fs::File, sync::LazyLock};