aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/serialise.hh
AgeCommit message (Collapse)Author
2023-04-14Merge pull request #8176 from tweag/rename-confusing-write-methodEelco Dolstra
Rename and protect `BufferedSink::write`
2023-04-07Always disable GC in a coroutine unless the patch is appliedYorick van Pelt
2023-04-07DisableGC: replace by CoroutineContext, std::shared_ptr<void>Yorick van Pelt
2023-04-07Disable GC inside coroutines on mac OSYorick van Pelt
2023-04-07Rename and protect `BufferedSink::write`Théophane Hufschmitt
The `write` name is ambiguous and could lead to some funny bugs like https://github.com/NixOS/nix/pull/8173#issuecomment-1500009480. So rename it to the more explicit `writeUnbuffered`. Besides, this method shouldn't be (and isn't) used outside of the class implementation, so mark it `protected`. This makes it more symetrical to `BufferedSource` which uses a `protected readUnbuffered` method.
2023-03-31Ensure all headers have `#pragma once` and are in API docsJohn Ericson
`///@file` makes them show up in the internal API dos. A tiny few were missing `#pragma once`.
2023-03-31Extend internal API docs, part 2John Ericson
Picking up from #8111. Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2023-03-08Revert "Disable GC during coroutine execution + test"Théophane Hufschmitt
2023-03-01Always disable GC in a coroutine unless the patch is appliedYorick van Pelt
2023-03-01DisableGC: replace by CoroutineContext, std::shared_ptr<void>Yorick van Pelt
2023-03-01Disable GC inside coroutines on mac OSYorick van Pelt
2022-12-07Trivial changes from the lazy-trees branchEelco Dolstra
2022-08-17Remove warnLargeDump()Eelco Dolstra
This message was unhelpful (#1184) and probably misleading since memory is O(1) in most cases now.
2022-02-25Remove std::string alias (for real this time)Eelco Dolstra
Also use std::string_view in a few more places.
2022-01-18Get rid of std::shared_ptr<std::string> and ref<std::string>Eelco Dolstra
These were needed back in the pre-C++11 era because we didn't have move semantics. But now we do.
2022-01-17StringSource: Use std::string_viewEelco Dolstra
2022-01-17serialise.hh: Use std::string_viewEelco Dolstra
2021-03-10Use libarchive for all compressionYorick van Pelt
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-10-30Fix memory corruption caused by GC-invisible coroutine stacksRobert Hensing
Crucially this introduces BoehmGCStackAllocator, but it also adds a bunch of wiring to avoid making libutil depend on bdw-gc. Part of the solutions for #4178, #4200
2020-10-07Serialize exceptions from the sandbox process to the parentEelco Dolstra
Fixes #4118.
2020-09-22Merge branch 'add-ca-to-store' of https://github.com/hercules-ci/nixEelco Dolstra
2020-09-22Silence a compiler warning in serialise.hhregnat
Explicitely cast to `uint64_t` in `readNum` to avoid a "comparison between signed and unsigned" warning
2020-09-21Move FramedSink next to FramedSourceRobert Hensing
2020-09-17Move FramedSource and FramedSink, extract withFramedSinkRobert Hensing
2020-09-17Add Source.drainInto(Sink)Robert Hensing
2020-08-28Merge remote-tracking branch 'upstream/master' into single-ca-drv-buildJohn Ericson
2020-08-27TypoEelco Dolstra
2020-08-27RemoteStore::addToStore(): Fix race between stderrThread and NAR writerEelco Dolstra
As pointed out by @B4dM4n, the call to to.flush() on stderrThread is unsafe because the NAR writer thread is also writing to 'to'. Fixes #3943.
2020-08-14Merge remote-tracking branch 'upstream/master' into single-ca-drv-buildJohn Ericson
2020-08-13Use `TeeSink` and `TeeSouce` in a few more placesJohn Ericson
2020-08-07Squashed get CA derivations buildingJohn Ericson
2020-07-30unsigned long long -> uint64_tEelco Dolstra
2020-07-16Fix bug in TeeSourceJohn Ericson
We use this to simplify `LocalStore::addToStoreFromDump`. Also, hope I fixed build error with old clang (used in Darwin CI).
2020-07-15Revert "LocalStore::addToStoreFromDump copy in chunks"John Ericson
This reverts commit 592851fb67cd15807109d6f65fb81f6af89af966. We don't need this extra feature anymore
2020-07-15Get rid of `LocalStore::addToStoreCommon`John Ericson
I got it to just become `LocalStore::addToStoreFromDump`, cleanly taking a store and then doing nothing too fancy with it. `LocalStore::addToStore(...Path...)` is now just a simple wrapper with a bare-bones sinkToSource of the right dump command.
2020-07-14LocalStore::addToStoreFromDump copy in chunksJohn Ericson
Rather than copying byte-by-byte, we let the coroutine know how much data we would like it to send back to us.
2020-07-13Make 'nix copy' to s3:// binary caches run in constant memoryEelco Dolstra
2020-07-13NarAccessor: Run in constant memoryEelco Dolstra
2020-07-13Make 'nix copy' to file:// binary caches run in constant memoryEelco Dolstra
2020-04-29Remove the `drain` argument from `readFile`Guillaume Bouchard
Now it is always `drain` (see previous commit).
2019-11-26Drop remaining uses of external "tar"Eelco Dolstra
Also, fetchGit now runs in O(1) memory since we pipe the output of 'git archive' directly into unpackTarball() (rather than first reading it all into memory).
2019-11-10Fix extra ; warnings involving MakeErrorJohn Ericson
2019-10-21Allow content-addressable paths to have referencesEelco Dolstra
This adds a command 'nix make-content-addressable' that rewrites the specified store paths into content-addressable paths. The advantage of such paths is that 1) they can be imported without signatures; 2) they can enable deduplication in cases where derivation changes do not cause output changes (apart from store path hashes). For example, $ nix make-content-addressable -r nixpkgs.cowsay rewrote '/nix/store/g1g31ah55xdia1jdqabv1imf6mcw0nb1-glibc-2.25-49' to '/nix/store/48jfj7bg78a8n4f2nhg269rgw1936vj4-glibc-2.25-49' ... rewrote '/nix/store/qbi6rzpk0bxjw8lw6azn2mc7ynnn455q-cowsay-3.03+dfsg1-16' to '/nix/store/iq6g2x4q62xp7y7493bibx0qn5w7xz67-cowsay-3.03+dfsg1-16' We can then copy the resulting closure to another store without signatures: $ nix copy --trusted-public-keys '' ---to ~/my-nix /nix/store/iq6g2x4q62xp7y7493bibx0qn5w7xz67-cowsay-3.03+dfsg1-16 In order to support self-references in content-addressable paths, these paths are hashed "modulo" self-references, meaning that self-references are zeroed out during hashing. Somewhat annoyingly, this means that the NAR hash stored in the Nix database is no longer necessarily equal to the output of "nix hash-path"; for content-addressable paths, you need to pass the --modulo flag: $ nix path-info --json /nix/store/iq6g2x4q62xp7y7493bibx0qn5w7xz67-cowsay-3.03+dfsg1-16 | jq -r .[].narHash sha256:0ri611gdilz2c9rsibqhsipbfs9vwcqvs811a52i2bnkhv7w9mgw $ nix hash-path --type sha256 --base32 /nix/store/iq6g2x4q62xp7y7493bibx0qn5w7xz67-cowsay-3.03+dfsg1-16 1ggznh07khq0hz6id09pqws3a8q9pn03ya3c03nwck1kwq8rclzs $ nix hash-path --type sha256 --base32 /nix/store/iq6g2x4q62xp7y7493bibx0qn5w7xz67-cowsay-3.03+dfsg1-16 --modulo iq6g2x4q62xp7y7493bibx0qn5w7xz67 0ri611gdilz2c9rsibqhsipbfs9vwcqvs811a52i2bnkhv7w9mgw
2019-08-16libutil: add SizedSourcezimbatm
Introduce the SizeSource which allows to bound how much data is being read from a source. It also contains a drainAll() function to discard the rest of the source, useful to keep the nix protocol in sync.
2018-09-26Make NAR header check more robustEelco Dolstra
Changes std::bad_alloc into bad archive: input doesn't look like a Nix archive
2018-08-21Improve 'coroutine has finished' error messageEelco Dolstra
2018-05-21serialise: fix buffer size used, hide method for internal use onlyWill Dietz
Fixes #2169.
2018-05-02Fix some random -Wconversion warningsEelco Dolstra