Module: Shifty::PolicyDeclarable
Overview
Shared by Worker and Gang: declares a pipeline-level policy default on every node reachable upstream through the supply chain. A worker's own policy declaration (its contract) always wins over the pipeline default.
Instance Method Summary collapse
-
#freeze! ⇒ Object
Locks the assembled topology: "the pipeline you composed is the pipeline that runs" becomes a guarantee.
- #with_policy(policy_name) ⇒ Object
Instance Method Details
#freeze! ⇒ Object
Locks the assembled topology: "the pipeline you composed is the pipeline that runs" becomes a guarantee. Rewiring (supply=, Gang append/roster mutation) raises FrozenError afterward. Worker closure/context state stays mutable — only the topology freezes.
Call this on the pipeline's TAIL: like with_policy, it walks the supply chain upstream, so freezing a mid-chain node leaves everything downstream of it mutable. And use this, not the bare Object#freeze — freeze! first materializes each node's lazy task and Fiber; a bare freeze skips that and the first shift would raise FrozenError from deep inside the worker.
23 24 25 26 |
# File 'lib/shifty/policy.rb', line 23 def freeze! each_upstream_node { |node| node.freeze_topology_node! } self end |