aboutsummaryrefslogtreecommitdiffstats
path: root/crates/daemon/src/api
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--crates/daemon/src/api/control.rs (renamed from crates/daemon/src/api/server/control.rs)16
-rw-r--r--crates/daemon/src/api/history.rs (renamed from crates/daemon/src/api/server/history.rs)13
-rw-r--r--crates/daemon/src/api/mod.rs8
-rw-r--r--crates/daemon/src/api/server/mod.rs2
-rw-r--r--crates/turtle/src/client/mod.rs (renamed from crates/daemon/src/api/client/mod.rs)33
-rw-r--r--crates/turtle/src/generated.rs (renamed from crates/daemon/src/api/generated.rs)11
6 files changed, 36 insertions, 47 deletions
diff --git a/crates/daemon/src/api/server/control.rs b/crates/daemon/src/api/control.rs
index a5e26355..a9d9cff3 100644
--- a/crates/daemon/src/api/server/control.rs
+++ b/crates/daemon/src/api/control.rs
@@ -6,15 +6,17 @@ use tokio::time::{self, MissedTickBehavior};
use tonic::{Request, Response, Status};
use tracing::{Level, instrument};
+use turtle::generated::{
+ DAEMON_PROTOCOL_VERSION,
+ control::{
+ ForceSyncReply, ForceSyncRequest, PathsReply, PathsRequest, StatusReply, StatusRequest,
+ control_server::{Control, ControlServer},
+ },
+};
+
use crate::{
+ DAEMON_VERSION,
aclient::{history::store::HistoryStore, record::sync, settings::Settings},
- api::{
- DAEMON_PROTOCOL_VERSION, DAEMON_VERSION,
- generated::control::{
- ForceSyncReply, ForceSyncRequest, PathsReply, PathsRequest, StatusReply, StatusRequest,
- control_server::{Control, ControlServer},
- },
- },
daemon::DaemonHandle,
events::DaemonEvent,
};
diff --git a/crates/daemon/src/api/server/history.rs b/crates/daemon/src/api/history.rs
index 0edf3b94..bcd2ee5a 100644
--- a/crates/daemon/src/api/server/history.rs
+++ b/crates/daemon/src/api/history.rs
@@ -10,20 +10,23 @@ use tracing::{Level, instrument};
use crate::{
aclient::{
database::{ClientSqlite, current_context},
- history::{History, HistoryId, store::HistoryStore},
+ history::store::HistoryStore,
settings::Settings,
},
- api::{
+ daemon::DaemonHandle,
+ events::DaemonEvent,
+};
+use turtle::{
+ generated::{
DAEMON_PROTOCOL_VERSION,
- generated::history::{
+ history::{
EndHistoryReply, EndHistoryRequest, HistoryEntry, HistoryEventKind, HistoryReply,
HistoryRequest, StartHistoryReply, StartHistoryRequest, TailHistoryReply,
TailHistoryRequest,
history_server::{History as HistorySvc, HistoryServer},
},
},
- daemon::DaemonHandle,
- events::DaemonEvent,
+ history::{History, HistoryId},
};
/// The gRPC service implementation.
diff --git a/crates/daemon/src/api/mod.rs b/crates/daemon/src/api/mod.rs
index b7f82a7b..8d475fe9 100644
--- a/crates/daemon/src/api/mod.rs
+++ b/crates/daemon/src/api/mod.rs
@@ -1,6 +1,2 @@
-pub mod client;
-pub(crate) mod generated;
-pub(crate) mod server;
-
-pub(crate) const DAEMON_VERSION: &str = env!("CARGO_PKG_VERSION");
-const DAEMON_PROTOCOL_VERSION: u32 = 1;
+pub(crate) mod control;
+pub(crate) mod history;
diff --git a/crates/daemon/src/api/server/mod.rs b/crates/daemon/src/api/server/mod.rs
deleted file mode 100644
index 8d475fe9..00000000
--- a/crates/daemon/src/api/server/mod.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-pub(crate) mod control;
-pub(crate) mod history;
diff --git a/crates/daemon/src/api/client/mod.rs b/crates/turtle/src/client/mod.rs
index c588fb09..07f01e6c 100644
--- a/crates/daemon/src/api/client/mod.rs
+++ b/crates/turtle/src/client/mod.rs
@@ -9,26 +9,21 @@ use hyper_util::rt::TokioIo;
#[cfg(unix)]
use tokio::net::UnixStream;
-use crate::api::generated;
-use crate::api::generated::control::{ForceSyncReply, ForceSyncRequest, PathsReply, PathsRequest};
-use crate::api::generated::history::{HistoryEntry, HistoryRequest};
-use crate::{
- aclient::history::History,
- api::{
- DAEMON_PROTOCOL_VERSION, DAEMON_VERSION,
- generated::{
- control::{
- StatusReply, StatusRequest, control_client::ControlClient as ControlServiceClient,
- },
- history::{
- EndHistoryReply, EndHistoryRequest, StartHistoryReply, StartHistoryRequest,
- TailHistoryRequest, history_client::HistoryClient as HistoryServiceClient,
- },
- },
+use crate::generated::{
+ self, DAEMON_PROTOCOL_VERSION,
+ control::{
+ ForceSyncReply, ForceSyncRequest, PathsReply, PathsRequest, StatusReply, StatusRequest,
+ control_client::ControlClient as ControlServiceClient,
+ },
+ history::{
+ EndHistoryReply, EndHistoryRequest, HistoryEntry, HistoryRequest, StartHistoryReply,
+ StartHistoryRequest, TailHistoryRequest,
+ history_client::HistoryClient as HistoryServiceClient,
},
};
-pub use crate::api::generated::history::{HistoryEventKind, TailHistoryReply};
+pub use crate::generated::history::{HistoryEventKind, TailHistoryReply};
+use crate::history::History;
fn normalize_optional_field(value: &str) -> Option<String> {
let trimmed = value.trim();
@@ -60,13 +55,13 @@ pub fn history_entry_to_history(entry: HistoryEntry) -> History {
#[must_use]
pub fn daemon_matches_expected(version: &str, protocol: u32) -> bool {
- version == DAEMON_VERSION && protocol == DAEMON_PROTOCOL_VERSION
+ protocol == DAEMON_PROTOCOL_VERSION
}
#[must_use]
pub fn daemon_mismatch_message(version: &str, protocol: u32) -> String {
if protocol == DAEMON_PROTOCOL_VERSION {
- format!("daemon is out of date: expected {DAEMON_VERSION}, got {version}")
+ unreachable!()
} else {
format!("daemon protocol mismatch: expected {DAEMON_PROTOCOL_VERSION}, got {protocol}")
}
diff --git a/crates/daemon/src/api/generated.rs b/crates/turtle/src/generated.rs
index 304edcd9..e5e28ac7 100644
--- a/crates/daemon/src/api/generated.rs
+++ b/crates/turtle/src/generated.rs
@@ -1,28 +1,23 @@
#![expect(
- unreachable_pub,
unused_qualifications,
clippy::doc_markdown,
clippy::default_trait_access,
clippy::too_many_lines,
- clippy::trivially_copy_pass_by_ref,
clippy::allow_attributes,
clippy::derive_partial_eq_without_eq,
reason = "All of these lints are triggered by the generated code"
)]
-/// Semantic command capture gRPC service types.
-pub(crate) mod semantic {
- tonic::include_proto!("semantic");
-}
+pub const DAEMON_PROTOCOL_VERSION: u32 = 1;
/// History module for the daemon gRPC history service.
///
/// This module contains the proto-generated types for the history gRPC service.
-pub(crate) mod history {
+pub mod history {
tonic::include_proto!("history");
}
/// Control module for external control.
-pub(crate) mod control {
+pub mod control {
tonic::include_proto!("control");
}