diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-04-05 21:12:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-05 21:12:06 +0200 |
commit | 4bf3eb27e6e2c0cdac862d188b23342793180999 (patch) | |
tree | 951e02caf44943e1918679da0363f59d020ba1d1 /src/libstore/worker-protocol.hh | |
parent | a07dc7e0d99d1cd91643c9ecc2b672399471eaf4 (diff) | |
parent | 125a824228dbac0bb82023953f45318ea93e7ffa (diff) |
Merge pull request #4594 from obsidiansystems/lots-of-buildable
Use `DerivedPath` for `buildPaths` and `ensurePath`
Diffstat (limited to 'src/libstore/worker-protocol.hh')
-rw-r--r-- | src/libstore/worker-protocol.hh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libstore/worker-protocol.hh b/src/libstore/worker-protocol.hh index be071dd78..001ed25e3 100644 --- a/src/libstore/worker-protocol.hh +++ b/src/libstore/worker-protocol.hh @@ -86,9 +86,11 @@ namespace worker_proto { MAKE_WORKER_PROTO(, std::string); MAKE_WORKER_PROTO(, StorePath); MAKE_WORKER_PROTO(, ContentAddress); +MAKE_WORKER_PROTO(, DerivedPath); MAKE_WORKER_PROTO(, Realisation); MAKE_WORKER_PROTO(, DrvOutput); +MAKE_WORKER_PROTO(template<typename T>, std::vector<T>); MAKE_WORKER_PROTO(template<typename T>, std::set<T>); #define X_ template<typename K, typename V> @@ -114,6 +116,26 @@ MAKE_WORKER_PROTO(, std::optional<StorePath>); MAKE_WORKER_PROTO(, std::optional<ContentAddress>); template<typename T> +std::vector<T> read(const Store & store, Source & from, Phantom<std::vector<T>> _) +{ + std::vector<T> resSet; + auto size = readNum<size_t>(from); + while (size--) { + resSet.push_back(read(store, from, Phantom<T> {})); + } + return resSet; +} + +template<typename T> +void write(const Store & store, Sink & out, const std::vector<T> & resSet) +{ + out << resSet.size(); + for (auto & key : resSet) { + write(store, out, key); + } +} + +template<typename T> std::set<T> read(const Store & store, Source & from, Phantom<std::set<T>> _) { std::set<T> resSet; |