MingaEditor.State.FileTree.Watchers (Minga v0.1.0)

Copy Markdown View Source

File-tree-owned watcher intent and cleanup lineage.

Candidates are retained until the latest exact synchronization succeeds. Failed, canceled, and stale work can therefore be recovered by the next exact request without relying on an effect queue's bounded history.

Summary

Functions

Records cleanup of all known roots with no replacement target.

Correlates the latest admitted watcher request with its exact target.

Finishes a failed or canceled exact request without dropping cleanup lineage.

Records a desired tree while retaining every known cleanup root.

Consumes only the current watcher retry timer.

Terminalizes retry correlation while preserving the failed attempt count.

Correlates one bounded retry while retaining the current watcher intent.

Collapses ownership only after the latest exact request succeeds.

Types

request()

@type request() :: %{token: reference(), target: String.t() | nil}

t()

@type t() :: %MingaEditor.State.FileTree.Watchers{
  candidates: MapSet.t(String.t()),
  expanded_dirs: MapSet.t(String.t()),
  generation: non_neg_integer(),
  request: request() | nil,
  retry_attempt: non_neg_integer(),
  retry_token: reference() | nil,
  target: String.t() | nil
}

Functions

cleanup(watchers, roots)

@spec cleanup(t(), [String.t()]) :: t()

Records cleanup of all known roots with no replacement target.

request_admitted(watchers, token)

@spec request_admitted(t(), reference()) :: t()

Correlates the latest admitted watcher request with its exact target.

request_finished(watchers, token)

@spec request_finished(t(), reference()) :: {:current | :stale, t()}

Finishes a failed or canceled exact request without dropping cleanup lineage.

retarget(watchers, roots, tree)

@spec retarget(t(), [String.t()], Minga.Project.FileTree.t()) :: t()

Records a desired tree while retaining every known cleanup root.

retry_elapsed(watchers, token)

@spec retry_elapsed(t(), reference()) :: {:current | :stale, t()}

Consumes only the current watcher retry timer.

retry_exhausted(watchers)

@spec retry_exhausted(t()) :: t()

Terminalizes retry correlation while preserving the failed attempt count.

retry_scheduled(watchers, token)

@spec retry_scheduled(t(), reference()) :: {pos_integer(), t()}

Correlates one bounded retry while retaining the current watcher intent.

synchronized(watchers, token, target)

@spec synchronized(t(), reference(), String.t() | nil) :: {:current | :stale, t()}

Collapses ownership only after the latest exact request succeeds.