mirror of
https://github.com/NixOS/nix
synced 2025-06-25 14:51:16 +02:00
Make 'nix copy' to file:// binary caches run in constant memory
This commit is contained in:
parent
400f1a9b59
commit
fc84c358d9
9 changed files with 120 additions and 87 deletions
|
@ -166,6 +166,19 @@ struct StringSource : Source
|
|||
};
|
||||
|
||||
|
||||
/* A sink that writes all incoming data to two other sinks. */
|
||||
struct TeeSink : Sink
|
||||
{
|
||||
Sink & sink1, & sink2;
|
||||
TeeSink(Sink & sink1, Sink & sink2) : sink1(sink1), sink2(sink2) { }
|
||||
virtual void operator () (const unsigned char * data, size_t len)
|
||||
{
|
||||
sink1(data, len);
|
||||
sink2(data, len);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* Adapter class of a Source that saves all data read to `s'. */
|
||||
struct TeeSource : Source
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue