-
Notifications
You must be signed in to change notification settings - Fork 45
Sled agent views/params shuffling #386
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
Conversation
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ahl because nexus refers to the generated type all the time, there is no more conversion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome
b5abcbe
to
469d6c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than that distinction between "views" and "params" which I'm not so sure about, this looks great!
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome
@@ -1,15 +1,8 @@ | |||
//! APIs exposed by the bootstrap agent | |||
//! Response types for the bootstrap agent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why pull apart inputs and outputs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related: I asked this on chat, but I'll ask it more publicly -
Are "views" supposed to be 1:1 with response types, or with DB representations?
This PR implies the former ("response types") but #374 implies the latter ("Views are public lenses onto the DB models.").
I'm especially curious about responses that do not represent data stored in a DB - does that still make sense to store in "view.rs"? If so, would it be more accurate to call these "requests.rs" and "responses.rs"? And in that case, I think Adam's question still applies - why split 'em?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right to point out the disparity — I'll update #374 to say they're response bodies, most of which are lenses onto DB models.
I'm really just following a convention set by the big fullstack frameworks in various languages — Rails, Django, Phoenix, Laravel — which all call response bodies "views", though usually those are HTML responses. In Rails they call the JSON serializers "serializers". I guess they call them serializers in Django too. They distinguish views and serializers from controllers (route handlers) and models.
They're not as consistent about what they call request bodies, probably because in the dynamic languages the request bodies don't have to be defined anywhere outside of the request handler.
requests.rs
and responses.rs
would be fine names, though they may obscure that we're talking about the bodies in both cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to merge as-is because we can rearrange easily later. The hard part, as you'll see, is moving things out of common. Moving things around within sled-agent or within nexus is easy.
DiskEnsureBody
is a request body expected by a sled agent endpoint, so it should live in sled agent. When Nexus wants to talk about these types, it should refer to the generated client.Doing this as its own PR because it would be incredibly confusing in combination with the other one.
To me this simplifies things a lot and is a good example of the kind of complication we currently have that makes things hard to reason about.