about summary refs log tree commit diff
path: root/third_party/nix/src/nix-daemon/nix-daemon-proto.cc (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-05-19 r/4098 chore(3p/nix): unvendor tvix 0.1Vincent Ambo1-799/+0
Nothing is using this now, and we'll likely never pick this up again, but we learned a lot in the process. Every now and then this breaks in some bizarre way on channel bumps and it's just a waste of time to maintain that. Change-Id: Idcf2f5acd4ca7070ce18d7149cbfc0d967dc0a44 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5632 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: lukegb <lukegb@tvl.fyi> Autosubmit: tazjin <tazjin@tvl.su>
2020-11-28 r/1946 feat(tvix): Thread a log sink through calls to buildDerivationGriffin Smith1-1/+4
Similarly to how we did for buildPaths, add a std::ostream& log_sink parameter to the build_derivation method on Store, and pass it std::cerr when called at the top level by nix commands - most notably, the build-remote hook binary, so that we get build logs when using tvix as a remote builder. Change-Id: I0f8f729ba8429d4838a0a135a5c2ac1e1a95d575 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2176 Tested-by: BuildkiteCI Reviewed-by: andi <andi@notmuch.email> Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-11-27 r/1945 fix(tvix): Don't call assertStorePath on BasicDerivation.builderGriffin Smith1-4/+2
Upstream doesn't, and for good reason - this might not be a store path, for example if it's /bin/sh Fixes: b/73 Change-Id: If9aa96de2cd8ab941c098a9f122b8b302a92ec38 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2175 Reviewed-by: kanepyork <rikingcoding@gmail.com> Tested-by: BuildkiteCI
2020-11-27 r/1941 fix(txix): Override overflow in BuildLogStreambufGriffin Smith1-0/+10
Subclasses of std::streambuf are expected to override overflow in addition to xsputn, as it's called in certain cases by the non-virtual methods. In our case, this was preventing endlines from getting sent over the log stream. Change-Id: I70d00f0c7cb8f8cf2f744f58974c21e7a70a715b Reviewed-on: https://cl.tvl.fyi/c/depot/+/2172 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-11-21 r/1888 chore(tvix): Use StatusOr API available in Abseil's versionVincent Ambo1-1/+1
The Abseil version of `StatusOr` does not come with the status macros or the `Consume*` family of functions. This change modifies the existing code to use the common denominator of the API that is available between Abseil's own implementation of `StatusOr` and the one from Tensorflow that we are currently using. Change-Id: I5c37f68636a1fd54d153f95d7303ab8644abb774
2020-09-06 r/1770 feat(tvix): Implement EnsurePath RPC handlerGriffin Smith1-0/+13
Missed this one Fixes: b/62 Change-Id: I6f3bbcd3e2a7db5786283761b57466da33a497f7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1936 Reviewed-by: kanepyork <rikingcoding@gmail.com> Tested-by: BuildkiteCI
2020-08-29 r/1736 fix(tvix): Chunk the AddTextToStore requestGriffin Smith1-6/+27
Rather than sending the entire AddTextToStore request along in a single message, send it in a stream of chunks using the same metadata-first approach we've been using for the other store gRPC requests. This fixes a bug where certain builds could send more data than the maximum gRPC request size (4194304 bytes, it would appear), resulting in a RESOURCE_EXHAUSTED error. The initial chunk size, which is currently constant but should be made dynamic at some point in the future, has been chosen based on the IPC bandwidth delay product for tazjin's desktop, rounded up. Change-Id: I6f0232cdbc98653484816b39855126873fc59a03 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1835 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in> Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-20 r/1689 chore(tvix): Thread a std::ostream through Store::buildPathsVincent Ambo1-2/+5
This part of the store API needs to carry a handle to the log sink from now on, so that it can be passed in as appropriate from the gRPC handlers. In all places where there is no such handler available at the moment, the discarding log sink has been inserted. This can be used as a convenient grep target in the future. Change-Id: I26628e30b4c6437dccdf8f722ca2e8ed827dfc19 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1797 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com> Reviewed-by: glittershark <grfn@gws.fyi>
2020-08-20 r/1686 feat(tvix): Implement std::streambuf for a build log -> gRPC sinkGriffin Smith1-0/+18
Introduces a class which implements std::streambuf by sending build log lines to the provided gRPC stream writer as individual messages. This can be used in the implementations of calls which trigger builds to forward logs back to the clients. Change-Id: I3cecba2219cc24d56692056079c7d7e4e0fc1e2c Reviewed-on: https://cl.tvl.fyi/c/depot/+/1794 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com> Reviewed-by: glittershark <grfn@gws.fyi>
2020-08-20 r/1685 feat(tvix): Introduce build event streams in worker protocolVincent Ambo1-8/+15
Introduces a new `BuildEvent` proto type which is streamed in response to calls that trigger builds of derivations. This type can currently supply build statuses, log lines and information about builds starting. This is in preparation for threading build logs through the processes. Since we have nowhere to send the logs (yet), a null sink is used instead. Co-authored-by: Griffin Smith <grfn@gws.fyi> Change-Id: If7332337b89506c7e404cd20174acdaa1a3be4e8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1793 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi> Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-14 r/1649 refactor(tvix): Make Store::buildPaths return a StatusGriffin Smith1-3/+3
Make Store::buildPaths return a Status with [[nodiscard]] rather than throwing exceptions to signal failure. This is the beginning of a long road to refactor the entire store API to be status/statusor based instead of using exceptions. Change-Id: I2e32371c95a25b87ad129987c217d49c6d6e0c85 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1745 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-10 r/1631 fix(tvix): Print invalid store path when encounteredVincent Ambo1-3/+2
... instead of silently swallowing it. Change-Id: I084c51d633d632bd4e3f1ca42987dd6068fbb2a9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1707 Reviewed-by: Profpatsch <mail@profpatsch.de> Tested-by: BuildkiteCI
2020-08-09 r/1622 feat(tvix): Implement all remaining RPC callsGriffin Smith1-0/+13
Implement all remaining RPC calls on the RpcSstore client, remove a few stub methods we had added that weren't actually present in the old RemoteStore implementation, and add one more RPC call for getBuildLog that is present in the store API, but that we hadn't added as a stub *or* to the proto. Fixes: #29 Change-Id: Id827f51a393ece4bc7bbecaf38aee9eb4b329770 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1692 Reviewed-by: kanepyork <rikingcoding@gmail.com> Tested-by: BuildkiteCI
2020-08-08 r/1619 chore(3p/nix): apply google-readability-castingKane York1-1/+1
Command run: jq <compile_commands.json -r 'map(.file)|.[]' | grep -v '/generated/' | parallel clang-tidy -p compile_commands.json -checks=-*,google-readability-casting --fix Manual fixes applied in src/nix-env/nix-env.cc, src/libstore/store-api.cc Change-Id: I406b4be9368c557ca59329bf6f7002704e955f8d Reviewed-on: https://cl.tvl.fyi/c/depot/+/1557 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi> Reviewed-by: tazjin <mail@tazj.in>
2020-08-08 r/1618 fix(tvix): Wrap remaining RPCs in HandleExceptionsGriffin Smith1-21/+29
Wrap the BuildPaths and AddTextToStore RPC handlers in HandleExceptions. These were missed in the original pass due to a merge. Change-Id: Ie5be45e6098fba7a2b6b1c1be81578cb742c2880 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1689 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-08 r/1615 feat(tvix): Implement AddToStoreNarGriffin Smith1-7/+79
Implement both the client and server sides of AddToStoreNar, using a templated generalization of the sources and sinks we were using for AddToStore on both ends. Change-Id: I73d0ed34118c711b125851dff99a7518ced4af35 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1686 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-05 r/1600 feat(3p/nix): Implement FindRoots, CollectGarbageGriffin Smith1-0/+55
Implement the RPC client and server handlers for the FindRoots and CollectGarbage RPC calls Change-Id: Ifa5d582c6a33bd1e7661ac2fc860505ef404dad0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1656 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-05 r/1594 feat(3p/nix): Implement AddToStore rpc clientGriffin Smith1-1/+1
Implement the AddToStore RPC client method, which uses an AddToStorePathWriterSink (the dual of the AddToStorePathReaderSource on the server side) to hook into the dumpPath machinery (which we should refactor not to use sinks or sources, but not yet) and write dumped paths as binary data over gRPC. With this commit and sandboxing disabled, the following derivation builds cleanly: derivation { name = "test"; builder = ./build.sh; system = "x86_64-linux"; } where build.sh has chmod +x and contains: #!/bin/sh echo 1 > $out Change-Id: I94cab86f0825a3a9993262a9807130645c13bf44 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1638 Reviewed-by: kanepyork <rikingcoding@gmail.com> Tested-by: BuildkiteCI
2020-08-04 r/1583 feat(tvix): Implement AddIndirectRoot, SyncWithGCGriffin Smith1-0/+25
Implement RPC handlers and client methods for the AddWithRoot and SyncWithGC calls. With this and sandboxing disabled, the following derivation is now building successfully: derivation { name = "test"; builder = "/bin/sh"; args = [ "-c" "echo 1 > $out" ]; system = "x86_64-linux"; } Co-authored-by: Vincent Ambo <mail@tazj.in> Change-Id: I245dca0dfca882e2eae5d93364287a8b79fead71 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1637 Reviewed-by: tazjin <mail@tazj.in> Reviewed-by: kanepyork <rikingcoding@gmail.com> Tested-by: BuildkiteCI
2020-08-04 r/1573 feat(3p/nix/daemon): catch-all explicit Error-Status conversionKane York1-230/+318
We wrap every server-side proto handler with a macro that catches exceptions and turns them into proper grpc error codes. For the time being, most exceptions map to INTERNAL, the existing mapping. Change-Id: Id6ed6a279b198ad185d32562f39000ccc15eadbf Reviewed-on: https://cl.tvl.fyi/c/depot/+/1599 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
2020-08-03 r/1570 chore(3p/nix/daemon): replace all assertStorePath with a macroKane York1-14/+20
Two exceptions: IsValidPath needs to return success for invalid paths, and QueryAllValidPaths shouldn't need to check the paths it gets from itself. Change-Id: I4d9d4125d34e8de42f30070aec607f8a902eded7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1598 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
2020-08-03 r/1567 feat(3p/nix): Implement two more RPC callsGriffin Smith1-1/+35
Implement AddTextToStore and BuildPaths both on the client and the server Refs: #29 Change-Id: I45294c3e1c1a7489e42099d36425b7acc04e0427 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1560 Reviewed-by: kanepyork <rikingcoding@gmail.com> Tested-by: BuildkiteCI
2020-08-01 r/1534 fix(3p/nix): revert "apply all clang-tidy fixes"Kane York1-3/+4
This reverts commit ef54f5da9fa30b5c302f2a49595ee5d041f9706a. Resolved conflicts: third_party/nix/src/libexpr/eval.cc third_party/nix/src/libstore/builtins/fetchurl.cc third_party/nix/src/libstore/references.cc third_party/nix/src/libutil/hash.cc third_party/nix/src/nix-daemon/nix-daemon.cc Change-Id: Ib9cf6e96a79a23bde3983579ced3f92e530cb011 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1547 Reviewed-by: glittershark <grfn@gws.fyi> Tested-by: BuildkiteCI
2020-08-01 r/1529 feat(3p/nix): Implement a few more RPC callsGriffin Smith1-0/+25
Implement the RPC client calls for QueryPathFromHashPart, QuerySubstitutablePaths, and QuerySubstitutablePathInfos, and the handler for QuerySubstitutablePathInfos. Refs: #29 Change-Id: Idf383b771f159f267d8f65367bc4af3d239e32b7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1515 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-01 r/1519 feat(3p/nix): Implement AddToStore proto handlerGriffin Smith1-0/+109
Implement the proto handler for AddToStore, which adds a nix path to the store. This is implemented by adding a new (probably soon-to-be-generalized) Source concretion that wraps a grpc ServerReader for the stream of data we're receiving from the client - this is less than ideal, as it's perpetuating the source/sink thing that's going on and storing entire nars in memory, but is at the very worst an incremental step towards a functioning nix that we can refactor in the future. Paired-With: Perry Lorier <isomer@tvl.fyi> Paired-With: Vincent Ambo <mail@tazj.in> Change-Id: I48db734e7460a47aee4a85dd5137b690980859e3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1441 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com> Reviewed-by: tazjin <mail@tazj.in>
2020-07-27 r/1495 fix(3p/nix): apply all clang-tidy fixesKane York1-4/+3
Change-Id: I265e763393422ee1881653527c91024458060825 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1432 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-25 r/1472 feat(3p/nix): Add main function for grpc daemonGriffin Smith1-6/+5
Implement the main function for the new, proto-based nix daemon. This mostly replicates the behavior of the previous nix daemon - it starts a grpc server listening on the same nix socket path and supports the same set of options - with the exception of --stdio, which has been renamed to --pipe and documented in the man page. Change-Id: Ib729283c1d5d35c0e1b0a968bc1f052f5527f2d7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1356 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in> Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-07-20 r/1409 feat(3p/nix/nix-daemon): add factory function for WorkerServiceImplGriffin Smith1-0/+7
Add a forward-declared factory function for constructing and returning a WorkerServiceImpl, for eventual use in the main function for the nix daemon Change-Id: I9032d69b6ee3bc3b1f39f3d5d55f951cffad8145 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1293 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-18 r/1384 fix(3p/nix/nix-daemon): Add assertStorePath to all proto implsGriffin Smith1-0/+7
I missed calling store_->assertStorePath on paths in several daemon proto handlers, which the previous implementation did. Change-Id: Ifad6eeb03b5a5babec7b4bcf7aca060813f15bb7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1272 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-18 r/1383 feat(3p/nix/nix-daemon): Implement Worker::AddSignatures handlerGriffin Smith1-0/+14
I got the message proto wrong on this one as well - it needs both a path and a signatures. Change-Id: I9a489b1285bda61c15b2a3b47d9cfc3b50e387da Reviewed-on: https://cl.tvl.fyi/c/depot/+/1270 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-18 r/1382 feat(3p/nix/nix-daemon): Implement Worker::BuildDerivation handlerGriffin Smith1-0/+23
Implement the proto handler on the server side for Worker::BuildDerivation. This includes several additions to the proto which I had missed on the first pass, including the actual proto definition for the Derivation itself and a few sequence number reorderings which are fine because this is all provisional and not deployed yet. A couple things to note - I implemented a couple constructors for nix classes that initialize themselves based on their proto variants, which felt nice and didn't end up causing any issues. - I've made the conversions between the enum types in nix and in proto explicit via switch statements rather than using a static_cast, out of an abundance of caution that the error would get mismatched in the future and we'd convert the wrong thing to the wrong thing - this is verbose, but exceptionally future proof. Change-Id: Iecf6b88e76bc37e49efa05fd65d6cd0cb0deffed Reviewed-on: https://cl.tvl.fyi/c/depot/+/1249 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in> Reviewed-by: Kane York <rikingcoding@gmail.com>
2020-07-17 r/1361 feat(3p/nix/nix-daemon): Implement Worker::VerifyStore handlerGriffin Smith1-0/+11
Also adds the missing check_contents field to the VerifyStoreRequest proto message, since it was missed in the original pass. This is done using a renumbering, which is fine in this case since the proto hasn't been deployed yet Change-Id: I92bf4e48a71a25ae02ae02b3deaf6e7c71fe5da7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1237 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi> Reviewed-by: Kane York <rikingcoding@gmail.com>
2020-07-17 r/1360 feat(3p/nix/nix-daemon): Implement Worker::OptimiseStore handlerGriffin Smith1-0/+9
Change-Id: I8b1d84799a608a516d0b4980022a7edd545a1ca1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1235 Tested-by: BuildkiteCI Reviewed-by: Kane York <rikingcoding@gmail.com>
2020-07-17 r/1359 feat(3p/nix/nix-daemon): Implement Worker::QuerySubstitutablePaths handlerGriffin Smith1-0/+17
Change-Id: I243d67b0bce29d54c7d6e08f5eee70bd395cf9a2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1234 Tested-by: BuildkiteCI Reviewed-by: Kane York <rikingcoding@gmail.com>
2020-07-17 r/1358 feat(3p/nix/nix-daemon): Implement Worker::QueryValidPaths handlerGriffin Smith1-0/+17
Change-Id: I221dcd2a3fa53ead3ea9ac47830d968bb587c6e5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1233 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-17 r/1357 feat(3p/nix/nix-daemon): Implement Worker::QueryPathFromHashPartGriffin Smith1-0/+9
Change-Id: Id351a0c82f4d6e79a8f272674d8d8e86e12a9400 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1232 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-17 r/1356 feat(3p/nix/nix-daemon): Implement Worker::QueryDerivationOutputNames handlerGriffin Smith1-0/+13
Change-Id: Ie17e37322dd0e241cd35b6d8e69bd6c968fd6ff2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1231 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-17 r/1355 feat(3p/nix/nix-daemon): Implement Worker::QueryPathInfo handlerGriffin Smith1-0/+40
Change-Id: I580bd29356f7bcd0cc2050afda11d2e115d44c94 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1230 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-17 r/1350 chore(3p/nix/proto): Fix style violations in new proto defsKane York1-2/+2
This is a blocker to enabling the linter. Change-Id: I9f8d3cc19c7539086f53474a505362230fc56c04 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1245 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-16 r/1342 feat(3p/nix/nix-daemon): Implement Worker::QueryAllValidPaths handlerGriffin Smith1-1/+13
Change-Id: If9d2144ae872183abf47d84c94cc5c5fa23ced87 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1229 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-16 r/1341 feat(3p/nix/nix-daemon): Implement Worker::QueryMissing handlerGriffin Smith1-0/+30
Change-Id: I004a0c7969e1fe27b844adfed2d3ba3e6c5279bb Reviewed-on: https://cl.tvl.fyi/c/depot/+/1227 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-16 r/1340 feat(3p/nix): Implement similar group of Worker::Query* handlersVincent Ambo1-2/+47
These are the queries that are handled in the confusing case statement in the old daemon implementation, because they have very similar structure. Change-Id: Ie7143354f66cef4336dff8072ede9a56271a7e89 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1228 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-16 r/1339 feat(3p/nix/nix-daemon): Implement Worker::HasSubstitutes handlerVincent Ambo1-0/+10
Change-Id: I0b01b554eee4b4e31416aabb498ea3d8b8a8092b Reviewed-on: https://cl.tvl.fyi/c/depot/+/1226 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-16 r/1338 feat(3p/nix/nix-daemon): Implement Worker::IsValidPath handlerVincent Ambo1-0/+29
Change-Id: I741c2b9b58f234a21850640e2b0c071ff4441234 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1223 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: glittershark <grfn@gws.fyi>