Skip to content
ConsoleMonster
Class

ShapeBudget

ConsoleMonster.Values

Namespace
ConsoleMonster.Values
Assembly
ConsoleMonster
Modifiers
sealed

The time and node allowance of one shaping pass. Getters that reach a remote system (directory entries, COM objects, lazy collections) can take seconds each; once the allowance is spent the remaining values are not read and show as "…" instead of stalling the output.

Inheritance

  • object
  • ShapeBudget

Usage

Explore 7 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 1

Accepted by parameters 6

Constructors

public ShapeBudget(TimeSpan time, int maxNodes) #

Creates a budget.

Parameters

time System.TimeSpan required
How long the pass may take.
maxNodes int required
How many values it may read.

Methods

public static ShapeBudget For(ShapeOptions? options) #

A budget from options.

Parameters

options ConsoleMonster.Values.ShapeOptions? required
The options, or null for the defaults.

Returns

ShapeBudget The budget.
public object? Guard(object source, Func<object?> read) #

Runs one read for a source (a column, a field), timing it. Reads slower than 200 ms count as stalls; once the stalls add up to the time allowance, only sources that have already read quickly are still read (the others give BudgetExceeded), so a large but healthy table is never cut short and remote getters cannot hold it up.

Parameters

source object required
What is read (a column or field identity).
read System.Func<object?> required
The read.

Returns

object? The value, or BudgetExceeded.Instance.
public bool TryTake() #

Counts one read; returns false (and remembers it) when the allowance is spent.

Returns

bool True when the value may be read.

Properties

public int MaxNodes { get; } #

The most values the pass may read.

public bool Exhausted { get; } #

Whether the allowance is spent (time or nodes).

public bool WasExceeded { get; private set; } #

Whether the pass stopped reading at some point.