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

Copy Markdown View Source

Pure semantic ownership for file-tree refresh intent.

The effect scheduler owns worker lifecycle, queueing, cancellation, and terminal delivery. This value owns only the current debounce token and the newest request whose result may still update the file tree.

Summary

Types

Semantic correlation for the newest admitted refresh request.

A token carried by one debounce timer message.

A scheduler request token correlated with the root it scanned.

t()

Functions

Consumes only the currently correlated debounce timer message.

Invalidates every timer and result correlation when the tree lifecycle changes.

Correlates the newest admitted scheduler request with its scanned root.

Records one debounce intent, leaving an existing timer authoritative and invalidating older result authority.

Classifies and consumes a terminal result for the semantic current request.

Re-arms one correlated debounce after scheduler admission pressure.

Types

current_request()

@type current_request() :: %{token: request_token(), root: String.t()}

Semantic correlation for the newest admitted refresh request.

debounce_token()

@type debounce_token() :: reference()

A token carried by one debounce timer message.

request_token()

@type request_token() :: reference()

A scheduler request token correlated with the root it scanned.

t()

@type t() :: %MingaEditor.State.FileTree.Refresh{
  current: current_request() | nil,
  debounce: debounce_token() | nil,
  retry_attempt: non_neg_integer()
}

Functions

debounce_elapsed(refresh, token)

@spec debounce_elapsed(t(), debounce_token()) :: {:current | :stale, t()}

Consumes only the currently correlated debounce timer message.

invalidate(refresh)

@spec invalidate(t()) :: t()

Invalidates every timer and result correlation when the tree lifecycle changes.

request_admitted(refresh, root, token)

@spec request_admitted(t(), String.t(), request_token()) :: t()

Correlates the newest admitted scheduler request with its scanned root.

request_debounce(refresh, token)

@spec request_debounce(t(), debounce_token()) ::
  {:scheduled | :already_scheduled, t()}

Records one debounce intent, leaving an existing timer authoritative and invalidating older result authority.

request_finished(refresh, root, token)

@spec request_finished(t(), String.t(), request_token()) :: {:current | :stale, t()}

Classifies and consumes a terminal result for the semantic current request.

retry_debounce(refresh, token)

@spec retry_debounce(t(), debounce_token()) :: {pos_integer(), t()}

Re-arms one correlated debounce after scheduler admission pressure.