Merge pull request 'fix compilation warnings' (#959) from fixes into main
All checks were successful
ci/woodpecker/push/debug Pipeline was successful
ci/woodpecker/cron/debug Pipeline was successful
ci/woodpecker/cron/release/2 Pipeline was successful
ci/woodpecker/cron/release/1 Pipeline was successful
ci/woodpecker/cron/release/3 Pipeline was successful
ci/woodpecker/cron/release/4 Pipeline was successful
ci/woodpecker/cron/publish Pipeline was successful
All checks were successful
ci/woodpecker/push/debug Pipeline was successful
ci/woodpecker/cron/debug Pipeline was successful
ci/woodpecker/cron/release/2 Pipeline was successful
ci/woodpecker/cron/release/1 Pipeline was successful
ci/woodpecker/cron/release/3 Pipeline was successful
ci/woodpecker/cron/release/4 Pipeline was successful
ci/woodpecker/cron/publish Pipeline was successful
Reviewed-on: #959
This commit is contained in:
commit
859b38b0d2
7 changed files with 14 additions and 17 deletions
4
Makefile
4
Makefile
|
@ -2,9 +2,7 @@
|
||||||
|
|
||||||
all:
|
all:
|
||||||
clear
|
clear
|
||||||
cargo build \
|
cargo build
|
||||||
--config 'target.x86_64-unknown-linux-gnu.linker="clang"' \
|
|
||||||
--config 'target.x86_64-unknown-linux-gnu.rustflags=["-C", "link-arg=-fuse-ld=mold"]' \
|
|
||||||
|
|
||||||
# ----
|
# ----
|
||||||
|
|
||||||
|
|
|
@ -317,7 +317,6 @@ impl ApiHandler for S3ApiServer {
|
||||||
} => {
|
} => {
|
||||||
let query = ListPartsQuery {
|
let query = ListPartsQuery {
|
||||||
bucket_name: ctx.bucket_name.clone(),
|
bucket_name: ctx.bucket_name.clone(),
|
||||||
bucket_id,
|
|
||||||
key,
|
key,
|
||||||
upload_id,
|
upload_id,
|
||||||
part_number_marker: part_number_marker.map(|p| p.min(10000)),
|
part_number_marker: part_number_marker.map(|p| p.min(10000)),
|
||||||
|
|
|
@ -54,7 +54,6 @@ pub struct ListMultipartUploadsQuery {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct ListPartsQuery {
|
pub struct ListPartsQuery {
|
||||||
pub bucket_name: String,
|
pub bucket_name: String,
|
||||||
pub bucket_id: Uuid,
|
|
||||||
pub key: String,
|
pub key: String,
|
||||||
pub upload_id: String,
|
pub upload_id: String,
|
||||||
pub part_number_marker: Option<u64>,
|
pub part_number_marker: Option<u64>,
|
||||||
|
@ -1245,10 +1244,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_fetch_part_info() -> Result<(), Error> {
|
fn test_fetch_part_info() -> Result<(), Error> {
|
||||||
let uuid = Uuid::from([0x08; 32]);
|
|
||||||
let mut query = ListPartsQuery {
|
let mut query = ListPartsQuery {
|
||||||
bucket_name: "a".to_string(),
|
bucket_name: "a".to_string(),
|
||||||
bucket_id: uuid,
|
|
||||||
key: "a".to_string(),
|
key: "a".to_string(),
|
||||||
upload_id: "xx".to_string(),
|
upload_id: "xx".to_string(),
|
||||||
part_number_marker: None,
|
part_number_marker: None,
|
||||||
|
|
|
@ -13,7 +13,6 @@ static GARAGE_TEST_SECRET: &str =
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
pub struct Key {
|
pub struct Key {
|
||||||
pub name: Option<String>,
|
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub secret: String,
|
pub secret: String,
|
||||||
}
|
}
|
||||||
|
@ -213,10 +212,7 @@ api_bind_addr = "127.0.0.1:{admin_port}"
|
||||||
assert!(!key.id.is_empty(), "Invalid key: Key ID is empty");
|
assert!(!key.id.is_empty(), "Invalid key: Key ID is empty");
|
||||||
assert!(!key.secret.is_empty(), "Invalid key: Key secret is empty");
|
assert!(!key.secret.is_empty(), "Invalid key: Key secret is empty");
|
||||||
|
|
||||||
Key {
|
key
|
||||||
name: maybe_name.map(String::from),
|
|
||||||
..key
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,7 @@ impl Garage {
|
||||||
|
|
||||||
pub async fn locked_helper(&self) -> helper::locked::LockedHelper {
|
pub async fn locked_helper(&self) -> helper::locked::LockedHelper {
|
||||||
let lock = self.bucket_lock.lock().await;
|
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
|
/// See issues: #649, #723
|
||||||
pub struct LockedHelper<'a>(
|
pub struct LockedHelper<'a>(
|
||||||
pub(crate) &'a Garage,
|
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)]
|
#[allow(clippy::ptr_arg)]
|
||||||
impl<'a> LockedHelper<'a> {
|
impl<'a> LockedHelper<'a> {
|
||||||
pub fn bucket(&self) -> BucketHelper<'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")
|
.expect("bad local midnight")
|
||||||
.timestamp_millis() as u64;
|
.timestamp_millis() as u64;
|
||||||
}
|
}
|
||||||
midnight.timestamp_millis() as u64
|
midnight.and_utc().timestamp_millis() as u64
|
||||||
}
|
}
|
||||||
|
|
||||||
fn next_date(ts: u64) -> NaiveDate {
|
fn next_date(ts: u64) -> NaiveDate {
|
||||||
NaiveDateTime::from_timestamp_millis(ts as i64)
|
DateTime::<Utc>::from_timestamp_millis(ts as i64)
|
||||||
.expect("bad timestamp")
|
.expect("bad timestamp")
|
||||||
.date()
|
.date_naive()
|
||||||
.succ_opt()
|
.succ_opt()
|
||||||
.expect("no next day")
|
.expect("no next day")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue