@@ -13,9 +13,6 @@ mod migrator;
1313pub mod cost_model;
1414pub use cost_model:: interface:: CostModelStorageLayer ;
1515
16- mod memo;
17- pub use memo:: interface:: Memo ;
18-
1916/// The filename of the SQLite database for migration.
2017pub const DATABASE_FILENAME : & str = "sqlite.db" ;
2118/// The URL of the SQLite database for migration.
@@ -42,29 +39,18 @@ fn get_sqlite_url(file: &str) -> String {
4239 format ! ( "sqlite:{}?mode=rwc" , file)
4340}
4441
42+ pub type StorageResult < T > = Result < T , BackendError > ;
43+
4544#[ derive( Debug ) ]
4645pub enum CostModelError {
4746 // TODO: Add more error types
4847 UnknownStatisticType ,
4948 VersionedStatisticNotFound ,
5049}
5150
52- /// TODO convert this to `thiserror`
53- #[ derive( Debug ) ]
54- /// The different kinds of errors that might occur while running operations on a memo table.
55- pub enum MemoError {
56- UnknownGroup ,
57- UnknownLogicalExpression ,
58- UnknownPhysicalExpression ,
59- InvalidExpression ,
60- Database ( DbErr ) ,
61- }
62-
63- /// TODO convert this to `thiserror`
6451#[ derive( Debug ) ]
6552pub enum BackendError {
6653 CostModel ( CostModelError ) ,
67- Memo ( MemoError ) ,
6854 Database ( DbErr ) ,
6955 // TODO: Add other variants as needed for different error types
7056}
@@ -75,27 +61,12 @@ impl From<CostModelError> for BackendError {
7561 }
7662}
7763
78- impl From < MemoError > for BackendError {
79- fn from ( value : MemoError ) -> Self {
80- BackendError :: Memo ( value)
81- }
82- }
83-
8464impl From < DbErr > for BackendError {
8565 fn from ( value : DbErr ) -> Self {
8666 BackendError :: Database ( value)
8767 }
8868}
8969
90- impl From < DbErr > for MemoError {
91- fn from ( value : DbErr ) -> Self {
92- MemoError :: Database ( value)
93- }
94- }
95-
96- /// A type alias for a result with [`BackendError`] as the error type.
97- pub type StorageResult < T > = Result < T , BackendError > ;
98-
9970pub struct BackendManager {
10071 db : DatabaseConnection ,
10172}
0 commit comments