blob: ff9c049456d8395f10c732d2b0da6be6828a4374 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.nodeagent;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
public enum NodeAgentTask {
// The full task name is prefixed with 'node>', e.g. 'node>DiskCleanup'
DiskCleanup,
CoreDumps,
CredentialsMaintainer,
AclMaintainer;
private static final Map<String, NodeAgentTask> tasksByName = Arrays.stream(NodeAgentTask.values())
.collect(Collectors.toUnmodifiableMap(NodeAgentTask::taskName, n -> n));
private final String taskName;
NodeAgentTask() {
this.taskName = "node>" + name();
}
public String taskName() { return taskName; }
public static Set<NodeAgentTask> fromString(List<String> tasks) {
return tasks.stream().filter(tasksByName::containsKey).map(tasksByName::get).collect(Collectors.toUnmodifiableSet());
}
}
|