aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-04-15 23:19:55 +0200
committermetamuffin <metamuffin@disroot.org>2024-04-15 23:19:55 +0200
commitf369728cc783493f8f6cab921b3c609d127bf6f2 (patch)
tree638a2a23e27a4c843237186708daa1e07b1f28ba /base
parent29a62d702b24d8ea30c72e17569d9a98ad2775b9 (diff)
downloadjellything-f369728cc783493f8f6cab921b3c609d127bf6f2.tar
jellything-f369728cc783493f8f6cab921b3c609d127bf6f2.tar.bz2
jellything-f369728cc783493f8f6cab921b3c609d127bf6f2.tar.zst
database statistics
Diffstat (limited to 'base')
-rw-r--r--base/src/database.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/base/src/database.rs b/base/src/database.rs
index 9d29adb..7755016 100644
--- a/base/src/database.rs
+++ b/base/src/database.rs
@@ -12,7 +12,13 @@ use jellycommon::{
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 std::{
+ borrow::Borrow,
+ fs::create_dir_all,
+ ops::Deref,
+ path::Path,
+ sync::{Arc, RwLock},
+};
use tantivy::{
directory::MmapDirectory,
schema::{Field, Schema, FAST, INDEXED, STORED, TEXT},
@@ -32,9 +38,10 @@ pub const T_NODE_EXTENDED: TableDefinition<&str, Ser<ExtendedNode>> =
pub const T_NODE_IMPORT: TableDefinition<&str, Ser<Vec<(Vec<usize>, Node)>>> =
TableDefinition::new("node-import");
+#[derive(Clone)]
pub struct DataAcid {
- pub inner: redb::Database,
- pub node_index: NodeIndex,
+ pub inner: Arc<redb::Database>,
+ pub node_index: Arc<NodeIndex>,
}
impl DataAcid {
@@ -45,8 +52,8 @@ impl DataAcid {
info!("opening node index...");
let ft_node = NodeIndex::new(path).context("in node index")?;
let r = Self {
- inner: db,
- node_index: ft_node,
+ inner: db.into(),
+ node_index: ft_node.into(),
};
{