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