-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage: move cas db from util into storage
Move cas db from util into storage. Signed-off-by: Jiang Liu <[email protected]>
- Loading branch information
Showing
7 changed files
with
46 additions
and
36 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (C) 2022-2023 Alibaba Cloud. All rights reserved. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use std::fmt::{self, Display, Formatter}; | ||
use std::io::Error; | ||
|
||
mod db; | ||
|
||
/// Error codes related to local cas. | ||
#[derive(Debug)] | ||
pub enum CasError { | ||
Io(Error), | ||
Db(rusqlite::Error), | ||
} | ||
|
||
impl Display for CasError { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { | ||
write!(f, "{:?}", self) | ||
} | ||
} | ||
|
||
impl std::error::Error for CasError {} | ||
|
||
impl From<rusqlite::Error> for CasError { | ||
fn from(e: rusqlite::Error) -> Self { | ||
CasError::Db(e) | ||
} | ||
} | ||
|
||
impl From<Error> for CasError { | ||
fn from(e: Error) -> Self { | ||
CasError::Io(e) | ||
} | ||
} | ||
|
||
/// Specialized `Result` for local cas. | ||
type Result<T> = std::result::Result<T, CasError>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters