diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-07-15 23:14:30 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2020-07-15 23:14:30 +0000 |
commit | bc109648c41f8021707b55b815e68a890a09f2f6 (patch) | |
tree | 635ef505da707b6ea12262c82963fdb59db78b0e /src/libutil/serialise.cc | |
parent | 64b7421741110b28d4b31bfed3b2ff3ddb2234c2 (diff) |
Get rid of `LocalStore::addToStoreCommon`
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.
Diffstat (limited to 'src/libutil/serialise.cc')
-rw-r--r-- | src/libutil/serialise.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libutil/serialise.cc b/src/libutil/serialise.cc index 141e9e976..4c72dc9f2 100644 --- a/src/libutil/serialise.cc +++ b/src/libutil/serialise.cc @@ -329,5 +329,18 @@ void StringSink::operator () (const unsigned char * data, size_t len) s->append((const char *) data, len); } +size_t ChainSource::read(unsigned char * data, size_t len) +{ + if (useSecond) { + return source2.read(data, len); + } else { + try { + return source1.read(data, len); + } catch (EndOfFile &) { + useSecond = true; + return this->read(data, len); + } + } +} } |