diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-07-09 22:00:59 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-07-09 22:00:59 +0200 |
| commit | 620cf8fa33835c1ce1e56b1028ff6e2a6fbe0f39 (patch) | |
| tree | e97e54ff112c8e3fa9f88335bfd1275420a4d69f /crates/daemon/src/components | |
| parent | chore: Separate daemon, client, server, and lib into crates (diff) | |
| download | atuin-620cf8fa33835c1ce1e56b1028ff6e2a6fbe0f39.zip | |
chore: Add more things
Diffstat (limited to 'crates/daemon/src/components')
| -rw-r--r-- | crates/daemon/src/components/history.rs | 10 | ||||
| -rw-r--r-- | crates/daemon/src/components/mod.rs | 16 | ||||
| -rw-r--r-- | crates/daemon/src/components/search.rs | 12 | ||||
| -rw-r--r-- | crates/daemon/src/components/semantic.rs | 12 | ||||
| -rw-r--r-- | crates/daemon/src/components/sync.rs | 6 |
5 files changed, 28 insertions, 28 deletions
diff --git a/crates/daemon/src/components/history.rs b/crates/daemon/src/components/history.rs index b4f91b06..a75ff774 100644 --- a/crates/daemon/src/components/history.rs +++ b/crates/daemon/src/components/history.rs @@ -15,7 +15,7 @@ use tokio_stream::Stream; use tonic::{Request, Response, Status}; use tracing::{Level, instrument}; -use crate::atuin_daemon::{ +use crate::{ daemon::{Component, DaemonHandle}, events::DaemonEvent, generated::history::{ @@ -35,7 +35,7 @@ const DAEMON_PROTOCOL_VERSION: u32 = 1; /// - Saves completed commands to the database and record store /// - Emits history events for other components (e.g., search indexing) /// - Provides the History gRPC service -pub(crate) struct HistoryComponent { +pub struct HistoryComponent { inner: Arc<HistoryComponentInner>, } @@ -52,7 +52,7 @@ struct HistoryComponentInner { impl HistoryComponent { /// Create a new history component. - pub(crate) fn new() -> Self { + pub fn new() -> Self { Self { inner: Arc::new(HistoryComponentInner { running: DashMap::new(), @@ -65,7 +65,7 @@ impl HistoryComponent { /// Get the gRPC service for this component. /// /// This returns a tonic service that can be added to a gRPC server. - pub(crate) fn grpc_service(&self) -> HistoryServer<HistoryGrpcService> { + pub fn grpc_service(&self) -> HistoryServer<HistoryGrpcService> { HistoryServer::new(HistoryGrpcService { inner: self.inner.clone(), }) @@ -111,7 +111,7 @@ impl Component for HistoryComponent { /// The gRPC service implementation. /// /// This is a thin wrapper that delegates to the component's shared state. -pub(crate) struct HistoryGrpcService { +pub struct HistoryGrpcService { inner: Arc<HistoryComponentInner>, } diff --git a/crates/daemon/src/components/mod.rs b/crates/daemon/src/components/mod.rs index 5a93fbc1..447e31df 100644 --- a/crates/daemon/src/components/mod.rs +++ b/crates/daemon/src/components/mod.rs @@ -14,12 +14,12 @@ //! - [`semantic::SemanticComponent`]: In-memory semantic command captures //! - [`sync::SyncComponent`]: Cloud sync -pub(crate) mod history; -pub(crate) mod search; -pub(crate) mod semantic; -pub(crate) mod sync; +pub mod history; +pub mod search; +pub mod semantic; +pub mod sync; -pub(crate) use history::HistoryComponent; -pub(crate) use search::SearchComponent; -pub(crate) use semantic::SemanticComponent; -pub(crate) use sync::SyncComponent; +pub use history::HistoryComponent; +pub use search::SearchComponent; +pub use semantic::SemanticComponent; +pub use sync::SyncComponent; diff --git a/crates/daemon/src/components/search.rs b/crates/daemon/src/components/search.rs index bcd60cc4..91f2db17 100644 --- a/crates/daemon/src/components/search.rs +++ b/crates/daemon/src/components/search.rs @@ -12,7 +12,7 @@ use tonic::{Request, Response, Status, Streaming}; use tracing::{Level, debug, info, instrument, span, trace}; use uuid::Uuid; -use crate::atuin_daemon::{ +use crate::{ daemon::{Component, DaemonHandle}, events::DaemonEvent, generated::search::{ @@ -34,7 +34,7 @@ const FRECENCY_REFRESH_INTERVAL_SECS: u64 = 60; /// - Loads history from the database on startup /// - Updates the index when history events occur /// - Provides the Search gRPC service -pub(crate) struct SearchComponent { +pub struct SearchComponent { index: Arc<RwLock<SearchIndex>>, handle: RwLock<Option<DaemonHandle>>, loader_handle: Option<tokio::task::JoinHandle<()>>, @@ -43,7 +43,7 @@ pub(crate) struct SearchComponent { impl SearchComponent { /// Create a new search component. - pub(crate) fn new() -> Self { + pub fn new() -> Self { Self { index: Arc::new(RwLock::new(SearchIndex::new())), handle: RwLock::new(None), @@ -53,7 +53,7 @@ impl SearchComponent { } /// Get the gRPC service for this component. - pub(crate) fn grpc_service(&self) -> SearchServer<SearchGrpcService> { + pub fn grpc_service(&self) -> SearchServer<SearchGrpcService> { SearchServer::new(SearchGrpcService { index: self.index.clone(), }) @@ -276,7 +276,7 @@ impl Component for SearchComponent { } /// The gRPC service implementation. -pub(crate) struct SearchGrpcService { +pub struct SearchGrpcService { index: Arc<RwLock<SearchIndex>>, } @@ -398,7 +398,7 @@ fn convert_filter_mode( } #[cfg(not(windows))] -pub(crate) fn with_trailing_slash(s: &str) -> String { +pub fn with_trailing_slash(s: &str) -> String { if s.ends_with('/') { s.to_string() } else { diff --git a/crates/daemon/src/components/semantic.rs b/crates/daemon/src/components/semantic.rs index e1d376de..02f5c3d1 100644 --- a/crates/daemon/src/components/semantic.rs +++ b/crates/daemon/src/components/semantic.rs @@ -9,13 +9,13 @@ use std::fmt::{Display, Formatter}; use std::sync::Arc; use crate::atuin_client::history::{History, HistoryId}; -use crate::atuin_daemon::generated::semantic; +use crate::generated::semantic; use eyre::Result; use tokio::sync::Mutex; use tonic::{Request, Response, Status, Streaming}; use tracing::{Level, instrument}; -use crate::atuin_daemon::{ +use crate::{ daemon::{Component, DaemonHandle}, events::DaemonEvent, generated::semantic::{ @@ -30,7 +30,7 @@ const MAX_BYTES_PER_SESSION: usize = 32 * 1024 * 1024; const MAX_PENDING_HISTORIES: usize = 128; /// Stores completed command captures and associates them with history events. -pub(crate) struct SemanticComponent { +pub struct SemanticComponent { inner: Arc<SemanticComponentInner>, } @@ -84,7 +84,7 @@ struct SemanticCommandRecord { } impl SemanticComponent { - pub(crate) fn new() -> Self { + pub fn new() -> Self { Self { inner: Arc::new(SemanticComponentInner { state: Mutex::new(SemanticState::default()), @@ -92,7 +92,7 @@ impl SemanticComponent { } } - pub(crate) fn grpc_service(&self) -> SemanticServer<SemanticGrpcService> { + pub fn grpc_service(&self) -> SemanticServer<SemanticGrpcService> { SemanticServer::new(SemanticGrpcService { inner: self.inner.clone(), }) @@ -453,7 +453,7 @@ impl Display for SessionId { } } -pub(crate) struct SemanticGrpcService { +pub struct SemanticGrpcService { inner: Arc<SemanticComponentInner>, } diff --git a/crates/daemon/src/components/sync.rs b/crates/daemon/src/components/sync.rs index 20d49839..e898e8bd 100644 --- a/crates/daemon/src/components/sync.rs +++ b/crates/daemon/src/components/sync.rs @@ -11,7 +11,7 @@ use tokio::time::{self, MissedTickBehavior}; use crate::atuin_client::{history::store::HistoryStore, record::sync, settings::Settings}; -use crate::atuin_daemon::{ +use crate::{ daemon::{Component, DaemonHandle}, events::DaemonEvent, }; @@ -41,14 +41,14 @@ enum SyncState { /// - Implements exponential backoff on sync failures /// - Responds to [`ForceSync`] events for immediate sync /// - Emits SyncCompleted/SyncFailed events -pub(crate) struct SyncComponent { +pub struct SyncComponent { task_handle: Option<tokio::task::JoinHandle<()>>, command_tx: Option<mpsc::Sender<SyncCommand>>, } impl SyncComponent { /// Create a new sync component. - pub(crate) fn new() -> Self { + pub fn new() -> Self { Self { task_handle: None, command_tx: None, |
