1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 14:51:16 +02:00

RemoteStore::addToStore(): Send NAR rather than string containing NAR

This allows the NAR to be streamed in the future (though we're not
doing that yet).
This commit is contained in:
Eelco Dolstra 2017-03-01 16:07:15 +01:00
parent 374908726b
commit f61f67ddee
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
5 changed files with 21 additions and 37 deletions

View file

@ -140,15 +140,16 @@ struct StringSource : Source
/* Adapter class of a Source that saves all data read to `s'. */
struct SavingSourceAdapter : Source
struct TeeSource : Source
{
Source & orig;
string s;
SavingSourceAdapter(Source & orig) : orig(orig) { }
ref<std::string> data;
TeeSource(Source & orig)
: orig(orig), data(make_ref<std::string>()) { }
size_t read(unsigned char * data, size_t len)
{
size_t n = orig.read(data, len);
s.append((const char *) data, n);
this->data->append((const char *) data, n);
return n;
}
};