aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake/lockfile.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/flake/lockfile.hh')
-rw-r--r--src/libexpr/flake/lockfile.hh10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libexpr/flake/lockfile.hh b/src/libexpr/flake/lockfile.hh
index eb99ed997..04ac80f56 100644
--- a/src/libexpr/flake/lockfile.hh
+++ b/src/libexpr/flake/lockfile.hh
@@ -15,16 +15,18 @@ using namespace fetchers;
typedef std::vector<FlakeId> InputPath;
+struct LockedNode;
+
/* A node in the lock file. It has outgoing edges to other nodes (its
inputs). Only the root node has this type; all other nodes have
type LockedNode. */
struct Node : std::enable_shared_from_this<Node>
{
- std::map<FlakeId, std::shared_ptr<Node>> inputs;
+ typedef std::variant<std::shared_ptr<LockedNode>, InputPath> Edge;
- virtual ~Node() { }
+ std::map<FlakeId, Edge> inputs;
- std::shared_ptr<Node> findInput(const InputPath & path);
+ virtual ~Node() { }
};
/* A non-root node in the lock file. */
@@ -63,6 +65,8 @@ struct LockFile
bool isImmutable() const;
bool operator ==(const LockFile & other) const;
+
+ std::shared_ptr<Node> findInput(const InputPath & path);
};
std::ostream & operator <<(std::ostream & stream, const LockFile & lockFile);