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

Reorganize daphne_worker #375

Merged
merged 5 commits into from
Aug 4, 2023
Merged

Reorganize daphne_worker #375

merged 5 commits into from
Aug 4, 2023

Conversation

mendess
Copy link
Collaborator

@mendess mendess commented Jul 24, 2023

This PR cleans up the codebase a bit more by:

  • Inlining test modules in daphne_worker
  • Removing unnecessary macros from daphne and daphne_worker
  • Moving module statements to the top of files

This PR is best viewed one commit at a time!

@mendess mendess self-assigned this Jul 24, 2023
@mendess mendess force-pushed the mendess/reorganize-daphne-worker branch from a37342e to 90a0b95 Compare July 24, 2023 15:43
@mendess mendess force-pushed the mendess/reorganize-daphne-worker branch from 90a0b95 to e0fa341 Compare August 3, 2023 17:00
Copy link
Contributor

@cjpatton cjpatton left a comment

Choose a reason for hiding this comment

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

Looks good overall, just a few things to clean up in my opinion. (All open for discussion, of course.)

resp_media_type: DapMediaType,
resource: DapResource,
req_data: Vec<u8>,
is_put: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

If set, this PUTs instead of POSTs. Since we're changing this code, we might as well rename it to be more accurate. How about "leader_send_http_request" and "LeaderHttpRequestOptions"?

daphne_worker/src/durable/aggregate_store.rs Outdated Show resolved Hide resolved
req: Request,
state: &State,
env: &Env,
deployment: crate::config::DaphneWorkerDeployment,
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Suggestion: staet, env, deployment, and touched are attributes common to all DOs that are "garbage collected". WDYTA about defining a trait for these and have run_garbage_collection be a derived method on this trait? I think this would make the code a lot cleaner.
  • This doesn't actually "run" garbage collection: It puts the DO instance on the garbage collection queue, which is dequeued before each e2e tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

To be clear: The second suggestion is to rename the method.

@mendess mendess force-pushed the mendess/reorganize-daphne-worker branch from a723785 to 5fa4693 Compare August 3, 2023 18:19
Copy link
Contributor

@cjpatton cjpatton left a comment

Choose a reason for hiding this comment

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

Nice :) Just a few nits.

path,
req_media_type,
resp_media_type,
resource,
req_data,
is_put,
method: is_put,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: s/is_put/method

.await?
{
ControlFlow::Continue(req) => req,
// this req was a GC request and as such we must return from this funcition.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// this req was a GC request and as such we must return from this funcition.
// This req was a GC request and as such we must return from this function.

Copy link
Contributor

Choose a reason for hiding this comment

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

(Here and below)

&self.state
}

fn deployment(&self) -> crate::config::DaphneWorkerDeployment {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: It would be slightly more general to return a reference to self..config, i.e., change the signature here to config(&self) -> &Confg (I forget the name of the actual type at the meoment)

@mendess mendess force-pushed the mendess/reorganize-daphne-worker branch 2 times, most recently from 5bf7976 to 6fdeca3 Compare August 4, 2023 09:55
Macros make the code harder to read as there are no types inside a macro
body. They are also harder to debug and auto compleation doesn't work
inside them.
@mendess mendess force-pushed the mendess/reorganize-daphne-worker branch from 6fdeca3 to 11e3e17 Compare August 4, 2023 10:05
@mendess mendess force-pushed the mendess/reorganize-daphne-worker branch from 11e3e17 to c0272cb Compare August 4, 2023 10:14
@mendess mendess merged commit 87a6ef1 into main Aug 4, 2023
4 checks passed
@mendess mendess deleted the mendess/reorganize-daphne-worker branch August 4, 2023 10:30
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