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

AggregateManager::handle command is generic in Error #185

Merged
merged 12 commits into from
Jan 9, 2024

Conversation

cottinisimone
Copy link
Contributor

@cottinisimone cottinisimone commented Dec 12, 2023

  • I changed some stuff in order to let this work in lira. There's only few small changes. I wasn't able to find a way to let this work with async_graphql using the store as Box<dyn EventStore<Aggregate = TheAggregate, Error = PgStoreError> + Send + Sync> since it ended up with this error:
error: higher-ranked lifetime error
  --> src/web/graphql/internal/mutation.rs:23:1
   |
23 | #[Object]
   | ^^^^^^^^^
   |
   = note: could not prove `Pin<Box<[async block@src/web/graphql/internal/mutation.rs:23:1: 23:10]>>: CoerceUnsized<Pin<Box<(dyn futures::Future<Output = std::result::Result<std::option::Option<async_graphql::Value>, ServerError>> + std::marker::Send + 'i)>>>`
   = note: this error originates in the attribute macro `Object` (in Nightly builds, run with -Z macro-backtrace for more info)

error: higher-ranked lifetime error
  --> src/web/graphql/public/mutation.rs:17:1
   |
17 | #[Object]
   | ^^^^^^^^^
   |
   = note: could not prove `Pin<Box<[async block@src/web/graphql/public/mutation.rs:17:1: 17:10]>>: CoerceUnsized<Pin<Box<(dyn futures::Future<Output = std::result::Result<std::option::Option<async_graphql::Value>, ServerError>> + std::marker::Send + 'i)>>>`
   = note: this error originates in the attribute macro `Object` (in Nightly builds, run with -Z macro-backtrace for more info)

It seems to be related in some way to how async_trait handles lifetimes. It will follow further investigations since the possibility to use a generic EventStore seems to me to be important

@cottinisimone cottinisimone requested a review from a team as a code owner December 12, 2023 09:28
cpiemontese
cpiemontese previously approved these changes Dec 12, 2023
@cottinisimone cottinisimone force-pushed the expose-internal-event-store branch from f01947e to f999696 Compare December 12, 2023 09:37
cpiemontese
cpiemontese previously approved these changes Dec 12, 2023
cpiemontese
cpiemontese previously approved these changes Dec 18, 2023
Copy link
Contributor

@angelo-rendina-prima angelo-rendina-prima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe I understand your issue was that async_graphql is complaining about Box<dyn Error>, but that same type is still around so I am not sure how this change solves your problem :(

@cottinisimone cottinisimone changed the title Expose internal event store in AggregateManager AggregateManager::handle command is generic in Error Jan 9, 2024
@cottinisimone cottinisimone merged commit b79b681 into master Jan 9, 2024
@cottinisimone cottinisimone deleted the expose-internal-event-store branch January 9, 2024 11:15
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.

None yet

3 participants