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
|
|
|
|
2009-03-28 20:51:33 +00:00
|
|
|
PathSet scanForReferences(const Path & path, const PathSet & refs,
|
2010-11-16 17:11:46 +00:00
|
|
|
HashResult & hash);
|
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);
|
|
|
|
|
|
|
|
void operator () (const unsigned char * data, size_t len) override;
|
|
|
|
|
|
|
|
void flush();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct HashModuloSink : AbstractHashSink
|
|
|
|
{
|
|
|
|
HashSink hashSink;
|
|
|
|
RewritingSink rewritingSink;
|
|
|
|
|
|
|
|
HashModuloSink(HashType ht, const std::string & modulus);
|
|
|
|
|
|
|
|
void operator () (const unsigned char * data, size_t len) override;
|
|
|
|
|
|
|
|
HashResult finish() override;
|
|
|
|
};
|
|
|
|
|
2006-09-04 21:06:23 +00:00
|
|
|
}
|