aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crates/client/src/atuin_client/settings/mod.rs2
-rw-r--r--crates/client/src/command/client.rs2
-rw-r--r--crates/client/src/command/client/sync.rs7
-rw-r--r--crates/daemon/src/aclient/database/mod.rs1
-rw-r--r--crates/daemon/src/aclient/history/mod.rs1
-rw-r--r--crates/daemon/src/aclient/history/store.rs6
-rw-r--r--crates/daemon/src/events.rs2
-rw-r--r--crates/daemon/src/main.rs1
-rw-r--r--crates/server/src/handlers/mod.rs8
-rw-r--r--crates/server/src/handlers/v0/mod.rs2
-rw-r--r--crates/server/src/handlers/v0/record.rs8
-rw-r--r--crates/server/src/metrics.rs4
-rw-r--r--crates/server/src/router.rs6
-rw-r--r--crates/server/src/settings.rs2
14 files changed, 22 insertions, 30 deletions
diff --git a/crates/client/src/atuin_client/settings/mod.rs b/crates/client/src/atuin_client/settings/mod.rs
index 0eb228b9..bcec25db 100644
--- a/crates/client/src/atuin_client/settings/mod.rs
+++ b/crates/client/src/atuin_client/settings/mod.rs
@@ -422,7 +422,7 @@ pub(crate) enum PreviewStrategy {
#[derive(Clone, Debug, Deserialize, Serialize)]
#[expect(clippy::struct_excessive_bools)]
-pub struct Settings {
+pub(crate) struct Settings {
pub(crate) data_dir: Option<String>,
pub(crate) dialect: Dialect,
pub(crate) timezone: Timezone,
diff --git a/crates/client/src/command/client.rs b/crates/client/src/command/client.rs
index 9f45f53b..32686c23 100644
--- a/crates/client/src/command/client.rs
+++ b/crates/client/src/command/client.rs
@@ -1,5 +1,5 @@
use std::fs::{self};
-use std::path::{Path, PathBuf};
+use std::path::Path;
use clap::Subcommand;
use eyre::{Result, WrapErr};
diff --git a/crates/client/src/command/client/sync.rs b/crates/client/src/command/client/sync.rs
index 86228e47..ac0d0afe 100644
--- a/crates/client/src/command/client/sync.rs
+++ b/crates/client/src/command/client/sync.rs
@@ -1,12 +1,9 @@
use clap::Subcommand;
-use colored::Colorize;
-use eyre::{Result, WrapErr, bail};
-use serde_json::json;
+use eyre::{Result, bail};
-use turtle_common::utils;
use turtle_daemon::api::client::{Probe, probe};
-use crate::{SHA, VERSION, atuin_client::settings::Settings};
+use crate::atuin_client::settings::Settings;
#[derive(Subcommand, Debug)]
#[command(infer_subcommands = true)]
diff --git a/crates/daemon/src/aclient/database/mod.rs b/crates/daemon/src/aclient/database/mod.rs
index 5e25a0e9..5287807c 100644
--- a/crates/daemon/src/aclient/database/mod.rs
+++ b/crates/daemon/src/aclient/database/mod.rs
@@ -1,5 +1,4 @@
use std::{
- env,
path::{Path, PathBuf},
str::FromStr,
};
diff --git a/crates/daemon/src/aclient/history/mod.rs b/crates/daemon/src/aclient/history/mod.rs
index d61c95c5..527d1bb6 100644
--- a/crates/daemon/src/aclient/history/mod.rs
+++ b/crates/daemon/src/aclient/history/mod.rs
@@ -12,7 +12,6 @@ use turtle_common::utils::uuid_v7;
use eyre::{Result, bail, eyre};
use crate::aclient::secrets::SECRET_PATTERNS_RE;
-use crate::aclient::settings::Settings;
use crate::aclient::utils::get_host_user;
use time::OffsetDateTime;
diff --git a/crates/daemon/src/aclient/history/store.rs b/crates/daemon/src/aclient/history/store.rs
index a749a1a8..216f85d6 100644
--- a/crates/daemon/src/aclient/history/store.rs
+++ b/crates/daemon/src/aclient/history/store.rs
@@ -1,12 +1,10 @@
-use std::{collections::HashSet, fmt::Write, time::Duration};
+use std::collections::HashSet;
use eyre::{Result, bail, eyre};
-use indicatif::{ProgressBar, ProgressState, ProgressStyle};
use rmp::decode::Bytes;
-use tracing::debug;
use crate::aclient::{
- database::{ClientSqlite, current_context},
+ database::ClientSqlite,
record::{encryption::PASETO_V4, sqlite_store::SqliteStore},
};
use turtle_common::record::{DecryptedData, Host, HostId, Record, RecordId, RecordIdx};
diff --git a/crates/daemon/src/events.rs b/crates/daemon/src/events.rs
index 092e5f32..e3f6ebc9 100644
--- a/crates/daemon/src/events.rs
+++ b/crates/daemon/src/events.rs
@@ -15,7 +15,7 @@ use turtle_common::record::RecordId;
/// Events are broadcast to all components. Each component decides which
/// events it cares about in its `handle_event` implementation.
#[derive(Debug, Clone)]
-pub enum DaemonEvent {
+pub(crate) enum DaemonEvent {
// ---- History lifecycle ----
/// A command has started running.
HistoryStarted(History),
diff --git a/crates/daemon/src/main.rs b/crates/daemon/src/main.rs
index 1966e113..46d9ad4d 100644
--- a/crates/daemon/src/main.rs
+++ b/crates/daemon/src/main.rs
@@ -6,7 +6,6 @@ use std::path::PathBuf;
use turtle_daemon::aclient::{
database::ClientSqlite, record::sqlite_store::SqliteStore, settings::Settings,
};
-use turtle_daemon::api::client::{Probe, probe};
#[derive(Parser, Debug)]
#[command(infer_subcommands = true)]
diff --git a/crates/server/src/handlers/mod.rs b/crates/server/src/handlers/mod.rs
index e24bad14..1ac5a0c4 100644
--- a/crates/server/src/handlers/mod.rs
+++ b/crates/server/src/handlers/mod.rs
@@ -3,11 +3,11 @@ use axum::{Json, extract::State, http, response::IntoResponse};
use crate::router::AppState;
-pub mod v0;
+pub(crate) mod v0;
const VERSION: &str = env!("CARGO_PKG_VERSION");
-pub async fn index(state: State<AppState>) -> Json<IndexResponse> {
+pub(crate) async fn index(state: State<AppState>) -> Json<IndexResponse> {
let homage = r#""Through the fathomless deeps of space swims the star turtle Great A'Tuin, bearing on its back the four giant elephants who carry on their shoulders the mass of the Discworld." -- Sir Terry Pratchett"#;
let version = state
@@ -28,12 +28,12 @@ impl IntoResponse for ErrorResponseStatus<'_> {
}
}
-pub struct ErrorResponseStatus<'a> {
+pub(crate) struct ErrorResponseStatus<'a> {
pub error: ErrorResponse<'a>,
pub status: http::StatusCode,
}
-pub trait RespExt<'a> {
+pub(crate) trait RespExt<'a> {
fn with_status(self, status: http::StatusCode) -> ErrorResponseStatus<'a>;
fn reply(reason: &'a str) -> Self;
}
diff --git a/crates/server/src/handlers/v0/mod.rs b/crates/server/src/handlers/v0/mod.rs
index 2066636c..78fb47b8 100644
--- a/crates/server/src/handlers/v0/mod.rs
+++ b/crates/server/src/handlers/v0/mod.rs
@@ -1 +1 @@
-pub mod record;
+pub(crate) mod record;
diff --git a/crates/server/src/handlers/v0/record.rs b/crates/server/src/handlers/v0/record.rs
index f7758c1a..61fa2946 100644
--- a/crates/server/src/handlers/v0/record.rs
+++ b/crates/server/src/handlers/v0/record.rs
@@ -11,7 +11,7 @@ use crate::{
use turtle_common::record::{EncryptedData, HostId, Record, RecordIdx, RecordStatus};
#[instrument(skip_all, fields(user.id = user.id.to_string()))]
-pub async fn post(
+pub(crate) async fn post(
UserAuth(user): UserAuth,
state: State<AppState>,
Json(records): Json<Vec<Record<EncryptedData>>>,
@@ -50,7 +50,7 @@ pub async fn post(
}
#[instrument(skip_all, fields(user.id = user.id.to_string()))]
-pub async fn index(
+pub(crate) async fn index(
UserAuth(user): UserAuth,
state: State<AppState>,
) -> Result<Json<RecordStatus>, ErrorResponseStatus<'static>> {
@@ -75,7 +75,7 @@ pub async fn index(
}
#[derive(Deserialize)]
-pub struct NextParams {
+pub(crate) struct NextParams {
host: HostId,
tag: String,
start: Option<RecordIdx>,
@@ -83,7 +83,7 @@ pub struct NextParams {
}
#[instrument(skip_all, fields(user.id = user.id.to_string()))]
-pub async fn next(
+pub(crate) async fn next(
params: Query<NextParams>,
UserAuth(user): UserAuth,
state: State<AppState>,
diff --git a/crates/server/src/metrics.rs b/crates/server/src/metrics.rs
index 987af807..6380bef1 100644
--- a/crates/server/src/metrics.rs
+++ b/crates/server/src/metrics.rs
@@ -7,7 +7,7 @@ use axum::{
};
use metrics_exporter_prometheus::{Matcher, PrometheusBuilder, PrometheusHandle};
-pub fn setup_metrics_recorder() -> PrometheusHandle {
+pub(crate) fn setup_metrics_recorder() -> PrometheusHandle {
const EXPONENTIAL_SECONDS: &[f64] = &[
0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0,
];
@@ -25,7 +25,7 @@ pub fn setup_metrics_recorder() -> PrometheusHandle {
/// Middleware to record some common HTTP metrics
/// Generic over B to allow for arbitrary body types (eg Vec<u8>, Streams, a deserialized thing, etc)
/// Someday tower-http might provide a metrics middleware: <https://github.com/tower-rs/tower-http/issues/57>
-pub async fn track_metrics(req: Request, next: Next) -> impl IntoResponse {
+pub(crate) async fn track_metrics(req: Request, next: Next) -> impl IntoResponse {
let start = Instant::now();
let path = req.extensions().get::<MatchedPath>().map_or_else(
diff --git a/crates/server/src/router.rs b/crates/server/src/router.rs
index b0b98ecc..ce12f5b6 100644
--- a/crates/server/src/router.rs
+++ b/crates/server/src/router.rs
@@ -21,7 +21,7 @@ use crate::{
settings::Settings,
};
-pub struct UserAuth(pub User);
+pub(crate) struct UserAuth(pub User);
impl FromRequestParts<AppState> for UserAuth {
type Rejection = ErrorResponseStatus<'static>;
@@ -65,12 +65,12 @@ async fn semver(request: Request, next: Next) -> Response {
}
#[derive(Clone)]
-pub struct AppState {
+pub(crate) struct AppState {
pub database: ServerPostgres,
pub settings: Settings,
}
-pub fn router(database: ServerPostgres, settings: Settings) -> Router {
+pub(crate) fn router(database: ServerPostgres, settings: Settings) -> Router {
let routes = Router::new()
.route("/", get(handlers::index))
.route("/api/v0/{user_id}/record", post(handlers::v0::record::post))
diff --git a/crates/server/src/settings.rs b/crates/server/src/settings.rs
index e6626b15..256aa661 100644
--- a/crates/server/src/settings.rs
+++ b/crates/server/src/settings.rs
@@ -67,7 +67,7 @@ impl Settings {
.separator("__"),
);
- if let Ok(mut config_file) = std::env::var("TURTLE_SERVER_CONFIG").map(PathBuf::from) {
+ if let Ok(config_file) = std::env::var("TURTLE_SERVER_CONFIG").map(PathBuf::from) {
config_builder = if config_file.exists() {
config_builder.add_source(ConfigFile::new(
config_file.to_str().unwrap(),