mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2026-01-06 23:15:31 +08:00
Store quotas as u64
This commit is contained in:
parent
48f255b31f
commit
f92027142c
9 changed files with 15 additions and 15 deletions
|
|
@ -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>,
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ pub enum PrincipalAction {
|
|||
pub enum PrincipalValue {
|
||||
String(String),
|
||||
StringList(Vec<String>),
|
||||
Integer(u32),
|
||||
Integer(u64),
|
||||
}
|
||||
|
||||
impl PrincipalUpdate {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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? {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue