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 LazyWorkerInterface #3038

Merged
merged 1 commit into from
Nov 5, 2024
Merged

Add LazyWorkerInterface #3038

merged 1 commit into from
Nov 5, 2024

Conversation

danlapid
Copy link
Contributor

@danlapid danlapid commented Nov 1, 2024

This is a new WorkerInterface class that will be used in the internal PR, see comments to understand what it does.

src/workerd/io/worker-interface.h Outdated Show resolved Hide resolved
src/workerd/io/worker-interface.h Outdated Show resolved Hide resolved
src/workerd/io/worker-interface.h Outdated Show resolved Hide resolved
@danlapid danlapid changed the title Add FuturePromisedWorkerInterface Add LazyWorkerInterface Nov 4, 2024
@danlapid danlapid marked this pull request as ready for review November 4, 2024 13:36
@danlapid danlapid requested review from a team as code owners November 4, 2024 13:36
@danlapid
Copy link
Contributor Author

danlapid commented Nov 4, 2024

This is a new WorkerInterface class that will be used in the internal
PR, see comments to understand what it does.
template <typename Func>
class LazyWorkerInterface final: public WorkerInterface {
public:
LazyWorkerInterface(Func func): func(kj::mv(func)) {}
Copy link
Member

Choose a reason for hiding this comment

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

Non-blocking nit: might consider marking this explicitly KJ_DISALLOW_COPY_AND_MOVE but not critical with having the KJ_ASSERT_NONNULLs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea copies would be bad but they are implicitly disabled by virtue of having an Own member.
I don't see why moves should be a problem.

Copy link
Member

Choose a reason for hiding this comment

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

Largely just an explicit hygiene thing for me... kind of a safeguard against someone changing any of the methods later and forgetting a KJ_ASSERT_NONNULL. But I'm being a bit extra paranoid :-)

@danlapid danlapid merged commit 472aeb3 into main Nov 5, 2024
13 checks passed
@danlapid danlapid deleted the dlapid/sharding_newLoopback branch November 5, 2024 09:58
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.

3 participants