Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

rename db types to ensu

Prateek Sunal2857e3b20bb5
diff --git a/rust/ensu/db/src/llmchat.rs b/rust/ensu/db/src/ensu.rs
similarity index 98%
rename from rust/ensu/db/src/llmchat.rs
rename to rust/ensu/db/src/ensu.rs
index b2b9793eb6..da9637d749 100644
--- a/rust/ensu/db/src/llmchat.rs
+++ b/rust/ensu/db/src/ensu.rs
@@ -9,12 +9,12 @@ use crate::models::{AttachmentMeta, EntityType, Message, Session};
use crate::traits::{Clock, UuidGen};
/// High-level DB that ties together the main chat DB and the attachments upload-state DB.
-pub struct LlmChatDb<B: crate::Backend> {
+pub struct EnsuDb<B: crate::Backend> {
pub chat: ChatDb<B>,
pub attachments: AttachmentsDb<B>,
}
-impl<B: crate::Backend> LlmChatDb<B> {
+impl<B: crate::Backend> EnsuDb<B> {
pub fn new(chat: ChatDb<B>, attachments: AttachmentsDb<B>) -> Self {
Self { chat, attachments }
}
@@ -356,7 +356,7 @@ impl<B: crate::Backend> LlmChatDb<B> {
}
#[cfg(feature = "sqlite")]
-impl LlmChatDb<crate::backend::sqlite::SqliteBackend> {
+impl EnsuDb<crate::backend::sqlite::SqliteBackend> {
pub fn open_sqlite(
main_path: impl AsRef<std::path::Path>,
attachments_path: impl AsRef<std::path::Path>,
diff --git a/rust/ensu/db/src/lib.rs b/rust/ensu/db/src/lib.rs
index 54c7a9e60d..03ad30e80e 100644
--- a/rust/ensu/db/src/lib.rs
+++ b/rust/ensu/db/src/lib.rs
@@ -6,8 +6,8 @@ pub mod attachments_schema;
pub mod backend;
pub mod crypto;
pub mod db;
+pub mod ensu;
pub mod error;
-pub mod llmchat;
pub mod migrations;
pub mod models;
pub mod schema;
@@ -18,8 +18,8 @@ pub mod traits;
pub use crate::attachments_db::{AttachmentUploadRow, AttachmentsDb, UploadState};
pub use crate::backend::{Backend, BackendTx, Row, Value};
pub use crate::db::ChatDb;
+pub use crate::ensu::EnsuDb;
pub use crate::error::{Error, Result};
-pub use crate::llmchat::LlmChatDb;
pub use crate::models::{AttachmentKind, AttachmentMeta, EntityType, Message, Sender, Session};
pub use crate::sync_state_db::{SyncEntityState, SyncStateDb};
pub use crate::traits::{
diff --git a/rust/ensu/sync/src/sync.rs b/rust/ensu/sync/src/sync.rs
index 744a9dc808..6e1bc867f3 100644
--- a/rust/ensu/sync/src/sync.rs
+++ b/rust/ensu/sync/src/sync.rs
@@ -6,8 +6,8 @@ use std::sync::atomic::{AtomicBool, Ordering};
use zeroize::Zeroizing;
use ensu_db::{
- AttachmentKind, AttachmentMeta, AttachmentStore, Clock, EntityType, FsAttachmentStore,
- LlmChatDb, Message, Sender, Session, SqliteBackend, SyncEntityState, SyncStateDb, SystemClock,
+ AttachmentKind, AttachmentMeta, AttachmentStore, Clock, EnsuDb, EntityType, FsAttachmentStore,
+ Message, Sender, Session, SqliteBackend, SyncEntityState, SyncStateDb, SystemClock,
UploadState,
};
use ente_core::crypto::keys;
@@ -107,7 +107,7 @@ enum ChatKeyStatus {
}
pub struct SyncEngine {
- db: LlmChatDb<SqliteBackend>,
+ db: EnsuDb<SqliteBackend>,
sync_state: SyncStateDb<SqliteBackend>,
attachment_store: FsAttachmentStore,
plaintext_dir: Option<PathBuf>,
@@ -135,7 +135,7 @@ impl SyncEngine {
let _ = ensu_db::traits::ensure_directory(dir);
}
- let db = LlmChatDb::open_sqlite_with_defaults(main_db_path, sync_db_path.clone(), db_key)?;
+ let db = EnsuDb::open_sqlite_with_defaults(main_db_path, sync_db_path.clone(), db_key)?;
let sync_state = SyncStateDb::open_sqlite_with_defaults(sync_db_path)?;
let attachment_store = FsAttachmentStore::new(attachments_dir);
Ok(Self {
diff --git a/rust/ensu/sync/tests/sync_integration.rs b/rust/ensu/sync/tests/sync_integration.rs
index 725f78e0bd..0f5607757f 100644
--- a/rust/ensu/sync/tests/sync_integration.rs
+++ b/rust/ensu/sync/tests/sync_integration.rs
@@ -1,4 +1,4 @@
-use ensu_db::LlmChatDb;
+use ensu_db::EnsuDb;
use ensu_db::crypto::KEY_BYTES;
use ensu_sync::SyncAuth;
use ensu_sync::SyncEngine;
@@ -143,7 +143,7 @@ fn pull_applies_remote_sessions_and_messages() {
let auth = make_auth(&server, master_key);
engine.sync(auth).expect("sync");
- let db = LlmChatDb::open_sqlite_with_defaults(
+ let db = EnsuDb::open_sqlite_with_defaults(
env.main_db_path.clone(),
env.attachments_db_path.clone(),
db_key,
@@ -176,7 +176,7 @@ fn push_only_needs_sync_messages() {
)
.expect("sync engine");
- let db = LlmChatDb::open_sqlite_with_defaults(
+ let db = EnsuDb::open_sqlite_with_defaults(
env.main_db_path.clone(),
env.attachments_db_path.clone(),
db_key.clone(),
@@ -299,7 +299,7 @@ fn tombstone_removes_messages() {
let auth = make_auth(&server, master_key);
engine.sync(auth).expect("sync");
- let db = LlmChatDb::open_sqlite_with_defaults(
+ let db = EnsuDb::open_sqlite_with_defaults(
env.main_db_path.clone(),
env.attachments_db_path.clone(),
db_key,
diff --git a/rust/uniffi/ensu/db/src/api.rs b/rust/uniffi/ensu/db/src/api.rs
index 42de99a532..fd692b01f8 100644
--- a/rust/uniffi/ensu/db/src/api.rs
+++ b/rust/uniffi/ensu/db/src/api.rs
@@ -107,8 +107,8 @@ pub struct Message {
}
#[derive(uniffi::Object)]
-pub struct LlmChatDb {
- inner: core::LlmChatDb<core::SqliteBackend>,
+pub struct EnsuDb {
+ inner: core::EnsuDb<core::SqliteBackend>,
}
fn to_session(session: core::Session) -> Session {
@@ -140,7 +140,7 @@ fn to_message(message: core::Message) -> Message {
}
#[uniffi::export]
-impl LlmChatDb {
+impl EnsuDb {
#[uniffi::constructor]
pub fn open(
main_db_path: String,
@@ -148,7 +148,7 @@ impl LlmChatDb {
key: Vec<u8>,
) -> Result<Self, DbError> {
let inner =
- core::LlmChatDb::open_sqlite_with_defaults(main_db_path, attachments_db_path, key)?;
+ core::EnsuDb::open_sqlite_with_defaults(main_db_path, attachments_db_path, key)?;
Ok(Self { inner })
}
diff --git a/rust/uniffi/ensu/db/src/api.udl b/rust/uniffi/ensu/db/src/api.udl
index 0a8b198739..8f6622ddb6 100644
--- a/rust/uniffi/ensu/db/src/api.udl
+++ b/rust/uniffi/ensu/db/src/api.udl
@@ -42,9 +42,9 @@ dictionary Message {
};
namespace db {
- interface LlmChatDb {
+ interface EnsuDb {
[Constructor, Throws=DbError]
- LlmChatDb(string main_db_path, string attachments_db_path, sequence<u8> key);
+ EnsuDb(string main_db_path, string attachments_db_path, sequence<u8> key);
[Throws=DbError]
Session create_session(string title);