FindMyFiles
FindMyFiles.Engine
IEngineClient Interface
The single boundary the app uses to talk to the engine (docs/ARCHITECTURE.md). Implementations: PipeEngineClient (named pipe to fmf-service), FfiEngineClient (in-proc DLL, --engine=inproc) and FakeEngineClient (deterministic data for UI tests via --fake-engine). The shared observable behavior is executable: Tests/Contract/EngineClientContractTests runs the same suite against all implementations.
Cancellation is cooperative and fully plumbed (ADR-0018): a cancelled
ct surfaces as System.OperationCanceledException (or a
subclass) from every async member. Data shapes live in EngineTypes.cs.
public interface IEngineClient : System.IDisposable
Derived
↳ FakeEngineClient
↳ FfiEngineClient
↳ PipeEngineClient
Implements System.IDisposable
Properties
IEngineClient.Connection Property
InProc for Ffi/Fake (fixed, never raises ConnectionChanged); the pipe client moves through Connecting/Connected/Reconnecting.
FindMyFiles.Engine.EngineConnectionState Connection { get; }
Property Value
Methods
IEngineClient.GetStatsAsync(CancellationToken) Method
Observability snapshot for the performance panel.
System.Threading.Tasks.Task<FindMyFiles.Engine.EngineStatsData?> GetStatsAsync(System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));
Parameters
ct System.Threading.CancellationToken
Cooperative cancellation token.
Returns
System.Threading.Tasks.Task<EngineStatsData>
The current engine stats, or null if unavailable.
IEngineClient.GetStatusAsync(CancellationToken) Method
Returns a snapshot of the current state (VolumeStatus) of every volume. Used for the initial display at startup and for the setup screen's decisions.
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<FindMyFiles.Engine.VolumeStatus>> GetStatusAsync(System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));
Parameters
ct System.Threading.CancellationToken
Cooperative cancellation token.
Returns
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<VolumeStatus>>
A snapshot of the current status of every known volume.
Exceptions
EngineUnavailableException
service unreachable
IEngineClient.ListVolumesAsync(CancellationToken) Method
Returns the labels of the indexed volumes (those the engine currently recognizes).
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<string>> ListVolumesAsync(System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));
Parameters
ct System.Threading.CancellationToken
Cooperative cancellation token.
Returns
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<System.String>>
The labels of the volumes the engine currently knows about.
Exceptions
EngineUnavailableException
service unreachable
IEngineClient.SearchAsync(string, SearchOptions, CancellationToken) Method
Executes the query and returns a sort-settled result handle (Result) plus an optional timing trace. Pages are read lazily through the returned ISearchResult.
System.Threading.Tasks.Task<FindMyFiles.Engine.SearchOutcome> SearchAsync(string query, FindMyFiles.Engine.SearchOptions options, System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));
Parameters
query System.String
The query text to execute.
options SearchOptions
Search options (sort order, flags).
ct System.Threading.CancellationToken
Cooperative cancellation token.
Returns
System.Threading.Tasks.Task<SearchOutcome>
The sort-ordered result handle plus an optional timing trace.
Exceptions
QuerySyntaxException
malformed query text
EngineUnavailableException
service unreachable
IEngineClient.StartIndexingAsync(IReadOnlyList<string>, CancellationToken) Method
Requests that indexing/re-indexing start for the given volumes (fire-and-trigger: progress arrives via VolumeUpdated / IndexChanged). MFT reads require elevation, so the work runs on the service side.
System.Threading.Tasks.Task StartIndexingAsync(System.Collections.Generic.IReadOnlyList<string> volumes, System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));
Parameters
volumes System.Collections.Generic.IReadOnlyList<System.String>
Labels of the volumes to (re)index.
ct System.Threading.CancellationToken
Cooperative cancellation token.
Returns
System.Threading.Tasks.Task
A task that completes once the indexing request is accepted.
Exceptions
EngineUnavailableException
service unreachable
Events
IEngineClient.ConnectionChanged Event
Fires when the current Connection transitions. In-proc implementations never fire (always InProc). Fires from the pipe client's supervisor thread → marshal.
event Action<EngineConnectionState>? ConnectionChanged;
Event Type
System.Action<EngineConnectionState>
IEngineClient.EngineErrorOccurred Event
The engine recorded a diagnostic (1=warn 2=error 3=panic). Details live in RecentErrors — pull on demand.
event Action<int>? EngineErrorOccurred;
Event Type
IEngineClient.IndexChanged Event
New index content was published (USN apply or scan progress). The payload is the triggering volume label. The signal to re-evaluate the displayed query. Fires from an engine thread, so marshal to the UI thread (EngineEventMarshaler is the only crossing point).
event Action<string>? IndexChanged;
Event Type
IEngineClient.VolumeUpdated Event
One volume's state transitioned (`Scanning`→`Ready` etc.). Emits the latest VolumeStatus. Fires from an engine thread → marshal.
event Action<VolumeStatus>? VolumeUpdated;