Skip to content

Improve project structure #15

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

Merged
merged 10 commits into from
Mar 27, 2024
Merged

Improve project structure #15

merged 10 commits into from
Mar 27, 2024

Conversation

llucax
Copy link
Contributor

@llucax llucax commented Mar 26, 2024

  • Move Dispatcher to its own module
  • Expose all public symbols
  • Remove the _DispatchEventBase class
  • Move dispatch events to their own module
  • Fix Dispatcher example in docstring
  • Make Dispatcher return receiver fetchers
  • Rename DispatchActor to DispatchingActor
  • Use a timer for polling.
  • Improve Dispatcher examples
  • Rename updated_dispatches and ready_dispatches

llucax added 8 commits March 26, 2024 14:31
Signed-off-by: Leandro Lucarella <[email protected]>
We need to export also these symbols, as they are part of the
`Dispatcher` interface:

- DispatchEvent
- Created
- Updated
- Deleted

Signed-off-by: Leandro Lucarella <[email protected]>
The base class makes the documentation less clear and introduces a class
hierarchy that could be error prone given that sub-classes are intended
to be used in `match` statements.

Signed-off-by: Leandro Lucarella <[email protected]>
These events are used by both the actor module and the top-level module,
and we want to expose them publicly only in one place (the top-level
module), so we don't confuse the users about where they should import
symbols from.

Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
This makes it more clear that new receivers are created each time the
method is called.

Signed-off-by: Leandro Lucarella <[email protected]>
This is to follow the current actors naming convention.

Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
@llucax llucax requested a review from a team as a code owner March 26, 2024 18:59
@llucax llucax requested a review from ktickner March 26, 2024 18:59
@llucax llucax self-assigned this Mar 26, 2024
@github-actions github-actions bot added part:tests Affects the unit, integration and performance (benchmarks) tests part:actor Affects the dispatching actor labels Mar 26, 2024
@llucax llucax mentioned this pull request Mar 26, 2024
@llucax llucax added cmd:skip-release-notes It is not necessary to update release notes for this PR type:enhancement New feature or enhancement visitble to users type:tech-debt Improves the project without visible changes for users part:tests Affects the unit, integration and performance (benchmarks) tests part:actor Affects the dispatching actor and removed part:tests Affects the unit, integration and performance (benchmarks) tests part:actor Affects the dispatching actor labels Mar 26, 2024
@llucax llucax added this to the v0.1.0 milestone Mar 26, 2024
@llucax
Copy link
Contributor Author

llucax commented Mar 26, 2024

Up for discussion.

@llucax llucax requested a review from Marenz March 26, 2024 19:08
llucax added 2 commits March 26, 2024 16:20
We use `lifecycle_events` and `ready_to_execute` respectively to make
it more clear that the former provides events for any kind of dispatch
changes, including creates and deletes, and that the later provides
dispatches that are ready to be executed.

Signed-off-by: Leandro Lucarella <[email protected]>
Split the example in 2, one for events and one for ready to execute
processing, and add a match statement to make it more clear how it is
intended to be used.

Signed-off-by: Leandro Lucarella <[email protected]>
dispatch_arrived = dispatcher.updated_dispatches.new_receiver()
dispatch_ready = dispatcher.ready_dispatches.new_receiver()
events = dispatcher.lifecycle_events.new_receiver()
ready = dispatcher.ready_to_execute.new_receiver()
Copy link
Contributor

Choose a reason for hiding this comment

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

I was not happy with the names, I like these more :)


events_receiver = dispatcher.lifecycle_events.new_receiver()

async for event in events_receiver:
Copy link
Contributor

Choose a reason for hiding this comment

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

This makes me think we should also expose the client as dispatcher.client so the user can react to the events in a meaningful way when they want to update or create a new event as a response

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't get this. Why do you need the client?

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, anyone who wants to update, delete or create a request needs the client to do so, the high-level API
doesn't offer those things (and I don't see how it could do that better than the client)

@Marenz
Copy link
Contributor

Marenz commented Mar 27, 2024

Great stuff

@Marenz Marenz added this pull request to the merge queue Mar 27, 2024
Merged via the queue into frequenz-floss:v0.x.x with commit e0cccf2 Mar 27, 2024
@llucax llucax deleted the structure branch March 27, 2024 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd:skip-release-notes It is not necessary to update release notes for this PR part:actor Affects the dispatching actor part:tests Affects the unit, integration and performance (benchmarks) tests type:enhancement New feature or enhancement visitble to users type:tech-debt Improves the project without visible changes for users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants