forked from lix-project/lix
Merge branch 'path-info' into ca-drv-exotic
This commit is contained in:
commit
8abb627002
|
@ -3,6 +3,7 @@
|
||||||
#include <variant>
|
#include <variant>
|
||||||
#include "hash.hh"
|
#include "hash.hh"
|
||||||
#include "path.hh"
|
#include "path.hh"
|
||||||
|
#include "comparator.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
@ -56,6 +57,8 @@ std::pair<ContentAddressMethod, HashType> parseContentAddressMethod(std::string_
|
||||||
|
|
||||||
struct TextHash {
|
struct TextHash {
|
||||||
Hash hash;
|
Hash hash;
|
||||||
|
|
||||||
|
GENERATE_CMP(TextHash, me->hash);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Pair of a hash, and how the file system was ingested
|
/// Pair of a hash, and how the file system was ingested
|
||||||
|
@ -63,6 +66,8 @@ struct FixedOutputHash {
|
||||||
FileIngestionMethod method;
|
FileIngestionMethod method;
|
||||||
Hash hash;
|
Hash hash;
|
||||||
std::string printMethodAlgo() const;
|
std::string printMethodAlgo() const;
|
||||||
|
|
||||||
|
GENERATE_CMP(FixedOutputHash, me->method, me->hash);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -102,23 +107,13 @@ struct PathReferences
|
||||||
std::set<Ref> references;
|
std::set<Ref> references;
|
||||||
bool hasSelfReference = false;
|
bool hasSelfReference = false;
|
||||||
|
|
||||||
bool operator == (const PathReferences<Ref> & other) const
|
|
||||||
{
|
|
||||||
return references == other.references
|
|
||||||
&& hasSelfReference == other.hasSelfReference;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator != (const PathReferences<Ref> & other) const
|
|
||||||
{
|
|
||||||
return references != other.references
|
|
||||||
|| hasSelfReference != other.hasSelfReference;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Functions to view references + hasSelfReference as one set, mainly for
|
/* Functions to view references + hasSelfReference as one set, mainly for
|
||||||
compatibility's sake. */
|
compatibility's sake. */
|
||||||
StorePathSet referencesPossiblyToSelf(const Ref & self) const;
|
StorePathSet referencesPossiblyToSelf(const Ref & self) const;
|
||||||
void insertReferencePossiblyToSelf(const Ref & self, Ref && ref);
|
void insertReferencePossiblyToSelf(const Ref & self, Ref && ref);
|
||||||
void setReferencesPossiblyToSelf(const Ref & self, std::set<Ref> && refs);
|
void setReferencesPossiblyToSelf(const Ref & self, std::set<Ref> && refs);
|
||||||
|
|
||||||
|
GENERATE_CMP(PathReferences<Ref>, me->references, me->hasSelfReference);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Ref>
|
template<typename Ref>
|
||||||
|
@ -159,11 +154,15 @@ void PathReferences<Ref>::setReferencesPossiblyToSelf(const Ref & self, std::set
|
||||||
struct TextInfo : TextHash {
|
struct TextInfo : TextHash {
|
||||||
// References for the paths, self references disallowed
|
// References for the paths, self references disallowed
|
||||||
StorePathSet references;
|
StorePathSet references;
|
||||||
|
|
||||||
|
GENERATE_CMP(TextInfo, *(const TextHash *)me, me->references);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FixedOutputInfo : FixedOutputHash {
|
struct FixedOutputInfo : FixedOutputHash {
|
||||||
// References for the paths
|
// References for the paths
|
||||||
PathReferences<StorePath> references;
|
PathReferences<StorePath> references;
|
||||||
|
|
||||||
|
GENERATE_CMP(FixedOutputInfo, *(const FixedOutputHash *)me, me->references);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::variant<
|
typedef std::variant<
|
||||||
|
@ -185,17 +184,7 @@ struct StorePathDescriptor {
|
||||||
std::string name;
|
std::string name;
|
||||||
ContentAddressWithReferences info;
|
ContentAddressWithReferences info;
|
||||||
|
|
||||||
bool operator == (const StorePathDescriptor & other) const
|
GENERATE_CMP(StorePathDescriptor, me->name, me->info);
|
||||||
{
|
|
||||||
return name == other.name;
|
|
||||||
// FIXME second field
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator < (const StorePathDescriptor & other) const
|
|
||||||
{
|
|
||||||
return name < other.name;
|
|
||||||
// FIXME second field
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue