---
library: "bootstrap"
slug: "CausalBarrier"
name: "CausalBarrier"
ref: "CausalBarrier#cf54"
hash: "sema:CausalBarrier#mh:SHA-256:cf54b35c9236d8fd2db3ca4f35ab5bdaac79c17052d9095aaa5fa6f143507809"
type: "Time"
layer: "Physics"
version: "0.11.0"
root: "a6a3d1ff0f982ee30430c5b42f3784c8ec901fd68482cfc1bc30899c1e5e48c5"
license: null
url: "https://semahash.org/vocabularies/bootstrap/patterns/CausalBarrier"
---

# CausalBarrier

Enforcing strict event ordering

Physics · Time

## Mechanism

A middleware layer that buffers incoming messages and releases them to the agent ONLY when all their causal dependencies are met. Guarantees the agent never sees an 'impossible' state. It maintains a [StateLock](https://semahash.org/vocabularies/bootstrap/patterns/StateLock.md) on the event processing queue, releasing it only when all causal predecessors have been observed.

## Invariants

- Causal Ordering: Event E cannot be processed until all Dependencies(E) are processed
- Events before barrier cannot affect events after.
- No Impossible States: [Agent](https://semahash.org/vocabularies/bootstrap/patterns/Agent.md) state never violates causal consistency

## Parameters

- on_undeliverable: type=Enum, range={block, drop, escalate}, description=What happens to a buffered message whose dependencies never arrive. The barrier never releases it out of order — that would breach causal ordering — so the choice is how long to hold it and what to do instead.
- party_count: type=Integer, range=[2, 100], description=Participants tracked
- timeout: type=Duration, range=[1s, 1h], description=How long a message waits before on_undeliverable applies

## Failure modes

- Buffer overflow if dependencies never arrive.

## Where this came from

—

## Builds on

- [StateLock](https://semahash.org/vocabularies/bootstrap/patterns/StateLock.md) (references)
- [Agent](https://semahash.org/vocabularies/bootstrap/patterns/Agent.md) (references)

## Used by

- [TimeWarpLog](https://semahash.org/vocabularies/bootstrap/patterns/TimeWarpLog.md) (references)

## Identity

- Library: bootstrap 0.11.0 (root a6a3d1ff0f98)
- Ref: CausalBarrier#cf54
- Hash: sema:CausalBarrier#mh:SHA-256:cf54b35c9236d8fd2db3ca4f35ab5bdaac79c17052d9095aaa5fa6f143507809

## Links

- Page: https://semahash.org/vocabularies/bootstrap/patterns/CausalBarrier
- JSON: https://semahash.org/vocabularies/bootstrap/patterns/CausalBarrier.json
- Library: https://semahash.org/vocabularies/bootstrap
- Library index: https://semahash.org/vocabularies/bootstrap/index.json
