2012-07-18 21:59:03 +03:00
|
|
|
#pragma once
|
2003-07-14 13:23:11 +03:00
|
|
|
|
2006-09-05 00:06:23 +03:00
|
|
|
#include "types.hh"
|
2009-03-28 22:51:33 +02:00
|
|
|
#include "hash.hh"
|
2003-07-14 13:23:11 +03:00
|
|
|
|
2006-09-05 00:06:23 +03:00
|
|
|
namespace nix {
|
2003-07-14 13:23:11 +03:00
|
|
|
|
2020-06-19 23:50:28 +03:00
|
|
|
std::pair<PathSet, HashResult> scanForReferences(const Path & path, const PathSet & refs);
|
2018-03-30 01:56:13 +03: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-05 00:06:23 +03:00
|
|
|
}
|