Skip to content

Commit

Permalink
Remove Stat Node
Browse files Browse the repository at this point in the history
It used to be a placeholder, and now it's obsoleted by DigestFile which actually has content
  • Loading branch information
illicitonion committed Dec 18, 2017
1 parent 8d69418 commit 3de8430
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions src/rust/engine/src/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,31 +788,6 @@ impl From<DigestFile> for NodeKey {
}
}

///
/// A Node that represents consuming the stat for some path.
///
/// NB: Because the `Scandir` operation gets the stats for a parent directory in a single syscall,
/// this operation results in no data, and is simply a placeholder for `Snapshot` Nodes to use to
/// declare a dependency on the existence/content of a particular path. This makes them more error
/// prone, unfortunately.
///
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct Stat(PathBuf);

impl Node for Stat {
type Output = ();

fn run(self, _: Context) -> NodeFuture<()> {
future::ok(()).to_boxed()
}
}

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

///
/// A Node that represents executing a directory listing that returns a Stat per directory
/// entry (generally in one syscall). No symlinks are expanded.
Expand Down Expand Up @@ -1060,7 +1035,6 @@ pub enum NodeKey {
DigestFile(DigestFile),
ReadLink(ReadLink),
Scandir(Scandir),
Stat(Stat),
Select(Select),
Snapshot(Snapshot),
Task(Task),
Expand All @@ -1078,7 +1052,6 @@ impl NodeKey {
&NodeKey::DigestFile(ref s) => format!("DigestFile({:?})", s.0),
&NodeKey::ReadLink(ref s) => format!("ReadLink({:?})", s.0),
&NodeKey::Scandir(ref s) => format!("Scandir({:?})", s.0),
&NodeKey::Stat(ref s) => format!("Stat({:?})", s.0),
&NodeKey::Select(ref s) => {
format!(
"Select({}, {})",
Expand Down Expand Up @@ -1109,7 +1082,6 @@ impl NodeKey {
&NodeKey::DigestFile(..) => "DigestFile".to_string(),
&NodeKey::ReadLink(..) => "LinkDest".to_string(),
&NodeKey::Scandir(..) => "DirectoryListing".to_string(),
&NodeKey::Stat(..) => "Stat".to_string(),
}
}

Expand All @@ -1121,7 +1093,6 @@ impl NodeKey {
&NodeKey::DigestFile(ref s) => Some(s.0.path.as_path()),
&NodeKey::ReadLink(ref s) => Some((s.0).0.as_path()),
&NodeKey::Scandir(ref s) => Some((s.0).0.as_path()),
&NodeKey::Stat(ref s) => Some(s.0.as_path()),

// Not FS operations:
// Explicitly listed so that if people add new NodeKeys they need to consider whether their
Expand All @@ -1141,7 +1112,6 @@ impl Node for NodeKey {
match self {
NodeKey::DigestFile(n) => n.run(context).map(|v| v.into()).to_boxed(),
NodeKey::ReadLink(n) => n.run(context).map(|v| v.into()).to_boxed(),
NodeKey::Stat(n) => n.run(context).map(|v| v.into()).to_boxed(),
NodeKey::Scandir(n) => n.run(context).map(|v| v.into()).to_boxed(),
NodeKey::Select(n) => n.run(context).map(|v| v.into()).to_boxed(),
NodeKey::Snapshot(n) => n.run(context).map(|v| v.into()).to_boxed(),
Expand Down

0 comments on commit 3de8430

Please sign in to comment.