InitState produces a CostTracker and bundles it into an Activation in a way which is not visible to expression evaluation.
(frame *ExecutionFrame)
| 70 | // InitState produces a CostTracker and bundles it into an Activation in a way which is not visible |
| 71 | // to expression evaluation. |
| 72 | func (ct *costTrackerFactory) InitState(frame *ExecutionFrame) (any, error) { |
| 73 | tracker, err := ct.factory() |
| 74 | if err != nil { |
| 75 | return nil, err |
| 76 | } |
| 77 | if frame.ctx == nil { |
| 78 | frame.ctx = evalContextPool.Get().(*evalContext) |
| 79 | } |
| 80 | frame.ctx.costs = tracker |
| 81 | return tracker, nil |
| 82 | } |
| 83 | |
| 84 | // GetState extracts the CostTracker from the Activation. |
| 85 | func (ct *costTrackerFactory) GetState(frame *ExecutionFrame) any { |