Interface IMutation<TArgs, TData, TProgress>
- Namespace
- Fetchling.Core
- Assembly
- Fetchling.Core.dll
A mutation whose mutator reports progress while it runs — an upload, export, import or other long-running job. Behaves exactly like IMutation<TArgs, TData>; the only addition is that every state carries the latest reported Progress.
public interface IMutation<TArgs, TData, TProgress> : IDisposable
Type Parameters
TArgsThe type of the arguments passed to the mutation.
TDataThe type of the data returned on success.
TProgressThe type of the progress values the mutator reports.
- Inherited Members
- Extension Methods
Properties
CurrentState
The current state snapshot. Can be read synchronously without subscribing — in particular, this is updated to Running before Execute(TArgs) returns, so callers can check it to avoid double-submitting while a dispatched UI update is in flight.
MutationState<TData, TProgress> CurrentState { get; }
Property Value
- MutationState<TData, TProgress>
Failure
Emits the Exception on each failed execution. Derived from State, so if the current state is already a failure, a new subscriber receives that exception immediately rather than waiting for the next execution.
IObservable<Exception> Failure { get; }
Property Value
Settled
Emits the final MutationState<TData, TProgress> after each execution completes, regardless of whether it succeeded or failed.
IObservable<MutationState<TData, TProgress>> Settled { get; }
Property Value
- IObservable<MutationState<TData, TProgress>>
State
Emits on every state transition (e.g. Idle → Running → Success/Failed) and on every progress report, as a Running state carrying the new Progress. Progress travels on this stream rather than a separate one so status and progress are always consistent with each other, and a subscriber joining mid-run renders the current progress straight away. Replays the latest state to new subscribers.
IObservable<MutationState<TData, TProgress>> State { get; }
Property Value
- IObservable<MutationState<TData, TProgress>>
Success
Emits the unwrapped TData on each successful execution.
Derived from State, so if the current state is already a success, a new
subscriber receives that value immediately rather than waiting for the next execution.
IObservable<TData> Success { get; }
Property Value
- IObservable<TData>
Methods
Cancel()
Cancels the currently running execution, if any. The mutation returns to Idle and its progress is cleared.
void Cancel()
Execute(TArgs)
Triggers the mutation with the given args.
If the mutation is disabled, the call is silently ignored.
void Execute(TArgs args)
Parameters
argsTArgsThe arguments to pass to the mutation handler.
SetEnabled(bool)
Enables or disables the mutation. When false, calls to Execute(TArgs) are silently
ignored. Pass true to allow subsequent executions.
void SetEnabled(bool enabled)
Parameters
enabledbool