Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@bolshakov
Copy link
Owner

@bolshakov bolshakov commented Dec 16, 2025

Continues storage abstraction separation by extracting state management from DataStore into dedicated per-circuit storage instances.

Previously, we introduced the Domain::Storage::State interface. This PR implements the actual storage classes following the same pattern as recovery locks.

Before: DataStore handled state for ALL circuits:

data_store.set_state(config, state)
snapshot = data_store.get_state_snapshot(config)
first_to_transition = data_store.transition_to_color(config, Color::RED)

After: each circuit has its own state storage instance:

state_store = Memory::State.new(clock:, cool_off_time:)  # Per circuit
state_store.set_state(state)  # No config needed - knows its circuit
snapshot = state_store.state_snapshot
first_to_transition = state_store.transition_to_color(Color::RED)

Also introduces Domain::Clock interface with Infrastructure::SystemClock implementation, making time dependencies explicit and testable.

The Redis implementation is composed with FailSafe::State decorator for automatic memory failover, wired in LightBuilder.

@bolshakov bolshakov changed the title Feature/state store Move State to Dedicated Storage Classes Dec 16, 2025
@bolshakov bolshakov marked this pull request as ready for review December 16, 2025 21:23
@bolshakov bolshakov requested a review from Lokideos December 16, 2025 21:24
@bolshakov bolshakov force-pushed the feature/state-store branch 4 times, most recently from 1dd25e7 to 0903507 Compare December 20, 2025 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.