1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-30 14:10:59 +01:00

Add InputAccessor::fetchToStore()

This commit is contained in:
Eelco Dolstra 2022-08-11 20:03:22 +02:00
parent c0d33087c8
commit 2e0d63caf6
6 changed files with 59 additions and 27 deletions

View file

@ -4,12 +4,16 @@
#include "types.hh"
#include "archive.hh"
#include "canon-path.hh"
#include "repair-flag.hh"
namespace nix {
MakeError(RestrictedPathError, Error);
struct SourcePath;
struct StorePath;
class Store;
enum RepairFlag;
struct InputAccessor : public std::enable_shared_from_this<InputAccessor>
{
@ -52,6 +56,13 @@ struct InputAccessor : public std::enable_shared_from_this<InputAccessor>
Sink & sink,
PathFilter & filter = defaultPathFilter);
StorePath fetchToStore(
ref<Store> store,
const CanonPath & path,
std::string_view name,
PathFilter * filter = nullptr,
RepairFlag repair = NoRepair);
/* Return a corresponding path in the root filesystem, if
possible. This is only possible for inputs that are
materialized in the root filesystem. */
@ -124,6 +135,12 @@ struct SourcePath
PathFilter & filter = defaultPathFilter) const
{ return accessor->dumpPath(path, sink, filter); }
StorePath fetchToStore(
ref<Store> store,
std::string_view name,
PathFilter * filter = nullptr,
RepairFlag repair = NoRepair) const;
std::optional<CanonPath> getPhysicalPath() const
{ return accessor->getPhysicalPath(path); }