1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 08:31:16 +02:00

* More remote operations.

* Added new operation hasSubstitutes(), which is more efficient than
  querySubstitutes().size() > 0.
This commit is contained in:
Eelco Dolstra 2006-11-30 22:43:55 +00:00
parent aac547a8b3
commit 0565b5f2b3
12 changed files with 138 additions and 46 deletions

View file

@ -48,6 +48,14 @@ void writeString(const string & s, Sink & sink)
}
void writeStringSet(const StringSet & ss, Sink & sink)
{
writeInt(ss.size(), sink);
for (StringSet::iterator i = ss.begin(); i != ss.end(); ++i)
writeString(*i, sink);
}
void readPadding(unsigned int len, Source & source)
{
if (len % 8) {
@ -84,4 +92,14 @@ string readString(Source & source)
}
StringSet readStringSet(Source & source)
{
unsigned int count = readInt(source);
StringSet ss;
while (count--)
ss.insert(readString(source));
return ss;
}
}

View file

@ -69,12 +69,14 @@ struct FdSource : Source
void writePadding(unsigned int len, Sink & sink);
void writeInt(unsigned int n, Sink & sink);
void writeString(const string & s, Sink & sink);
void writeStringSet(const StringSet & ss, Sink & sink);
void readPadding(unsigned int len, Source & source);
unsigned int readInt(Source & source);
string readString(Source & source);
StringSet readStringSet(Source & source);
}