diff --git a/double-ratchets/src/storage/db.rs b/double-ratchets/src/storage/db.rs index b07fdd3..2c216d7 100644 --- a/double-ratchets/src/storage/db.rs +++ b/double-ratchets/src/storage/db.rs @@ -2,7 +2,7 @@ use std::collections::HashSet; -use storage::{SqliteDb, StorageBackend, StorageError, params}; +use storage::{SqliteDb, StorageError, params}; use super::types::RatchetStateRecord; use crate::{ @@ -62,7 +62,7 @@ impl RatchetStorage { /// Creates a new ratchet storage with the given database. fn run_migration(db: SqliteDb) -> Result { // Initialize schema - db.execute_batch(RATCHET_SCHEMA)?; + db.connection().execute_batch(RATCHET_SCHEMA)?; Ok(Self { db }) } diff --git a/storage/src/lib.rs b/storage/src/lib.rs index 908c848..bacc9b6 100644 --- a/storage/src/lib.rs +++ b/storage/src/lib.rs @@ -13,23 +13,3 @@ pub use sqlite::{SqliteDb, StorageConfig}; // Re-export rusqlite types that domain crates will need pub use rusqlite::{Error as RusqliteError, Transaction, params}; - -/// Trait for types that can be stored and retrieved. -/// -/// Implement this trait for domain-specific storage operations. -pub trait Storable: Sized { - /// The key type used to identify records. - type Key; - - /// The error type returned by storage operations. - type Error: From; -} - -/// Trait for storage backends. -pub trait StorageBackend { - /// Initialize the storage (e.g., create tables). - fn init(&self) -> Result<(), StorageError>; - - /// Execute a batch of SQL statements (for schema migrations). - fn execute_batch(&self, sql: &str) -> Result<(), StorageError>; -} diff --git a/storage/src/sqlite.rs b/storage/src/sqlite.rs index afe34bf..cae9309 100644 --- a/storage/src/sqlite.rs +++ b/storage/src/sqlite.rs @@ -3,7 +3,7 @@ use rusqlite::Connection; use std::path::Path; -use crate::{StorageBackend, StorageError}; +use crate::StorageError; /// Configuration for SQLite storage. #[derive(Debug, Clone)] @@ -81,15 +81,3 @@ impl SqliteDb { Ok(self.conn.transaction()?) } } - -impl StorageBackend for SqliteDb { - fn init(&self) -> Result<(), StorageError> { - // Base initialization is done in new() - Ok(()) - } - - fn execute_batch(&self, sql: &str) -> Result<(), StorageError> { - self.conn.execute_batch(sql)?; - Ok(()) - } -}