From 620cf8fa33835c1ce1e56b1028ff6e2a6fbe0f39 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Thu, 9 Jul 2026 22:00:59 +0200 Subject: chore: Add more things --- crates/server/src/database/db/mod.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'crates/server/src/database/db/mod.rs') diff --git a/crates/server/src/database/db/mod.rs b/crates/server/src/database/db/mod.rs index 77bd0c61..c95a2ed4 100644 --- a/crates/server/src/database/db/mod.rs +++ b/crates/server/src/database/db/mod.rs @@ -2,11 +2,9 @@ use std::collections::HashMap; use rand::Rng; -use crate::{ - atuin_common::record::{EncryptedData, HostId, Record, RecordIdx, RecordStatus}, - atuin_server::database::{DbError, DbResult, DbSettings, models::User}, -}; +use crate::database::{DbError, DbResult, DbSettings, models::User}; use sqlx::postgres::PgPoolOptions; +use turtle_common::record::{EncryptedData, HostId, Record, RecordIdx, RecordStatus}; use tracing::instrument; use uuid::Uuid; @@ -17,7 +15,7 @@ mod wrappers; const MIN_PG_VERSION: u32 = 14; #[derive(Clone)] -pub(crate) struct ServerPostgres { +pub struct ServerPostgres { pool: sqlx::Pool, /// Optional read replica pool for read-only queries read_pool: Option>, @@ -32,7 +30,7 @@ impl ServerPostgres { } impl ServerPostgres { - pub(crate) async fn new(settings: &DbSettings) -> DbResult { + pub async fn new(settings: &DbSettings) -> DbResult { let pool = PgPoolOptions::new() .max_connections(100) .connect(settings.db_uri.as_str()) @@ -93,7 +91,7 @@ impl ServerPostgres { } #[instrument(skip_all)] - pub(crate) async fn add_records( + pub async fn add_records( &self, user: &User, records: &[Record], @@ -110,7 +108,7 @@ impl ServerPostgres { let mut heads = HashMap::<(HostId, &str), u64>::new(); for i in records { - let id = crate::atuin_common::utils::uuid_v7(); + let id = turtle_common::utils::uuid_v7(); let result = sqlx::query( " @@ -169,7 +167,7 @@ impl ServerPostgres { } #[instrument(skip_all)] - pub(crate) async fn next_records( + pub async fn next_records( &self, user: &User, host: HostId, @@ -222,7 +220,7 @@ impl ServerPostgres { Ok(ret) } - pub(crate) async fn status(&self, user: &User) -> DbResult { + pub async fn status(&self, user: &User) -> DbResult { // If IDX_CACHE_ROLLOUT is set, then we // 1. Read the value of the var, use it as a % chance of using the cache // 2. If we use the cache, just read from the cache table -- cgit v1.3.1