mirror of
https://github.com/mozilla-services/syncstorage-rs.git
synced 2025-08-06 20:06:57 +02:00
chore: updates for Rust 1.66 (#1451)
This commit is contained in:
parent
973e90fae8
commit
d11787965c
@ -1,4 +1,4 @@
|
||||
FROM rust:1.65-buster as builder
|
||||
FROM rust:1.66-buster as builder
|
||||
WORKDIR /app
|
||||
ADD . /app
|
||||
ENV PATH=$PATH:/root/.cargo/bin
|
||||
|
@ -139,13 +139,13 @@ pub fn commit(db: &MysqlDb, params: params::CommitBatch) -> Result<results::Comm
|
||||
let collection_id = db.get_collection_id(¶ms.collection)?;
|
||||
let timestamp = db.timestamp();
|
||||
sql_query(include_str!("batch_commit.sql"))
|
||||
.bind::<BigInt, _>(user_id as i64)
|
||||
.bind::<BigInt, _>(user_id)
|
||||
.bind::<Integer, _>(&collection_id)
|
||||
.bind::<BigInt, _>(&db.timestamp().as_i64())
|
||||
.bind::<BigInt, _>(&db.timestamp().as_i64())
|
||||
.bind::<BigInt, _>((MAXTTL as i64) * 1000) // XXX:
|
||||
.bind::<BigInt, _>(&batch_id)
|
||||
.bind::<BigInt, _>(user_id as i64)
|
||||
.bind::<BigInt, _>(user_id)
|
||||
.bind::<BigInt, _>(&db.timestamp().as_i64())
|
||||
.bind::<BigInt, _>(&db.timestamp().as_i64())
|
||||
.execute(&db.conn)?;
|
||||
@ -258,7 +258,7 @@ pub fn validate_batch_id(id: &str) -> Result<()> {
|
||||
}
|
||||
|
||||
fn encode_id(id: i64) -> String {
|
||||
base64::encode(&id.to_string())
|
||||
base64::encode(id.to_string())
|
||||
}
|
||||
|
||||
fn decode_id(id: &str) -> Result<i64> {
|
||||
|
@ -403,7 +403,7 @@ impl MysqlDb {
|
||||
collection: bso.collection.clone(),
|
||||
collection_id,
|
||||
})?;
|
||||
if usage.total_bytes >= self.quota.size as usize {
|
||||
if usage.total_bytes >= self.quota.size {
|
||||
let mut tags = HashMap::default();
|
||||
tags.insert("collection".to_owned(), bso.collection.clone());
|
||||
self.metrics.incr_with_tags("storage.quota.at_limit", tags);
|
||||
@ -489,7 +489,7 @@ impl MysqlDb {
|
||||
bso::expiry,
|
||||
))
|
||||
.filter(bso::user_id.eq(user_id))
|
||||
.filter(bso::collection_id.eq(collection_id as i32)) // XXX:
|
||||
.filter(bso::collection_id.eq(collection_id))
|
||||
.filter(bso::expiry.gt(now))
|
||||
.into_boxed();
|
||||
|
||||
@ -572,7 +572,7 @@ impl MysqlDb {
|
||||
let mut query = bso::table
|
||||
.select(bso::id)
|
||||
.filter(bso::user_id.eq(user_id))
|
||||
.filter(bso::collection_id.eq(collection_id as i32)) // XXX:
|
||||
.filter(bso::collection_id.eq(collection_id))
|
||||
.filter(bso::expiry.gt(self.timestamp().as_i64()))
|
||||
.into_boxed();
|
||||
|
||||
|
@ -1662,7 +1662,7 @@ impl SpannerDb {
|
||||
warn!("Quota at limit for user's collection: ({} bytes)", usage.total_bytes; "collection"=>collection);
|
||||
}
|
||||
}
|
||||
Ok(Some(usage.total_bytes as usize))
|
||||
Ok(Some(usage.total_bytes))
|
||||
}
|
||||
|
||||
// NOTE: Currently this put_bso_async_test impl. is only used during db tests,
|
||||
|
@ -625,7 +625,7 @@ async fn get_collection_usage() -> Result<()> {
|
||||
db.put_bso(pbso(
|
||||
uid,
|
||||
coll,
|
||||
&format!("b{}", i as i32),
|
||||
&format!("b{}", i),
|
||||
Some(&String::from_utf8_lossy(&payload)),
|
||||
None,
|
||||
None,
|
||||
|
@ -83,7 +83,7 @@ fn get_token_plaintext(
|
||||
context: format!("Failed to decode the client state hex: {}", e),
|
||||
..TokenserverError::internal_error()
|
||||
})?;
|
||||
let client_state_b64 = base64::encode_config(&client_state, base64::URL_SAFE_NO_PAD);
|
||||
let client_state_b64 = base64::encode_config(client_state, base64::URL_SAFE_NO_PAD);
|
||||
|
||||
format!(
|
||||
"{:013}-{:}",
|
||||
|
@ -313,7 +313,7 @@ pub async fn post_collection_batch(
|
||||
CreateBatch {
|
||||
id: id.clone(),
|
||||
size: if coll.quota_enabled {
|
||||
Some(usage.total_bytes as usize)
|
||||
Some(usage.total_bytes)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user