pub mod audit;
pub mod bandwidth;
pub mod deletion;
pub mod eviction;
pub mod garbage_collection;
pub mod lifecycle;
pub mod preemption;
pub mod retention;
pub mod storage;
pub mod sync_mode;
pub mod classification;
pub mod context;
pub mod context_manager;
pub mod recovery;
pub mod registry;
pub mod sync_queue;
pub use peat_mesh::qos::{QoSClass, QoSPolicy};
pub use audit::{AuditAction, AuditEntry, AuditSummary, EvictionAuditLog};
pub use bandwidth::{
BandwidthAllocation, BandwidthConfig, BandwidthPermit, BandwidthQuota, QuotaConfig,
};
pub use deletion::{
DeleteResult, DeletionPolicy, DeletionPolicyRegistry, PropagationDirection, Tombstone,
TombstoneBatch, TombstoneDecodeError, TombstoneSyncMessage,
};
pub use eviction::{EvictionConfig, EvictionController, EvictionResult};
pub use garbage_collection::{
start_periodic_gc, GarbageCollector, GcConfig, GcResult, GcStats, GcStore, ResurrectionPolicy,
};
pub use lifecycle::{
make_lifecycle_decision, LifecycleDecision, LifecyclePolicies, LifecyclePolicy,
};
pub use preemption::{ActiveTransfer, PreemptionController, PreemptionStats, TransferId};
pub use retention::{RetentionPolicies, RetentionPolicy};
pub use storage::{
ClassStorageMetrics, EvictionCandidate, QoSAwareStorage, StorageMetrics, StoredDocument,
};
pub use sync_mode::{SyncMode, SyncModeRegistry};
pub use classification::DataType;
pub use context::{ContextProfile, MissionContext, QoSClassAdjustment};
pub use context_manager::{ContextChangeListener, ContextChangeLog, ContextManager};
pub use recovery::{RecoveryStats, SyncRecovery, UpdateBatch};
pub use registry::QoSRegistry;
pub use sync_queue::{PendingSync, PrioritySyncQueue, QueueStats};
use crate::cell::messaging::MessagePriority;
use crate::storage::file_distribution::TransferPriority;
impl From<QoSClass> for MessagePriority {
fn from(qos: QoSClass) -> Self {
match qos {
QoSClass::Critical => MessagePriority::Critical,
QoSClass::High => MessagePriority::High,
QoSClass::Normal => MessagePriority::Normal,
QoSClass::Low | QoSClass::Bulk => MessagePriority::Low,
}
}
}
impl From<MessagePriority> for QoSClass {
fn from(priority: MessagePriority) -> Self {
match priority {
MessagePriority::Critical => QoSClass::Critical,
MessagePriority::High => QoSClass::High,
MessagePriority::Normal => QoSClass::Normal,
MessagePriority::Low => QoSClass::Low,
}
}
}
impl From<QoSClass> for TransferPriority {
fn from(qos: QoSClass) -> Self {
match qos {
QoSClass::Critical => TransferPriority::Critical,
QoSClass::High => TransferPriority::High,
QoSClass::Normal => TransferPriority::Normal,
QoSClass::Low | QoSClass::Bulk => TransferPriority::Low,
}
}
}
impl From<TransferPriority> for QoSClass {
fn from(priority: TransferPriority) -> Self {
match priority {
TransferPriority::Critical => QoSClass::Critical,
TransferPriority::High => QoSClass::High,
TransferPriority::Normal => QoSClass::Normal,
TransferPriority::Low => QoSClass::Low,
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_message_priority_conversion() {
assert_eq!(
MessagePriority::from(QoSClass::Critical),
MessagePriority::Critical
);
assert_eq!(MessagePriority::from(QoSClass::High), MessagePriority::High);
assert_eq!(
MessagePriority::from(QoSClass::Normal),
MessagePriority::Normal
);
assert_eq!(MessagePriority::from(QoSClass::Low), MessagePriority::Low);
assert_eq!(MessagePriority::from(QoSClass::Bulk), MessagePriority::Low);
assert_eq!(
QoSClass::from(MessagePriority::Critical),
QoSClass::Critical
);
assert_eq!(QoSClass::from(MessagePriority::High), QoSClass::High);
assert_eq!(QoSClass::from(MessagePriority::Normal), QoSClass::Normal);
assert_eq!(QoSClass::from(MessagePriority::Low), QoSClass::Low);
}
#[test]
fn test_transfer_priority_conversion() {
assert_eq!(
TransferPriority::from(QoSClass::Critical),
TransferPriority::Critical
);
assert_eq!(
TransferPriority::from(QoSClass::High),
TransferPriority::High
);
assert_eq!(
TransferPriority::from(QoSClass::Normal),
TransferPriority::Normal
);
assert_eq!(TransferPriority::from(QoSClass::Low), TransferPriority::Low);
assert_eq!(
TransferPriority::from(QoSClass::Bulk),
TransferPriority::Low
);
assert_eq!(
QoSClass::from(TransferPriority::Critical),
QoSClass::Critical
);
assert_eq!(QoSClass::from(TransferPriority::High), QoSClass::High);
assert_eq!(QoSClass::from(TransferPriority::Normal), QoSClass::Normal);
assert_eq!(QoSClass::from(TransferPriority::Low), QoSClass::Low);
}
}