use crate::error::{FormatError, Result};
pub const LOOKUP_IDS: usize = 10_000;
pub const SAMPLE_IDS: usize = 1_000;
pub const COMMIT_ENTRIES: usize = 2_000;
pub const PACK_SEGMENTS: usize = 2_000;
pub const PACK_BYTES: u64 = 32 * 1024 * 1024;
pub const FILES_PER_SET: usize = 16;
pub const PATH_BYTES: usize = 1_024;
pub const SET_PATH_BYTES: usize = 3_072;
pub const SEALED_RECORD_BYTES: usize = 4_096;
pub const RECORD_ALIGN: usize = 256;
pub const DEFAULT_PLAINTEXT_BYTES: u64 = 64 * 1024 * 1024;
pub const MAX_PLAINTEXT_BYTES: u64 = 1024 * 1024 * 1024;
pub const ROSTER_BYTES: usize = 1024 * 1024;
pub const ROSTER_MEMBERS: usize = 1_000;
pub const ROSTER_SIGNATURES: usize = 4;
pub const BECH32_CHARS: usize = 1_024;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Limits {
plaintext_bytes: u64,
}
impl Limits {
pub fn new(plaintext_bytes: u64) -> Result<Self> {
if plaintext_bytes > MAX_PLAINTEXT_BYTES {
return Err(FormatError::LimitExceeded("plaintext per artifact set"));
}
Ok(Self { plaintext_bytes })
}
pub fn plaintext_bytes(&self) -> u64 {
self.plaintext_bytes
}
}
impl Default for Limits {
fn default() -> Self {
Self {
plaintext_bytes: DEFAULT_PLAINTEXT_BYTES,
}
}
}