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:
parent
374908726b
commit
f61f67ddee
5 changed files with 21 additions and 37 deletions
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue