2018-02-21 15:22:49 +00:00
|
|
|
#include "command.hh"
|
|
|
|
#include "shared.hh"
|
|
|
|
#include "store-api.hh"
|
|
|
|
|
|
|
|
using namespace nix;
|
|
|
|
|
|
|
|
struct CmdPingStore : StoreCommand
|
|
|
|
{
|
|
|
|
std::string description() override
|
|
|
|
{
|
2020-12-09 16:55:59 +00:00
|
|
|
return "test whether a store can be accessed";
|
2018-02-21 15:22:49 +00:00
|
|
|
}
|
|
|
|
|
2020-12-09 16:55:59 +00:00
|
|
|
std::string doc() override
|
2018-02-21 15:22:49 +00:00
|
|
|
{
|
2020-12-09 16:55:59 +00:00
|
|
|
return
|
|
|
|
#include "ping-store.md"
|
|
|
|
;
|
2018-02-21 15:22:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void run(ref<Store> store) override
|
|
|
|
{
|
2022-01-25 20:14:27 +00:00
|
|
|
notice("Store URL: %s", store->getUri());
|
2018-02-21 15:22:49 +00:00
|
|
|
store->connect();
|
2022-01-25 20:14:27 +00:00
|
|
|
if (auto version = store->getVersion())
|
|
|
|
notice("Version: %s", *version);
|
2018-02-21 15:22:49 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-07-24 18:38:56 +00:00
|
|
|
static auto rCmdPingStore = registerCommand2<CmdPingStore>({"store", "ping"});
|