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

Executor API cleanup and simplification #61

Merged
merged 2 commits into from
May 14, 2024
Merged

Conversation

mzabaluev
Copy link
Collaborator

Make FinalityMode passed by value like a simple mode selector parameter should be.
Change signatures of methods that don't need to be async
or fallible.

mzabaluev added 2 commits May 14, 2024 12:55
Derive copy on the enum as well.
Change signatures of methods that don't need to be async
or fallible.
@mzabaluev mzabaluev requested a review from l-monninger May 14, 2024 10:29
@mzabaluev
Copy link
Collaborator Author

mzabaluev commented May 14, 2024

I have further YAGNI feeling about parts of the abstract API:

  • Do we really need the dynamic selection with FinalityMode? It's currently unimplemented except for the optimistic mode.
  • What do we need the *Executor traits for, as opposed to just providing inherent methods? Future mocking?

@l-monninger
Copy link
Collaborator

@mzabaluev FinalityMode is entirely unnecessary (it doesn't actually make sense w.r.t. to the intended design). I thought I had removed it already.

Executor traits are for organization and reuse in a would be SDK.

@mzabaluev
Copy link
Collaborator Author

Executor traits are for organization and reuse in a would be SDK.

In general, I would prefer not introducing traits until there are at least two implementations genuinely needing the abstraction. Especially those transformed by async_trait as they have a runtime cost.

@mzabaluev
Copy link
Collaborator Author

@mzabaluev FinalityMode is entirely unnecessary (it doesn't actually make sense w.r.t. to the intended design). I thought I had removed it already.

I can cut it out in this PR while we are at it, the only problem would be a merge conflict with #58.

@l-monninger
Copy link
Collaborator

In general, I would prefer not introducing traits until there are at least two implementations genuinely needing the abstraction. Especially those transformed by async_trait as they have a runtime cost.

I tend to do a fair bit of type-level programming first and like be able to refer to traits for quick understanding on the first pass. So, I'll need to work on that.

I'm trying to use async_trait only where there would be or I anticipate Box<dyn ...> usage. The async_trait vtables also increase binary size, no?

@mzabaluev
Copy link
Collaborator Author

The async_trait vtables also increase binary size, no?

They could, but it's not my first concern.

Copy link
Collaborator

@l-monninger l-monninger left a comment

Choose a reason for hiding this comment

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

RD

@l-monninger l-monninger merged commit d7db8b6 into main May 14, 2024
2 checks passed
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