2017-05-02 14:17:37 +03:00
|
|
|
#pragma once
|
2023-04-01 06:18:41 +03:00
|
|
|
///@file
|
2017-05-02 14:17:37 +03:00
|
|
|
|
|
|
|
#include "types.hh"
|
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
2020-08-12 19:32:36 +03:00
|
|
|
class Store;
|
|
|
|
|
2017-05-02 14:17:37 +03:00
|
|
|
struct Machine {
|
|
|
|
|
2022-02-21 17:37:25 +02:00
|
|
|
const std::string storeUri;
|
2024-01-23 19:30:26 +02:00
|
|
|
const std::set<std::string> systemTypes;
|
2022-02-21 17:37:25 +02:00
|
|
|
const std::string sshKey;
|
2017-05-02 14:17:37 +03:00
|
|
|
const unsigned int maxJobs;
|
|
|
|
const unsigned int speedFactor;
|
2022-02-21 17:37:25 +02:00
|
|
|
const std::set<std::string> supportedFeatures;
|
|
|
|
const std::set<std::string> mandatoryFeatures;
|
2017-05-02 15:36:59 +03:00
|
|
|
const std::string sshPublicHostKey;
|
2017-05-02 14:17:37 +03:00
|
|
|
bool enabled = true;
|
|
|
|
|
2024-01-23 19:50:48 +02:00
|
|
|
/**
|
|
|
|
* @return Whether `features` is a subset of the union of `supportedFeatures` and
|
|
|
|
* `mandatoryFeatures`
|
|
|
|
*/
|
2022-02-21 17:37:25 +02:00
|
|
|
bool allSupported(const std::set<std::string> & features) const;
|
2017-05-02 14:17:37 +03:00
|
|
|
|
2024-01-23 19:50:48 +02:00
|
|
|
/**
|
|
|
|
* @return @Whether `mandatoryFeatures` is a subset of `features`
|
|
|
|
*/
|
2022-02-21 17:37:25 +02:00
|
|
|
bool mandatoryMet(const std::set<std::string> & features) const;
|
2017-05-02 14:17:37 +03:00
|
|
|
|
|
|
|
Machine(decltype(storeUri) storeUri,
|
|
|
|
decltype(systemTypes) systemTypes,
|
|
|
|
decltype(sshKey) sshKey,
|
|
|
|
decltype(maxJobs) maxJobs,
|
|
|
|
decltype(speedFactor) speedFactor,
|
|
|
|
decltype(supportedFeatures) supportedFeatures,
|
2017-05-02 15:36:59 +03:00
|
|
|
decltype(mandatoryFeatures) mandatoryFeatures,
|
|
|
|
decltype(sshPublicHostKey) sshPublicHostKey);
|
2020-08-12 19:32:36 +03:00
|
|
|
|
|
|
|
ref<Store> openStore() const;
|
2017-05-02 14:17:37 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<Machine> Machines;
|
|
|
|
|
|
|
|
void parseMachines(const std::string & s, Machines & machines);
|
|
|
|
|
2017-05-02 14:44:10 +03:00
|
|
|
Machines getMachines();
|
|
|
|
|
2017-05-02 14:17:37 +03:00
|
|
|
}
|