@eagleoutice/flowr - v2.17.4
    Preparing search index...

    Checks heap and elapsed-time pressure for named analysis features. See ReadOnlyFlowrAnalyzerGasContext.

    Implements

    Index
    name: "flowr-analyzer-gas-context" = 'flowr-analyzer-gas-context'
    • Restart the contingent, so what follows is measured from now. Supported API: call it between phases that should each get the full allowance (analyzer.context().gas.reset()).

      flowR calls it itself whenever a new analysis begins, so a caller only has to split its own phases. Operations in flight keep their contingent, as restarting a running traversal's clock would defeat the guard bounding it.

      Returns void

    • Runs fn against a contingent of its own: the configured bounds only, none of the overrides of the operation asking, and a fresh start time. Reports whether any gas check during fn came back above normal, so a result meant to be shared (see FlowrAnalyzerCache#derive) is only kept when it is complete. Use it for work that outlives the operation asking, and FlowrAnalyzerGasContext#withGas for the work of the asking operation itself, since this one ignores the overrides in effect (so it does not inherit a tight bound of the caller). degraded is also set if a check inside a nested scope reported more than normal.

      Type Parameters

      • T

      Parameters

      • fn: () => Promise<T>

      Returns Promise<{ degraded: boolean; value: T }>

      const { value, degraded } = await analyzer.context().gas.withFreshGas(async() => await analyzer.dataflow());
      const kept = degraded ? undefined : value; // a degraded value may be incomplete, so do not store it
    • Run fn against a fresh contingent bounded by overrides, ending when it settles if fn is async. Every check while fn runs sees it, however deep, which is how the bounds reach sites that only ever get a context handed to them.

      Being ambient, concurrent operations on one analyzer see whichever started last, so prefer scope wherever the context can be threaded through.

      Type Parameters

      • T

      Parameters

      Returns T