Merge branch 'main' into next-v2

This commit is contained in:
Alex Auvolat
2025-03-05 14:50:22 +01:00
70 changed files with 2519 additions and 854 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "garage_model"
version = "1.0.1"
version = "1.1.0"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"
+1 -1
View File
@@ -329,7 +329,7 @@ impl Garage {
pub async fn locked_helper(&self) -> helper::locked::LockedHelper {
let lock = self.bucket_lock.lock().await;
helper::locked::LockedHelper(self, lock)
helper::locked::LockedHelper(self, Some(lock))
}
}
+8 -1
View File
@@ -27,9 +27,16 @@ use crate::permission::BucketKeyPerm;
/// See issues: #649, #723
pub struct LockedHelper<'a>(
pub(crate) &'a Garage,
pub(crate) tokio::sync::MutexGuard<'a, ()>,
pub(crate) Option<tokio::sync::MutexGuard<'a, ()>>,
);
impl<'a> Drop for LockedHelper<'a> {
fn drop(&mut self) {
// make it explicit that the mutexguard lives until here
drop(self.1.take())
}
}
#[allow(clippy::ptr_arg)]
impl<'a> LockedHelper<'a> {
pub fn bucket(&self) -> BucketHelper<'a> {
+3 -3
View File
@@ -395,13 +395,13 @@ fn midnight_ts(date: NaiveDate, use_local_tz: bool) -> u64 {
.expect("bad local midnight")
.timestamp_millis() as u64;
}
midnight.timestamp_millis() as u64
midnight.and_utc().timestamp_millis() as u64
}
fn next_date(ts: u64) -> NaiveDate {
NaiveDateTime::from_timestamp_millis(ts as i64)
DateTime::<Utc>::from_timestamp_millis(ts as i64)
.expect("bad timestamp")
.date()
.date_naive()
.succ_opt()
.expect("no next day")
}