Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stream Enhancements #441

Merged
merged 4 commits into from
Jul 7, 2024
Merged

Stream Enhancements #441

merged 4 commits into from
Jul 7, 2024

Conversation

subhashb
Copy link
Contributor

@subhashb subhashb commented Jul 4, 2024

Changes:

  • Unify metadata in Event and Command objects
  • Remove MessageMetadata class
  • Build Message metadata directly from the event/command object
  • Introduce kind, stream_name, and origin_stream_name to metadata
  • Initialize event store in init
  • Don't build stream names in different places. Use .meta_stream_name

Contains:
- Unify metadata in Event and Command objects
- Remove `MessageMetadata` class
- Build Message metadata directly from event/command object
- Introduce `kind`, `stream_name`, and `origin_stream_name` to metadata
- Initialize event store in `init`
- Don't build stream name in different places. Use `.meta_stream_name`
@subhashb subhashb self-assigned this Jul 4, 2024
Copy link

codecov bot commented Jul 4, 2024

Codecov Report

Attention: Patch coverage is 95.78947% with 8 lines in your changes missing coverage. Please review.

Project coverage is 88.79%. Comparing base (af95302) to head (f733575).
Report is 1 commits behind head on main.

Files Patch % Lines
src/protean/domain/__init__.py 90.90% 2 Missing and 2 partials ⚠️
src/protean/cli/__init__.py 33.33% 2 Missing ⚠️
src/protean/core/entity.py 92.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #441      +/-   ##
==========================================
+ Coverage   87.93%   88.79%   +0.85%     
==========================================
  Files          71       71              
  Lines        5986     5962      -24     
  Branches     1202     1186      -16     
==========================================
+ Hits         5264     5294      +30     
+ Misses        525      496      -29     
+ Partials      197      172      -25     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

subhashb added 3 commits July 5, 2024 10:20
Changes:
- Ensure stream names have aggregate id within them
- Use `stream_name` in Event/Command metadata as-is for persistence into event store
- Base handlers and handler retreival on stream name
- Ensure commands always belong to an aggregate cluster
- Remove `stream_name` option from events and and commands
  All elements in an aggregate cluster should use the aggregate's stream name
- Enhance `Domain.process` to enrich command before processing
Changes:
- Add `_event_position` temp variable in aggregates to track last event
  position in event store
- Track expected version per event with `_event_position`
- Fetch last event position on aggregate load and update `_event_position`
- Unify method to append event to event store in aggregates and event
  sourced aggregates
- Unify method to construct message from event for aggregates and
  event sourced aggregates
- Track database state within the memory provider instead of a global object
@subhashb subhashb merged commit ac9e8b2 into main Jul 7, 2024
6 checks passed
@subhashb subhashb deleted the stream-changes branch July 7, 2024 02:52
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.

1 participant