use super::*;
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct StorageCommitRecord {
pub sequence: u64,
pub operation: String,
pub bucket: String,
pub key: String,
pub version_id: String,
pub committed_epoch_seconds: u64,
pub checksum_sha256: String,
}
impl BucketWarden {
pub fn storage_commit_records(&self) -> &[StorageCommitRecord] {
&self.storage_commits
}
pub(crate) fn record_storage_commit(
&mut self,
operation: &str,
bucket: &str,
key: &str,
version_id: &str,
checksum_sha256: &str,
) {
let sequence = self.storage_commits.len() as u64 + 1;
self.storage_commits.push(StorageCommitRecord {
sequence,
operation: operation.to_string(),
bucket: bucket.to_string(),
key: key.to_string(),
version_id: version_id.to_string(),
committed_epoch_seconds: self.clock_epoch_seconds,
checksum_sha256: checksum_sha256.to_string(),
});
}
}