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

Make the sizes of the members of enum Node more uniform #6545

Merged
merged 2 commits into from Sep 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/rust/engine/src/nodes.rs
Expand Up @@ -319,7 +319,7 @@ impl WrappedNode for Select {

impl From<Select> for NodeKey {
fn from(n: Select) -> Self {
NodeKey::Select(n)
NodeKey::Select(Box::new(n))
}
}

Expand Down Expand Up @@ -424,7 +424,7 @@ impl WrappedNode for ExecuteProcess {

impl From<ExecuteProcess> for NodeKey {
fn from(n: ExecuteProcess) -> Self {
NodeKey::ExecuteProcess(n)
NodeKey::ExecuteProcess(Box::new(n))
}
}

Expand Down Expand Up @@ -771,7 +771,7 @@ impl WrappedNode for Task {

impl From<Task> for NodeKey {
fn from(n: Task) -> Self {
NodeKey::Task(n)
NodeKey::Task(Box::new(n))
}
}

Expand Down Expand Up @@ -838,15 +838,18 @@ impl NodeTracer<NodeKey> for Tracer {
}
}

///
/// There is large variance in the sizes of the members of this enum, so a few of them are boxed.
///
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub enum NodeKey {
DigestFile(DigestFile),
ExecuteProcess(ExecuteProcess),
ExecuteProcess(Box<ExecuteProcess>),
Copy link
Contributor

Choose a reason for hiding this comment

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

May be worth adding a comment on the enum about why some things are boxed

ReadLink(ReadLink),
Scandir(Scandir),
Select(Select),
Select(Box<Select>),
Snapshot(Snapshot),
Task(Task),
Task(Box<Task>),
}

impl NodeKey {
Expand Down
5 changes: 4 additions & 1 deletion src/rust/engine/src/scheduler.rs
Expand Up @@ -211,7 +211,10 @@ impl Scheduler {
// Otherwise (if it is a success, some other type of Failure, or if we've run
// out of retries) recover to complete the join, which will cause the results to
// propagate to the user.
debug!("Root {} completed.", NodeKey::Select(root).format());
debug!(
"Root {} completed.",
NodeKey::Select(Box::new(root)).format()
);
Ok(other.map(|res| {
res
.try_into()
Expand Down