Class EnvironmentChangeContext
- Namespace
- IntentSharp.ChangeDetection
- Assembly
- IntentSharp.dll
What an IEnvironmentChangeHandler receives with a change: the client, the current description of a changed target, the recompile cap, and the ways to report the model calls it made and the work it could not finish. The client creates one per change; a handler uses it only while it handles that change.
public sealed class EnvironmentChangeContext
- Inheritance
-
objectEnvironmentChangeContext
- Inherited Members
-
object.Equals(object)object.Equals(object, object)object.GetHashCode()object.GetType()object.ReferenceEquals(object, object)object.ToString()
- Extension Methods
Properties
- Client
The client that found the change; a handler makes its model calls through it.
- Description
The target's description as the client just received it, with its Fingerprint, for a TargetSchema change; null for any other change.
- Logger
The logger for the handler's own messages; never null.
Methods
- DescribeAsync(string, CancellationToken)
The current description of the target named
target: the one a TargetRuntime of this client received last in this process, or null when no runtime of this client has described that target yet. After a null, the client raises that target's TargetSchema change when a runtime first describes it in this process, even when its fingerprint is the one recorded (then PreviousFingerprint equals CurrentFingerprint), so the work that needed the description can be done then.
- ReportMaintenance(AIResultBase)
Reports a model call the handler made, so the operation that found the change reports it in Maintenance, apart from its own planning call. A result that failed is also a problem there.
- ReportPending(string, string?)
Reports a rule set the handler could not bring up to date: its recompile failed, was capped, or was held by an edit writer, so the version that ran before keeps running. Each set counts once towards
environment.pendingRecompile, which a rule file can use to refuse operations until the rules catch up: the set stays pending, and every operation of a TargetRuntime that names it is checked at the Environment checkpoint with it counted (only the operation that found the change when the settingenvironment.pendingHoldischangedOperation), until a recompile of it is taken (TryTakeRecompileAsync(string, string, CancellationToken)) and not reported pending, or a later change of its target is handled without it being reported. It is pending for the target its recompile was asked for, else the changed target, else the target its rule file names, else every target. While it is pending, a later operation over that target raises the target's description again by default, so the handlers can try once more withinenvironment.maxRecompilesPerHour; the settingenvironment.recompileRetrychanges when it is tried.
- TryTakeRecompileAsync(string, string, CancellationToken)
Takes one automatic recompile of the rule set
setfor the targettargetunderenvironment.maxRecompilesPerHour(three by default;0never recompiles automatically,unlimitedalways does). Returns false when the set has used them all in the past hour; then leave the set as it is and report it with ReportPending(string, string?). The count is kept in the document store's state, so every process that shares the store shares it. A recompile taken here and not reported pending by the time the handlers finished counts as done: the set is no longer pending for that target.