mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-11 00:36:20 +02:00
39 lines
846 B
C++
39 lines
846 B
C++
#pragma once
|
|
|
|
#include "types.hh"
|
|
#include "hash.hh"
|
|
|
|
namespace nix {
|
|
|
|
std::pair<PathSet, HashResult> scanForReferences(const Path & path, const PathSet & refs);
|
|
|
|
PathSet scanForReferences(Sink & toTee, const Path & path, const PathSet & refs);
|
|
|
|
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;
|
|
};
|
|
|
|
}
|