babylon.engine.community_state_store

Community state store protocol and default implementation (Feature 033).

Decouples bifurcation analysis from CommunitySystem internals via a read-only protocol. The default in-memory implementation wraps the existing mutable dict maintained by CommunitySystem.

See also

babylon.engine.systems.community: CommunitySystem that owns state. specs/033-bifurcation-topology/research.md: R1 architecture decision.

Classes

CommunityStateStore(*args, **kwargs)

Read interface for community consciousness data.

InMemoryCommunityStateStore(states)

Default store wrapping the existing in-memory community_states dict.

class babylon.engine.community_state_store.CommunityStateStore(*args, **kwargs)[source]

Bases: Protocol

Read interface for community consciousness data.

Default implementation wraps the existing in-memory dict. Future PostgreSQL adapter implements the same protocol.

get_all()[source]

Return current community states snapshot.

Return type:

dict[CommunityType, CommunityState]

__init__(*args, **kwargs)
class babylon.engine.community_state_store.InMemoryCommunityStateStore(states)[source]

Bases: object

Default store wrapping the existing in-memory community_states dict.

Parameters:

states (dict[CommunityType, CommunityState]) – Reference to the mutable community_states dict maintained by CommunitySystem. Not copied — reads reflect live mutations.

__init__(states)[source]
Parameters:

states (dict[CommunityType, CommunityState])

Return type:

None

get_all()[source]

Return current community states snapshot.

Return type:

dict[CommunityType, CommunityState]