aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/nar-accessor.cc
AgeCommit message (Collapse)Author
2020-12-15Use the fs accessor for readInvalidDerivationregnat
Extend `FSAccessor::readFile` to allow not checking that the path is a valid one, and rewrite `readInvalidDerivation` using this extended `readFile`. Several places in the code use `readInvalidDerivation`, either because they need to read a derivation that has been written in the store but not registered yet, or more generally to prevent a deadlock because `readDerivation` tries to lock the state, so can't be called from a place where the lock is already held. However, `readInvalidDerivation` implicitely assumes that the store is a `LocalFSStore`, which isn't always the case. The concrete motivation for this is that it's required for `nix copy --from someBinaryCache` to work, which is tremendously useful for the tests.
2020-12-02read(): Use char * instead of unsigned char *Eelco Dolstra
This gets rid of some pointless casts.
2020-12-02Sink: Use std::string_viewEelco Dolstra
2020-07-31Merge remote-tracking branch 'origin/master' into markdownEelco Dolstra
2020-07-31Enable syntax highlightingEelco Dolstra
2020-07-30unsigned long long -> uint64_tEelco Dolstra
2020-07-30receiveContents(): unsigned int -> size_tEelco Dolstra
2020-07-13NarAccessor: Run in constant memoryEelco Dolstra
2020-04-21remove 'format' from Error constructor callsBen Burdette
2017-12-07Provide random access to cached NARsEelco Dolstra
E.g. $ time nix cat-store --store https://cache.nixos.org?local-nar-cache=/tmp/nars \ /nix/store/b0w2hafndl09h64fhb86kw6bmhbmnpm1-blender-2.79/share/icons/hicolor/scalable/apps/blender.svg > /dev/null real 0m4.139s $ time nix cat-store --store https://cache.nixos.org?local-nar-cache=/tmp/nars \ /nix/store/b0w2hafndl09h64fhb86kw6bmhbmnpm1-blender-2.79/share/icons/hicolor/scalable/apps/blender.svg > /dev/null real 0m0.024s (Before, the second call took ~0.220s.) This will use a NAR listing in /tmp/nars/b0w2hafndl09h64fhb86kw6bmhbmnpm1.ls containing all metadata, including the offsets of regular files inside the NAR. Thus, we don't need to read the entire NAR. (We do read the entire listing, but that's generally pretty small. We could use a SQLite DB by borrowing some more code from nixos-channel-scripts/file-cache.hh.) This is primarily useful when Hydra is serving files from an S3 binary cache, in particular when you have giant NARs. E.g. we had some 12 GiB NARs, so accessing individuals files was pretty slow.
2017-12-07nix ls-{nar,store}: Return offset of files in the NAR if knownEelco Dolstra
E.g. $ nix ls-store --json --recursive --store https://cache.nixos.org /nix/store/b0w2hafndl09h64fhb86kw6bmhbmnpm1-blender-2.79 \ | jq .entries.bin.entries.blender.narOffset 400
2017-11-14nix ls-{nar,store}: Don't abort on missing filesEelco Dolstra
2017-11-14nix ls-{nar,store} --json: Respect -REelco Dolstra
2017-11-14nix ls-{store,nar}: Add --json flagEelco Dolstra
2017-07-30Replace Unicode quotes in user-facing strings by ASCIIJörg Thalheim
Relevant RFC: NixOS/rfcs#4 $ ag -l | xargs sed -i -e "/\"/s/’/'/g;/\"/s/‘/'/g"
2017-05-15nar-accessor.cc: remove unused member NarIndexer::currentNameBenno Fünfstück
2017-05-15nar-accessor: non-recursive NarMember::findBenno Fünfstück
This avoids a possible stack overflow if directories are very deeply nested.
2017-05-15nar-accessor: use tree, fixes readDirectory missing childrenBenno Fünfstück
Previously, if a directory `foo` existed and a file `foo-` (where `-` is any character that is sorted before `/`), then `readDirectory` would return an empty list. To fix this, we now use a tree where we can just access the children of the node, and do not need to rely on sorting behavior to list the contents of a directory.
2016-12-08Fix warning on 32-bit systemsEelco Dolstra
http://hydra.nixos.org/build/44628517
2016-11-26Revert "Get rid of unicode quotes (#1140)"Eelco Dolstra
This reverts commit f78126bfd6b6c8477fcdbc09b2f98772dbe9a1e7. There really is no need for such a massive change...
2016-11-25Get rid of unicode quotes (#1140)Guillaume Maudoux
2016-08-10NarAccessor: Fix handling of non-executable filesEelco Dolstra
2016-03-15Fix Darwin buildEelco Dolstra
http://hydra.nixos.org/build/33279996
2016-02-26Remove bad assertionEelco Dolstra
2016-02-25Add NAR / Store accessor abstractionEelco Dolstra
This is primary to allow hydra-queue-runner to extract files like "nix-support/hydra-build-products" from NARs in binary caches.