aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/src/atuin_client/history
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-11 14:20:49 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-11 14:20:49 +0200
commit199563550dd41c3dfb703bd3747604a8a03cdbc5 (patch)
tree30cfa3e5539f782b7571091c742ee1c219e138fb /crates/turtle/src/atuin_client/history
parentchore: Restore db migrations (diff)
downloadatuin-199563550dd41c3dfb703bd3747604a8a03cdbc5.zip
chore: Remove all `pub`s
They will not be marked by rustc/cargo as unused, and as atuin doesn't expose an API all of them _should_ be `pub(crate)`
Diffstat (limited to 'crates/turtle/src/atuin_client/history')
-rw-r--r--crates/turtle/src/atuin_client/history/builder.rs8
-rw-r--r--crates/turtle/src/atuin_client/history/store.rs32
2 files changed, 20 insertions, 20 deletions
diff --git a/crates/turtle/src/atuin_client/history/builder.rs b/crates/turtle/src/atuin_client/history/builder.rs
index 72a505fd..50a9d2af 100644
--- a/crates/turtle/src/atuin_client/history/builder.rs
+++ b/crates/turtle/src/atuin_client/history/builder.rs
@@ -6,7 +6,7 @@ use super::History;
///
/// The only two required fields are `timestamp` and `command`.
#[derive(Debug, Clone, TypedBuilder)]
-pub struct HistoryImported {
+pub(crate) struct HistoryImported {
timestamp: time::OffsetDateTime,
#[builder(setter(into))]
command: String,
@@ -49,7 +49,7 @@ impl From<HistoryImported> for History {
/// so it doesn't have any fields which are known only after
/// the command is finished, such as `exit` or `duration`.
#[derive(Debug, Clone, TypedBuilder)]
-pub struct HistoryCaptured {
+pub(crate) struct HistoryCaptured {
timestamp: time::OffsetDateTime,
#[builder(setter(into))]
command: String,
@@ -82,7 +82,7 @@ impl From<HistoryCaptured> for History {
///
/// All fields are required, as they are all present in the database.
#[derive(Debug, Clone, TypedBuilder)]
-pub struct HistoryFromDb {
+pub(crate) struct HistoryFromDb {
id: String,
timestamp: time::OffsetDateTime,
command: String,
@@ -120,7 +120,7 @@ impl From<HistoryFromDb> for History {
/// For the old setup, we could just rely on History::new to read some of the missing
/// data. This is no longer the case.
#[derive(Debug, Clone, TypedBuilder)]
-pub struct HistoryDaemonCapture {
+pub(crate) struct HistoryDaemonCapture {
timestamp: time::OffsetDateTime,
#[builder(setter(into))]
command: String,
diff --git a/crates/turtle/src/atuin_client/history/store.rs b/crates/turtle/src/atuin_client/history/store.rs
index 66d9db47..b2265698 100644
--- a/crates/turtle/src/atuin_client/history/store.rs
+++ b/crates/turtle/src/atuin_client/history/store.rs
@@ -14,14 +14,14 @@ use crate::atuin_common::record::{DecryptedData, Host, HostId, Record, RecordId,
use super::{HISTORY_TAG, HISTORY_VERSION, HISTORY_VERSION_V0, History, HistoryId};
#[derive(Debug, Clone)]
-pub struct HistoryStore {
- pub store: SqliteStore,
- pub host_id: HostId,
- pub encryption_key: [u8; 32],
+pub(crate) struct HistoryStore {
+ pub(crate) store: SqliteStore,
+ pub(crate) host_id: HostId,
+ pub(crate) encryption_key: [u8; 32],
}
#[derive(Debug, Eq, PartialEq, Clone)]
-pub enum HistoryRecord {
+pub(crate) enum HistoryRecord {
Create(History), // Create a history record
Delete(HistoryId), // Delete a history record, identified by ID
}
@@ -39,7 +39,7 @@ impl HistoryRecord {
/// twice.
///
/// Deletion simply refers to the history by ID
- pub fn serialize(&self) -> Result<DecryptedData> {
+ pub(crate) fn serialize(&self) -> Result<DecryptedData> {
// probably don't actually need to use rmp here, but if we ever need to extend it, it's a
// nice wrapper around raw byte stuff
use rmp::encode;
@@ -65,7 +65,7 @@ impl HistoryRecord {
Ok(DecryptedData(output))
}
- pub fn deserialize(bytes: &DecryptedData, version: &str) -> Result<Self> {
+ pub(crate) fn deserialize(bytes: &DecryptedData, version: &str) -> Result<Self> {
use rmp::decode;
fn error_report<E: std::fmt::Debug>(err: E) -> eyre::Report {
@@ -110,7 +110,7 @@ impl HistoryRecord {
}
impl HistoryStore {
- pub fn new(store: SqliteStore, host_id: HostId, encryption_key: [u8; 32]) -> Self {
+ pub(crate) fn new(store: SqliteStore, host_id: HostId, encryption_key: [u8; 32]) -> Self {
HistoryStore {
store,
host_id,
@@ -175,7 +175,7 @@ impl HistoryStore {
Ok(())
}
- pub async fn delete(&self, id: HistoryId) -> Result<(RecordId, RecordIdx)> {
+ pub(crate) async fn delete(&self, id: HistoryId) -> Result<(RecordId, RecordIdx)> {
let record = HistoryRecord::Delete(id);
self.push_record(record).await
@@ -183,7 +183,7 @@ impl HistoryStore {
/// Delete a batch of history entries via the record store.
/// Returns the record IDs so the caller can run incremental_build when ready.
- pub async fn delete_entries(
+ pub(crate) async fn delete_entries(
&self,
entries: impl IntoIterator<Item = History>,
) -> Result<Vec<RecordId>> {
@@ -195,7 +195,7 @@ impl HistoryStore {
Ok(record_ids)
}
- pub async fn push(&self, history: History) -> Result<(RecordId, RecordIdx)> {
+ pub(crate) async fn push(&self, history: History) -> Result<(RecordId, RecordIdx)> {
// TODO(ellie): move the history store to its own file
// it's tiny rn so fine as is
let record = HistoryRecord::Create(history);
@@ -203,7 +203,7 @@ impl HistoryStore {
self.push_record(record).await
}
- pub async fn history(&self) -> Result<Vec<HistoryRecord>> {
+ pub(crate) async fn history(&self) -> Result<Vec<HistoryRecord>> {
// Atm this loads all history into memory
// Not ideal as that is potentially quite a lot, although history will be small.
let records = self.store.all_tagged(HISTORY_TAG).await?;
@@ -226,7 +226,7 @@ impl HistoryStore {
Ok(ret)
}
- pub async fn build(&self, database: &dyn Database) -> Result<()> {
+ pub(crate) async fn build(&self, database: &dyn Database) -> Result<()> {
// I'd like to change how we rebuild and not couple this with the database, but need to
// consider the structure more deeply. This will be easy to change.
@@ -258,7 +258,7 @@ impl HistoryStore {
Ok(())
}
- pub async fn incremental_build(&self, database: &dyn Database, ids: &[RecordId]) -> Result<()> {
+ pub(crate) async fn incremental_build(&self, database: &dyn Database, ids: &[RecordId]) -> Result<()> {
for id in ids {
let record = self.store.get(*id).await;
@@ -299,7 +299,7 @@ impl HistoryStore {
/// Get a list of history IDs that exist in the store
/// Note: This currently involves loading all history into memory. This is not going to be a
/// large amount in absolute terms, but do not all it in a hot loop.
- pub async fn history_ids(&self) -> Result<HashSet<HistoryId>> {
+ pub(crate) async fn history_ids(&self) -> Result<HashSet<HistoryId>> {
let history = self.history().await?;
let ret = HashSet::from_iter(history.iter().map(|h| match h {
@@ -310,7 +310,7 @@ impl HistoryStore {
Ok(ret)
}
- pub async fn init_store(&self, db: &impl Database) -> Result<()> {
+ pub(crate) async fn init_store(&self, db: &impl Database) -> Result<()> {
let pb = ProgressBar::new_spinner();
pb.set_style(
ProgressStyle::with_template("{spinner:.blue} {msg}")