use crate::state::{ChannelId, Cursor, InflightSync, Seq};
use crate::sync_session::EventEnvelope;
use helix_core::effect::TimerId;
use helix_core::Correlation;
use std::collections::BTreeMap;
const MAX_GATE_BUFFER: usize = 16_384;
#[derive(Debug)]
pub struct Gate {
pub timer_id: TimerId,
pub expected_seq: Seq,
}
pub struct Channel {
pub id: ChannelId,
pub cursor: Cursor,
pub gate: Option<Gate>,
pub pending_commits: std::collections::HashMap<Correlation, Seq>,
pub pending_stream_seq: Option<Seq>,
pub buffer: BTreeMap<Seq, EventEnvelope>,
pub inflight_sync: Option<InflightSync>,
pub last_sync_from_seq: Option<Seq>,
pub terminal_event_seq: Option<Seq>,
}
mod commit;
mod flow;
mod projection;
mod storage;
pub use projection::{emit_for_canonical_kind, emit_for_kind};
pub use storage::{
apply_read_op, edit_content_op, event_to_online_upsert_op, event_to_readback_upsert_op,
event_to_storage_op, event_to_sync_upsert_op, event_to_upsert_op, pin_state_op,
posts_update_edit_op, revoke_authority_op, revoke_op,
};
#[cfg(test)]
#[path = "gate_tests.rs"]
mod tests;