aboutsummaryrefslogtreecommitdiffstats
path: root/crates/daemon/src/api/history.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/daemon/src/api/history.rs')
-rw-r--r--crates/daemon/src/api/history.rs23
1 files changed, 6 insertions, 17 deletions
diff --git a/crates/daemon/src/api/history.rs b/crates/daemon/src/api/history.rs
index bcd2ee5a..d024ea92 100644
--- a/crates/daemon/src/api/history.rs
+++ b/crates/daemon/src/api/history.rs
@@ -8,11 +8,7 @@ use tonic::{Request, Response, Status};
use tracing::{Level, instrument};
use crate::{
- aclient::{
- database::{ClientSqlite, current_context},
- history::store::HistoryStore,
- settings::Settings,
- },
+ aclient::{history::store::HistoryStore, settings::Settings},
daemon::DaemonHandle,
events::DaemonEvent,
};
@@ -41,12 +37,10 @@ pub(crate) struct HistoryService {
/// History store for pushing records
history_store: HistoryStore,
-
- history_db: ClientSqlite,
}
impl HistoryService {
- pub(crate) async fn new(handle: DaemonHandle, history_db: ClientSqlite) -> Result<Self> {
+ pub(crate) async fn new(handle: DaemonHandle) -> Result<Self> {
let host_id = Settings::host_id().await?;
let history_store =
HistoryStore::new(handle.store().clone(), host_id, *handle.encryption_key());
@@ -55,7 +49,6 @@ impl HistoryService {
running: DashMap::new(),
handle,
history_store,
- history_db,
})
}
@@ -91,18 +84,15 @@ impl HistorySvc for HistoryService {
) -> Result<Response<HistoryReply>, Status> {
let req = request.into_inner();
- let context = current_context(req.session)
- .await
- .map_err(|e| Status::internal(format!("failed to aquire context: {e:?}")))?;
-
let entries = if let Some(range) = req.range {
let from = OffsetDateTime::from_unix_timestamp(range.start as i64).unwrap();
let to = OffsetDateTime::from_unix_timestamp(range.end as i64).unwrap();
- self.history_db.range(from, to).await
+ self.handle.history_db().range(from, to).await
} else {
- self.history_db
- .list(&[], &context, None, false, false)
+ self.handle
+ .history_db()
+ .list(None, None, false, false)
.await
}
.map_err(|e| Status::internal(format!("failed to read db: {e:?}")))?
@@ -203,7 +193,6 @@ impl HistorySvc for HistoryService {
}
#[instrument(skip_all, level = Level::INFO)]
- #[expect(clippy::significant_drop_tightening, reason = "Would be a logic-bug")]
async fn tail_history(
&self,
_request: Request<TailHistoryRequest>,