mirror of
https://github.com/zhaofengli/attic.git
synced 2025-03-05 08:17:05 +00:00
rustfmt, clippy
This commit is contained in:
parent
49c565f792
commit
7050d8f292
4 changed files with 8 additions and 8 deletions
|
@ -118,7 +118,7 @@ impl Serialize for Hash {
|
|||
}
|
||||
|
||||
/// Decodes a base16 or base32 encoded hash containing a specified number of bytes.
|
||||
fn decode_hash<'s>(s: &'s str, typ: &'static str, expected_bytes: usize) -> AtticResult<Vec<u8>> {
|
||||
fn decode_hash(s: &str, typ: &'static str, expected_bytes: usize) -> AtticResult<Vec<u8>> {
|
||||
let base16_len = expected_bytes * 2;
|
||||
let base32_len = (expected_bytes * 8 - 1) / 5 + 1;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ unsafe impl Send for FfiNixStore {}
|
|||
unsafe impl Sync for FfiNixStore {}
|
||||
|
||||
impl FfiNixStore {
|
||||
pub fn store<'a>(&'a self) -> Pin<&'a mut ffi::CNixStore> {
|
||||
pub fn store(&self) -> Pin<&mut ffi::CNixStore> {
|
||||
unsafe {
|
||||
let ptr = self.0.get().as_mut().unwrap();
|
||||
ptr.pin_mut()
|
||||
|
|
|
@ -159,12 +159,12 @@ async fn run_reap_orphan_chunks(state: &State) -> Result<()> {
|
|||
let storage = state.storage().await?;
|
||||
|
||||
let orphan_chunk_limit = match db.get_database_backend() {
|
||||
// Arbitrarily chosen sensible value since there's no good default to choose from for MySQL
|
||||
sea_orm::DatabaseBackend::MySql => 1000,
|
||||
// Arbitrarily chosen sensible value since there's no good default to choose from for MySQL
|
||||
sea_orm::DatabaseBackend::MySql => 1000,
|
||||
// Panic limit set by sqlx for postgresql: https://github.com/launchbadge/sqlx/issues/671#issuecomment-687043510
|
||||
sea_orm::DatabaseBackend::Postgres => u64::from(u16::MAX),
|
||||
// Default statement limit imposed by sqlite: https://www.sqlite.org/limits.html#max_variable_number
|
||||
sea_orm::DatabaseBackend::Sqlite => 500,
|
||||
// Default statement limit imposed by sqlite: https://www.sqlite.org/limits.html#max_variable_number
|
||||
sea_orm::DatabaseBackend::Sqlite => 500,
|
||||
};
|
||||
|
||||
// find all orphan chunks...
|
||||
|
|
|
@ -79,8 +79,8 @@ async fn upgrade_0_to_1(storage_path: &Path) -> ServerResult<()> {
|
|||
let name = file.file_name();
|
||||
let name_bytes = name.as_os_str().as_bytes();
|
||||
let parents = storage_path
|
||||
.join(OsStr::from_bytes(&name_bytes[0..1]))
|
||||
.join(OsStr::from_bytes(&name_bytes[0..2]));
|
||||
.join(OsStr::from_bytes(&name_bytes[0..1]))
|
||||
.join(OsStr::from_bytes(&name_bytes[0..2]));
|
||||
let new_path = parents.join(name);
|
||||
fs::create_dir_all(&parents).await.map_err(|e| {
|
||||
ErrorKind::StorageError(anyhow::anyhow!("Failed to create directory {}", e))
|
||||
|
|
Loading…
Add table
Reference in a new issue