use std::collections::BTreeSet;
use std::time::Duration;
use calimero_context_config::types::ContextGroupId;
use calimero_node_primitives::delta_buffer::BufferedDelta;
use calimero_primitives::context::{ContextId, GroupMemberRole};
use calimero_primitives::identity::PublicKey;
use libp2p::PeerId;
use crate::delta_store::DeltaStore;
pub(crate) trait SyncStateAccess: Send + Sync {
fn delta_store(&self, context_id: &ContextId) -> Option<DeltaStore>;
fn get_or_register_delta_store(
&self,
context_id: ContextId,
factory: Box<dyn FnOnce() -> DeltaStore + Send>,
) -> (DeltaStore, bool);
fn end_sync_session(&self, context_id: &ContextId) -> Option<Vec<BufferedDelta>>;
fn cancel_sync_session(&self, context_id: &ContextId);
fn peer_identities(&self, peer_id: &PeerId) -> Option<BTreeSet<PublicKey>>;
fn cached_member_peers_for_group(
&self,
group: &ContextGroupId,
) -> Vec<(PeerId, GroupMemberRole)>;
fn reconcile_remaining_cooldown(&self, context_id: &ContextId) -> Option<(Duration, u32)>;
fn record_reconcile_success(&self, context_id: &ContextId);
fn record_reconcile_failure(&self, context_id: ContextId) -> u32;
}