feat(3p/nix): Implement AddToStore proto handler
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>
This commit is contained in:
parent
1fe4a47aa2
commit
05e44c121d
7 changed files with 141 additions and 13 deletions
17
third_party/nix/src/libutil/hash.cc
vendored
17
third_party/nix/src/libutil/hash.cc
vendored
|
|
@ -18,6 +18,23 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
std::optional<HashType> hash_type_from(nix::proto::HashType hash_type) {
|
||||
switch (hash_type) {
|
||||
case nix::proto::HashType::UNKNOWN:
|
||||
return HashType::htUnknown;
|
||||
case nix::proto::HashType::MD5:
|
||||
return HashType::htMD5;
|
||||
case nix::proto::HashType::SHA1:
|
||||
return HashType::htSHA1;
|
||||
case nix::proto::HashType::SHA256:
|
||||
return HashType::htSHA256;
|
||||
case nix::proto::HashType::SHA512:
|
||||
return HashType::htSHA512;
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
void Hash::init() {
|
||||
if (type == htMD5) {
|
||||
hashSize = md5HashSize;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue