Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
references.hh
Go to the documentation of this file.
1#pragma once
3
4#include "hash.hh"
5
6namespace nix {
7
8class RefScanSink : public Sink
9{
10 StringSet hashes;
11 StringSet seen;
12
13 std::string tail;
14
15public:
16
17 RefScanSink(StringSet && hashes) : hashes(hashes)
18 { }
19
20 StringSet & getResult()
21 { return seen; }
22
23 void operator () (std::string_view data) override;
24};
25
26struct RewritingSink : Sink
27{
28 const StringMap rewrites;
29 std::string::size_type maxRewriteSize;
30 std::string prev;
31 Sink & nextSink;
32 uint64_t pos = 0;
33
34 std::vector<uint64_t> matches;
35
36 RewritingSink(const std::string & from, const std::string & to, Sink & nextSink);
37 RewritingSink(const StringMap & rewrites, Sink & nextSink);
38
39 void operator () (std::string_view data) override;
40
41 void flush();
42};
43
44struct HashModuloSink : AbstractHashSink
45{
46 HashSink hashSink;
47 RewritingSink rewritingSink;
48
49 HashModuloSink(HashAlgorithm ha, const std::string & modulus);
50
51 void operator () (std::string_view data) override;
52
53 HashResult finish() override;
54};
55
56}
Definition hash.hh:221
std::variant< std::string, std::string_view > data
Definition lexer.l:177
std::string std::string_view from
Definition lexer.l:2591
std::string std::string_view std::string_view to
Definition lexer.l:2592
std::pair< Hash, uint64_t > HashResult
Definition hash.hh:174
Definition hash.hh:216
Definition references.hh:27
Definition serialise.hh:20