Skip to main content

fp_runtime/asupersync/
mod.rs

1use self::{
2    config::{AsupersyncConfig, CapabilitySet},
3    error::AsupersyncError,
4};
5
6pub mod codec;
7pub mod config;
8pub mod error;
9pub mod integrity;
10pub mod recovery;
11pub mod transport;
12
13pub use codec::{ArtifactCodec, ArtifactPayload, EncodedArtifact, PassthroughCodec};
14pub use config::{AsupersyncConfig as RuntimeAsupersyncConfig, CxCapability, RequiresCapabilities};
15pub use error::AsupersyncError as RuntimeAsupersyncError;
16pub use integrity::{Fnv1aVerifier, IntegrityProof, IntegrityVerifier};
17pub use recovery::{
18    ConservativeRecoveryPolicy, RecoveryOutcome, RecoveryPlan, RecoveryPolicy, RecoveryReport,
19    recover_once,
20};
21pub use transport::{InMemoryTransport, TransferReport, TransferStatus, TransportLayer};
22
23pub fn validate_capability_gate(
24    config: &AsupersyncConfig,
25    required: CapabilitySet,
26) -> Result<(), AsupersyncError> {
27    if config.capabilities.satisfies(required) {
28        Ok(())
29    } else {
30        Err(AsupersyncError::CapabilityDenied {
31            required,
32            available: config.capabilities,
33        })
34    }
35}