Class BowirePluginSettingsScope

Namespace
Kuestenlogik.Bowire.Plugins
Assembly
Kuestenlogik.Bowire.dll

Which workspace the current call is being served for (#640).

public static class BowirePluginSettingsScope
Inheritance
BowirePluginSettingsScope
Inherited Members

Remarks

Ambient state, which is normally worth avoiding — and is the same trade BowireTenancy makes, for the same reason. The workspace arrives as a query parameter on an HTTP request, and the code that needs it is DiscoverAsync on a plugin, which is handed a URL and a cancellation token and nothing else. Threading a workspace through every protocol contract in every plugin repository, to deliver something almost no call site uses, is a worse trade than one AsyncLocal read by one service.

Unset means "no workspace named", which is the ordinary case: the CLI, a test, an embedded host that never adopted workspaces. Settings then fall back to their declared defaults rather than erroring — a plugin should work when nobody has configured it.

Properties

Current

The workspace being served, or null.

public static (string WorkspaceId, string? StorageRoot)? Current { get; }

Property Value

(string WorkspaceId, string StorageRoot)?

Methods

Enter(string?, string?)

Serve the rest of this call for workspaceId. Dispose restores whatever was in scope before.

public static IDisposable Enter(string? workspaceId, string? storageRoot = null)

Parameters

workspaceId string

The workspace. Null or blank clears the scope rather than naming an empty one, so a request without a workspace looks the same as a CLI invocation.

storageRoot string

A git-backed workspace's checkout, when the operator pointed one there.

Returns

IDisposable