2012-07-18 18:59:03 +00:00
|
|
|
#pragma once
|
2003-07-14 10:23:11 +00:00
|
|
|
|
2006-09-04 21:06:23 +00:00
|
|
|
#include "types.hh"
|
2009-03-28 20:51:33 +00:00
|
|
|
#include "hash.hh"
|
2003-07-14 10:23:11 +00:00
|
|
|
|
2006-09-04 21:06:23 +00:00
|
|
|
namespace nix {
|
2003-07-14 10:23:11 +00:00
|
|
|
|
2020-06-19 20:50:28 +00:00
|
|
|
std::pair<PathSet, HashResult> scanForReferences(const Path & path, const PathSet & refs);
|
2018-03-29 22:56:13 +00:00
|
|
|
|
2020-08-07 19:09:26 +00:00
|
|
|
PathSet scanForReferences(Sink & toTee, const Path & path, const PathSet & refs);
|
|
|
|
|
2018-03-29 22:56:13 +00:00
|
|
|
struct RewritingSink : Sink
|
|
|
|
{
|
|
|
|
std::string from, to, prev;
|
|
|
|
Sink & nextSink;
|
|
|
|
uint64_t pos = 0;
|
|
|
|
|
|
|
|
std::vector<uint64_t> matches;
|
|
|
|
|
|
|
|
RewritingSink(const std::string & from, const std::string & to, Sink & nextSink);
|
|
|
|
|
2020-12-02 13:00:43 +00:00
|
|
|
void operator () (std::string_view data) override;
|
2018-03-29 22:56:13 +00:00
|
|
|
|
|
|
|
void flush();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct HashModuloSink : AbstractHashSink
|
|
|
|
{
|
|
|
|
HashSink hashSink;
|
|
|
|
RewritingSink rewritingSink;
|
|
|
|
|
|
|
|
HashModuloSink(HashType ht, const std::string & modulus);
|
|
|
|
|
2020-12-02 13:00:43 +00:00
|
|
|
void operator () (std::string_view data) override;
|
2018-03-29 22:56:13 +00:00
|
|
|
|
|
|
|
HashResult finish() override;
|
|
|
|
};
|
|
|
|
|
2006-09-04 21:06:23 +00:00
|
|
|
}
|