Merge pull request #10764 from obsidiansystems/machine-ctor-field-comments

Document field being initialized in `Machine` constructor
This commit is contained in:
John Ericson 2024-05-23 11:53:21 -04:00 committed by GitHub
commit 0f9099b517
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -168,14 +168,24 @@ static Machine parseBuilderLine(const std::set<std::string> & defaultSystems, co
if (!isSet(0))
throw FormatError("bad machine specification: store URL was not found at the first column of a row: '%s'", line);
// TODO use designated initializers, once C++ supports those with
// custom constructors.
return {
// `storeUri`
tokens[0],
// `systemTypes`
isSet(1) ? tokenizeString<std::set<std::string>>(tokens[1], ",") : defaultSystems,
// `sshKey`
isSet(2) ? tokens[2] : "",
// `maxJobs`
isSet(3) ? parseUnsignedIntField(3) : 1U,
// `speedFactor`
isSet(4) ? parseFloatField(4) : 1.0f,
// `supportedFeatures`
isSet(5) ? tokenizeString<std::set<std::string>>(tokens[5], ",") : std::set<std::string>{},
// `mandatoryFeatures`
isSet(6) ? tokenizeString<std::set<std::string>>(tokens[6], ",") : std::set<std::string>{},
// `sshPublicHostKey`
isSet(7) ? ensureBase64(7) : ""
};
}