| 1226 | |
| 1227 | |
| 1228 | Option<Error> validateResources(const ExecutorInfo& executor) |
| 1229 | { |
| 1230 | Option<Error> error = resource::validate(executor.resources()); |
| 1231 | if (error.isSome()) { |
| 1232 | return Error("Executor uses invalid resources: " + error->message); |
| 1233 | } |
| 1234 | |
| 1235 | const Resources& resources = executor.resources(); |
| 1236 | |
| 1237 | error = resource::validateUniquePersistenceID(resources); |
| 1238 | if (error.isSome()) { |
| 1239 | return Error( |
| 1240 | "Executor uses duplicate persistence ID: " + error->message); |
| 1241 | } |
| 1242 | |
| 1243 | error = resource::validateAllocatedToSingleRole(resources); |
| 1244 | if (error.isSome()) { |
| 1245 | return Error("Invalid executor resources: " + error->message); |
| 1246 | } |
| 1247 | |
| 1248 | error = resource::validateRevocableAndNonRevocableResources(resources); |
| 1249 | if (error.isSome()) { |
| 1250 | return Error("Executor mixes revocable and non-revocable resources: " + |
| 1251 | error->message); |
| 1252 | } |
| 1253 | |
| 1254 | return None(); |
| 1255 | } |
| 1256 | |
| 1257 | |
| 1258 | // Validates the `CommandInfo` contained within an `ExecutorInfo`. |