Parser synchronization state for one registered editor buffer.
All transitions live here so the manager remains the sole process owner while registration invariants stay explicit and independently testable.
Summary
Functions
Returns whether a version belongs to the current or most recently completed parse.
Marks an asynchronous snapshot request as in flight.
Returns whether a snapshot token belongs to the current request.
Marks a parser version and snapshot target as in flight.
Completes only the matching parser version.
Completes an unchanged snapshot without parser emission.
Records the newest observed buffer change sequence.
Creates a registration that requires an initial full parse.
Returns whether an idle registration has synchronization work.
Resets volatile parser state and requires a fresh full snapshot.
Returns the cursor to request from the buffer.
Returns whether the parser is synchronized through the required buffer sequence.
Types
@type phase() :: :idle | {:awaiting_snapshot, reference()} | {:parsing, pos_integer(), Minga.Buffer.ChangeLog.sequence()}
@type t() :: %Minga.Parser.BufferRegistration{ config: Minga.Parser.BufferConfig.t(), force_full?: boolean(), generation: reference(), id: pos_integer(), last_completed_version: non_neg_integer(), latest_dirty_sequence: Minga.Buffer.ChangeLog.sequence(), phase: phase(), synced_sequence: Minga.Buffer.ChangeLog.sequence() }
Functions
@spec accepts_version?(t(), pos_integer()) :: boolean()
Returns whether a version belongs to the current or most recently completed parse.
Marks an asynchronous snapshot request as in flight.
Returns whether a snapshot token belongs to the current request.
@spec begin_parse(t(), pos_integer(), Minga.Buffer.ChangeLog.sequence(), boolean()) :: t()
Marks a parser version and snapshot target as in flight.
@spec complete_parse(t(), pos_integer()) :: {:ok, t()} | :stale
Completes only the matching parser version.
@spec complete_unchanged(t(), Minga.Buffer.ChangeLog.sequence()) :: t()
Completes an unchanged snapshot without parser emission.
@spec mark_dirty(t(), Minga.Buffer.ChangeLog.sequence()) :: t()
Records the newest observed buffer change sequence.
@spec new(pos_integer(), Minga.Parser.BufferConfig.t(), reference()) :: t()
Creates a registration that requires an initial full parse.
Returns whether an idle registration has synchronization work.
Resets volatile parser state and requires a fresh full snapshot.
@spec snapshot_cursor(t()) :: :full | Minga.Buffer.ChangeLog.sequence()
Returns the cursor to request from the buffer.
@spec synchronized?(t(), Minga.Buffer.ChangeLog.sequence()) :: boolean()
Returns whether the parser is synchronized through the required buffer sequence.