Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericson2314 committed Jul 16, 2024
1 parent e733f6d commit 7f52356
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/libstore/dummy-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ struct DummyStoreConfig : virtual StoreConfig {
#include "dummy-store.md"
;
}

static std::set<std::string> uriSchemes() {
return {"dummy"};
}
};

struct DummyStore : public virtual DummyStoreConfig, public virtual Store
Expand Down Expand Up @@ -50,10 +54,6 @@ struct DummyStore : public virtual DummyStoreConfig, public virtual Store
return Trusted;
}

static std::set<std::string> uriSchemes() {
return {"dummy"};
}

std::optional<StorePath> queryPathFromHashPart(const std::string & hashPart) override
{ unsupported("queryPathFromHashPart"); }

Expand Down
2 changes: 0 additions & 2 deletions src/libstore/ssh-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ class SSHStore : public virtual SSHStoreConfig, public virtual RemoteStore
{
}

static std::set<std::string> uriSchemes() { return {"ssh-ng"}; }

std::string getUri() override
{
return *uriSchemes().begin() + "://" + host;
Expand Down
5 changes: 5 additions & 0 deletions src/libstore/ssh-store.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ struct SSHStoreConfig : virtual RemoteStoreConfig, virtual CommonSSHStoreConfig
return "Experimental SSH Store";
}

static std::set<std::string> uriSchemes()
{
return {"ssh-ng"};
}

std::string doc() override;
};

Expand Down
6 changes: 5 additions & 1 deletion src/libstore/store-api.hh
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ public:

virtual ~Store() { }

/**
* @todo move to `StoreConfig` one we store enough information in
* those to recover the scheme and authority in all cases.
*/
virtual std::string getUri() = 0;

/**
Expand Down Expand Up @@ -897,7 +901,7 @@ struct Implementations
{
if (!registered) registered = new std::vector<StoreFactory>();
StoreFactory factory{
.uriSchemes = T::uriSchemes(),
.uriSchemes = TConfig::uriSchemes(),
.create =
([](auto scheme, auto uri, auto & params)
-> std::shared_ptr<Store>
Expand Down
6 changes: 3 additions & 3 deletions src/libstore/uds-remote-store.hh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ struct UDSRemoteStoreConfig : virtual LocalFSStoreConfig, virtual RemoteStoreCon
*/
std::optional<std::string> path;

static std::set<std::string> uriSchemes()
{ return {scheme}; }

protected:
static constexpr char const * scheme = "unix";
};
Expand All @@ -60,9 +63,6 @@ public:

std::string getUri() override;

static std::set<std::string> uriSchemes()
{ return {scheme}; }

ref<SourceAccessor> getFSAccessor(bool requireValidPath = true) override
{ return LocalFSStore::getFSAccessor(requireValidPath); }

Expand Down

0 comments on commit 7f52356

Please sign in to comment.