Class: Ibex::Runtime::ResourceLimits
- Inherits:
-
Object
- Object
- Ibex::Runtime::ResourceLimits
- Defined in:
- lib/ibex/runtime/resource_limits.rb
Overview
Immutable per-parser-session resource budgets.
Constant Summary collapse
- DEFAULT_MAX_STACK_DEPTH =
: Integer
10_000- DEFAULT_MAX_RECOVERY_ATTEMPTS =
: Integer
100- DEFAULT_MAX_INCREMENTAL_DECOMPOSED_NODES =
: Integer
100_000- DEFAULT_MAX_SESSION_MEMO_BYTES =
: Integer
64 * 1024 * 1024
Instance Attribute Summary collapse
-
#max_incremental_decomposed_nodes ⇒ Object
readonly
: Integer.
-
#max_recovery_attempts ⇒ Object
readonly
: Integer.
-
#max_session_memo_bytes ⇒ Object
readonly
: Integer.
-
#max_stack_depth ⇒ Object
readonly
: Integer.
Instance Method Summary collapse
-
#initialize(max_stack_depth: DEFAULT_MAX_STACK_DEPTH, max_recovery_attempts: DEFAULT_MAX_RECOVERY_ATTEMPTS, max_incremental_decomposed_nodes: DEFAULT_MAX_INCREMENTAL_DECOMPOSED_NODES, max_session_memo_bytes: DEFAULT_MAX_SESSION_MEMO_BYTES) ⇒ ResourceLimits
constructor
A new instance of ResourceLimits.
- #to_h ⇒ Object
Constructor Details
#initialize(max_stack_depth: DEFAULT_MAX_STACK_DEPTH, max_recovery_attempts: DEFAULT_MAX_RECOVERY_ATTEMPTS, max_incremental_decomposed_nodes: DEFAULT_MAX_INCREMENTAL_DECOMPOSED_NODES, max_session_memo_bytes: DEFAULT_MAX_SESSION_MEMO_BYTES) ⇒ ResourceLimits
Returns a new instance of ResourceLimits.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ibex/runtime/resource_limits.rb', line 20 def initialize( max_stack_depth: DEFAULT_MAX_STACK_DEPTH, max_recovery_attempts: DEFAULT_MAX_RECOVERY_ATTEMPTS, max_incremental_decomposed_nodes: DEFAULT_MAX_INCREMENTAL_DECOMPOSED_NODES, max_session_memo_bytes: DEFAULT_MAX_SESSION_MEMO_BYTES ) validate_positive_integer(max_stack_depth, :max_stack_depth) validate_nonnegative_integer(max_recovery_attempts, :max_recovery_attempts) validate_nonnegative_integer(max_incremental_decomposed_nodes, :max_incremental_decomposed_nodes) validate_positive_integer(max_session_memo_bytes, :max_session_memo_bytes) @max_stack_depth = max_stack_depth @max_recovery_attempts = max_recovery_attempts @max_incremental_decomposed_nodes = max_incremental_decomposed_nodes @max_session_memo_bytes = max_session_memo_bytes freeze end |
Instance Attribute Details
#max_incremental_decomposed_nodes ⇒ Object (readonly)
: Integer
15 16 17 |
# File 'lib/ibex/runtime/resource_limits.rb', line 15 def max_incremental_decomposed_nodes @max_incremental_decomposed_nodes end |
#max_recovery_attempts ⇒ Object (readonly)
: Integer
14 15 16 |
# File 'lib/ibex/runtime/resource_limits.rb', line 14 def max_recovery_attempts @max_recovery_attempts end |
#max_session_memo_bytes ⇒ Object (readonly)
: Integer
16 17 18 |
# File 'lib/ibex/runtime/resource_limits.rb', line 16 def max_session_memo_bytes @max_session_memo_bytes end |
#max_stack_depth ⇒ Object (readonly)
: Integer
13 14 15 |
# File 'lib/ibex/runtime/resource_limits.rb', line 13 def max_stack_depth @max_stack_depth end |
Instance Method Details
#to_h ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/ibex/runtime/resource_limits.rb', line 38 def to_h { max_stack_depth: @max_stack_depth, max_recovery_attempts: @max_recovery_attempts, max_incremental_decomposed_nodes: @max_incremental_decomposed_nodes, max_session_memo_bytes: @max_session_memo_bytes }.freeze end |