public sealed class WorkerHostWhat a worker process does: answer import requests until the pipe closes.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The whole worker is this loop and one executor. It holds no cache, writes no sidecars and knows nothing about build plans — all of that stays in the coordinator, so there is one copy of it and a worker cannot disagree with the process that started it.
⚠ It does read one thing the coordinator owns: Library/GuidIndex. An importer may resolve an AssetId to a path, and until this the worker supplied no IAssetSources at all — so ImportContext.CanResolve was false out of process and every resolve missed, which quietly made any asset kind that needs one in-process-only (#1150). It is a read of what the coordinator has already written, and Sources and the constructor between them say why that is current rather than stale.
Its built-ins come from BuiltInImporters, not from an argument. A worker with a different importer set produces different artefacts for the same file, and the disagreement surfaces as a cache that never hits — or as a build whose output depends on how many cores the machine has.
⚠ Its contributed importers do come from an argument, and that is doc 36 § Part 6's one correctness gap closed. BuiltInImporters.Create() folds in ImporterContributions.Default, which in a process that has loaded no plugin is empty — so an asset only a plugin could import used to be imported by the editor and refused by the pool. The coordinator names the plugin assemblies it loaded and the worker loads the same files; see PluginImporters.
Fields and properties (1)
public static int DefaultWorkerCountHow many workers to run when nobody said.
Methods (5)
public WorkerHost(string projectRoot, IReadOnlyList<string>? pluginAssemblies = null)Serves imports out of a project directory.
public WorkerHost(IImportExecutor executor)Serves imports through a given executor, which is what a test hands it.
public Task ServeAsync(Stream stream, CancellationToken cancellationToken = default(CancellationToken))Answers requests until the other end goes away.
public Task<ImportResponseMessage> RunAsync(ImportRequestMessage request, CancellationToken cancellationToken = default(CancellationToken))Runs one request.
public static bool TryParse(IReadOnlyList<string> arguments, out string pipe, out string root, out IReadOnlyList<string> plugins)Parses the arguments a worker is started with.
Used by (2)
- CompilerPoolVixen.AssetCompiler
- WorkerResolveTestsVixen.AssetCompiler.Tests