Store: expose the protocol version used by a store
This commit is contained in:
parent
c9a08540c3
commit
070823baa4
6 changed files with 29 additions and 0 deletions
|
@ -303,6 +303,12 @@ struct LegacySSHStore : public Store
|
||||||
{
|
{
|
||||||
auto conn(connections->get());
|
auto conn(connections->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int getProtocol() override
|
||||||
|
{
|
||||||
|
auto conn(connections->get());
|
||||||
|
return conn->remoteVersion;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static RegisterStoreImplementation regStore([](
|
static RegisterStoreImplementation regStore([](
|
||||||
|
|
|
@ -1332,6 +1332,12 @@ void LocalStore::verifyPath(const Path & path, const PathSet & store,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int LocalStore::getProtocol()
|
||||||
|
{
|
||||||
|
return PROTOCOL_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(FS_IOC_SETFLAGS) && defined(FS_IOC_GETFLAGS) && defined(FS_IMMUTABLE_FL)
|
#if defined(FS_IOC_SETFLAGS) && defined(FS_IOC_GETFLAGS) && defined(FS_IMMUTABLE_FL)
|
||||||
|
|
||||||
static void makeMutable(const Path & path)
|
static void makeMutable(const Path & path)
|
||||||
|
|
|
@ -209,6 +209,8 @@ public:
|
||||||
|
|
||||||
void registerValidPaths(const ValidPathInfos & infos);
|
void registerValidPaths(const ValidPathInfos & infos);
|
||||||
|
|
||||||
|
unsigned int getProtocol() override;
|
||||||
|
|
||||||
void vacuumDB();
|
void vacuumDB();
|
||||||
|
|
||||||
/* Repair the contents of the given path by redownloading it using
|
/* Repair the contents of the given path by redownloading it using
|
||||||
|
|
|
@ -646,6 +646,13 @@ void RemoteStore::connect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int RemoteStore::getProtocol()
|
||||||
|
{
|
||||||
|
auto conn(connections->get());
|
||||||
|
return conn->daemonVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void RemoteStore::flushBadConnections()
|
void RemoteStore::flushBadConnections()
|
||||||
{
|
{
|
||||||
connections->flushBad();
|
connections->flushBad();
|
||||||
|
|
|
@ -97,6 +97,8 @@ public:
|
||||||
|
|
||||||
void connect() override;
|
void connect() override;
|
||||||
|
|
||||||
|
unsigned int getProtocol() override;
|
||||||
|
|
||||||
void flushBadConnections();
|
void flushBadConnections();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -598,6 +598,12 @@ public:
|
||||||
a notion of connection. Otherwise this is a no-op. */
|
a notion of connection. Otherwise this is a no-op. */
|
||||||
virtual void connect() { };
|
virtual void connect() { };
|
||||||
|
|
||||||
|
/* Get the protocol version of this store or it's connection. */
|
||||||
|
virtual unsigned int getProtocol()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
/* Get the priority of the store, used to order substituters. In
|
/* Get the priority of the store, used to order substituters. In
|
||||||
particular, binary caches can specify a priority field in their
|
particular, binary caches can specify a priority field in their
|
||||||
"nix-cache-info" file. Lower value means higher priority. */
|
"nix-cache-info" file. Lower value means higher priority. */
|
||||||
|
|
Loading…
Reference in a new issue