mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-13 15:46:53 +00:00
Merge branch 'main' into next-v2
This commit is contained in:
@@ -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
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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> {
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user