pub(crate) fn chunk_ref(source_chunk: &str) -> String {
use sha2::{Digest, Sha256};
if source_chunk.is_empty() {
return "chunk:none".to_string();
}
let mut hasher = Sha256::new();
hasher.update(source_chunk.as_bytes());
let digest = hasher.finalize();
let hex: String = digest.iter().take(4).map(|b| format!("{b:02x}")).collect();
format!("chunk:{hex}")
}
pub(crate) fn current_iso_timestamp() -> String {
use time::OffsetDateTime;
use time::format_description::well_known::Rfc3339;
OffsetDateTime::now_utc()
.format(&Rfc3339)
.unwrap_or_else(|_| "1970-01-01T00:00:00Z".to_string())
}