Store quotas as u64

This commit is contained in:
mdecimus 2024-03-05 11:01:59 +01:00
parent 48f255b31f
commit f92027142c
9 changed files with 15 additions and 15 deletions

View file

@ -128,7 +128,7 @@ pub enum AccountCommands {
description: Option<String>,
/// Update quota in bytes
#[clap(short, long)]
quota: Option<u32>,
quota: Option<u64>,
/// Whether the account is an administrator
#[clap(short, long)]
is_admin: Option<bool>,

View file

@ -55,7 +55,7 @@ pub struct Principal {
#[serde(rename = "usedQuota")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub used_quota: Option<u32>,
pub used_quota: Option<u64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
@ -145,7 +145,7 @@ pub enum PrincipalAction {
pub enum PrincipalValue {
String(String),
StringList(Vec<String>),
Integer(u32),
Integer(u64),
}
impl PrincipalUpdate {

View file

@ -175,7 +175,7 @@ pub enum PrincipalAction {
pub enum PrincipalValue {
String(String),
StringList(Vec<String>),
Integer(u32),
Integer(u64),
}
impl PrincipalUpdate {

View file

@ -222,7 +222,7 @@ impl SqlMappings {
}
} else if name.eq_ignore_ascii_case(&self.column_quota) {
if let Value::Integer(quota) = value {
principal.quota = quota as u32;
principal.quota = quota as u64;
}
}
}

View file

@ -57,7 +57,7 @@ pub struct Principal<T> {
#[serde(rename = "type")]
pub typ: Type,
#[serde(default)]
pub quota: u32,
pub quota: u64,
pub name: String,
#[serde(default)]
pub secrets: Vec<String>,

View file

@ -82,7 +82,7 @@ impl<T: SessionStream> Session<T> {
}
// Refresh the mailbox if the modseq has changed or if it's a cache miss
if is_cache_miss || cached_state.modseq != modseq {
if is_cache_miss || cached_state.modseq.unwrap_or(0) < modseq.unwrap_or(0) {
match data.fetch_messages(&mailbox).await {
Ok(new_state) => {
*cached_state = new_state;

View file

@ -48,10 +48,10 @@ pub struct PrincipalResponse {
#[serde(rename = "type")]
pub typ: Type,
#[serde(default)]
pub quota: u32,
pub quota: u64,
#[serde(rename = "usedQuota")]
#[serde(default)]
pub used_quota: u32,
pub used_quota: u64,
#[serde(default)]
pub name: String,
#[serde(default)]
@ -204,7 +204,7 @@ impl JMAP {
let mut principal = PrincipalResponse::from(principal);
principal.used_quota =
self.get_used_quota(account_id).await.unwrap_or_default()
as u32;
as u64;
// Obtain member names
for member_id in

View file

@ -51,7 +51,7 @@ pub struct AccessToken {
pub access_to: Vec<(u32, Bitmap<Collection>)>,
pub name: String,
pub description: Option<String>,
pub quota: u32,
pub quota: u64,
pub is_superuser: bool,
}

View file

@ -37,9 +37,9 @@ impl FdbStore {
key: &[u8],
range: Range<usize>,
) -> crate::Result<Option<Vec<u8>>> {
let block_start = range.start as usize / MAX_VALUE_SIZE;
let bytes_start = range.start as usize % MAX_VALUE_SIZE;
let block_end = (range.end as usize / MAX_VALUE_SIZE) + 1;
let block_start = range.start / MAX_VALUE_SIZE;
let bytes_start = range.start % MAX_VALUE_SIZE;
let block_end = (range.end / MAX_VALUE_SIZE) + 1;
let begin = KeySerializer::new(key.len() + 3)
.write(SUBSPACE_BLOBS)
@ -64,7 +64,7 @@ impl FdbStore {
true,
);
let mut blob_data: Option<Vec<u8>> = None;
let blob_range = (range.end - range.start) as usize;
let blob_range = range.end - range.start;
'outer: while let Some(values) = values.next().await {
for value in values? {