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

Add badger implementations of repos #22

Merged
merged 6 commits into from
Nov 30, 2023
Merged

Add badger implementations of repos #22

merged 6 commits into from
Nov 30, 2023

Conversation

altafan
Copy link
Collaborator

@altafan altafan commented Nov 29, 2023

This adds a badger implementation of the repositories useful for testing purposes but also as an initial persistency layer.

This also adds some changes to the domain layer, required after writing their consumers:

  • Removed PaymentsClaimed event for sake of simplicity since it wasn't used by the app layer
  • Added a dedicated method to add receivers to a payment + validation checks
  • Added a dedicated method to get the hash of a vtxo key

This adds logic to the application layer meant to keep the projection store up-to-date with the event store: whenever an event is persisted, the aggregate (round/vtxo) resulting from replaying all events is saved to the proper projection store.

Please @louisinger review.

handler func(round *domain.Round)
}

func NewRoundEventRepository(config ...interface{}) (dbtypes.EventStore, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

any reason to do not type config ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

because different impls can require different config params.
This way, every impl makes sure that the passed args are exactly those required, instead of having a predefined config that includes all params for the different impls.

@altafan altafan merged commit be1f465 into master Nov 30, 2023
1 check passed
@altafan altafan deleted the repos branch December 4, 2023 16:01
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