importPaths(): Fix accessor support for Hydra
This commit is contained in:
parent
b0f7f9c98f
commit
629ab80022
4 changed files with 27 additions and 7 deletions
|
@ -318,4 +318,12 @@ ref<FSAccessor> BinaryCacheStore::getFSAccessor()
|
|||
std::dynamic_pointer_cast<BinaryCacheStore>(shared_from_this())));
|
||||
}
|
||||
|
||||
void BinaryCacheStore::addPathToAccessor(ref<FSAccessor> accessor,
|
||||
const Path & storePath, const ref<std::string> & data)
|
||||
{
|
||||
auto accessor_ = accessor.dynamic_pointer_cast<BinaryCacheStoreAccessor>();
|
||||
if (accessor_)
|
||||
accessor_->nars.emplace(storePath, makeNarAccessor(data));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -134,6 +134,12 @@ public:
|
|||
|
||||
ref<FSAccessor> getFSAccessor() override;
|
||||
|
||||
private:
|
||||
|
||||
void addPathToAccessor(ref<FSAccessor>, const Path & storePath, const ref<std::string> & data) override;
|
||||
|
||||
public:
|
||||
|
||||
void addSignatures(const Path & storePath, const StringSet & sigs) override
|
||||
{ notImpl(); }
|
||||
|
||||
|
|
|
@ -119,13 +119,8 @@ Paths Store::importPaths(Source & source, std::shared_ptr<FSAccessor> accessor,
|
|||
|
||||
addToStore(info, *tee.data, false, dontCheckSigs);
|
||||
|
||||
// FIXME: implement accessors?
|
||||
assert(!accessor);
|
||||
#if 0
|
||||
auto accessor_ = std::dynamic_pointer_cast<BinaryCacheStoreAccessor>(accessor);
|
||||
if (accessor_)
|
||||
accessor_->nars.emplace(info.path, makeNarAccessor(tee.data));
|
||||
#endif
|
||||
if (accessor)
|
||||
addPathToAccessor(ref<FSAccessor>(accessor), info.path, tee.data);
|
||||
|
||||
res.push_back(info.path);
|
||||
}
|
||||
|
|
|
@ -461,6 +461,17 @@ public:
|
|||
/* Return an object to access files in the Nix store. */
|
||||
virtual ref<FSAccessor> getFSAccessor() = 0;
|
||||
|
||||
private:
|
||||
|
||||
/* Inform an accessor about the NAR contents of a store path. Used
|
||||
by importPaths() to speed up subsequent access to the imported
|
||||
paths when used with binary cache stores. */
|
||||
virtual void addPathToAccessor(ref<FSAccessor>, const Path & storePath, const ref<std::string> & data)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/* Add signatures to the specified store path. The signatures are
|
||||
not verified. */
|
||||
virtual void addSignatures(const Path & storePath, const StringSet & sigs) = 0;
|
||||
|
|
Loading…
Reference in a new issue