blob: 75c10ea26672cd5c247e8667d720feaea3e47f37 (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.clients;
import com.yahoo.vespa.config.content.LoadTypeConfig;
import com.yahoo.config.model.ConfigModel;
import com.yahoo.config.model.ConfigModelContext;
import com.yahoo.config.model.ConfigModelRepo;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.documentapi.messagebus.loadtypes.LoadType;
import com.yahoo.documentapi.messagebus.loadtypes.LoadTypeSet;
import com.yahoo.vespa.model.container.ContainerCluster;
import java.util.LinkedList;
import java.util.List;
/**
* This is the clients plugin for the Vespa model. It is responsible for creating
* all clients services.
*
* @author Gunnar Gauslaa Bergem
*/
public class Clients extends ConfigModel {
private static final long serialVersionUID = 1L;
private List<VespaSpoolerService> vespaSpoolers = new LinkedList<>();
private LoadTypeSet loadTypes = new LoadTypeSet();
private final AbstractConfigProducer parent;
public Clients(ConfigModelContext modelContext) {
super(modelContext);
this.parent = modelContext.getParentProducer();
}
public AbstractConfigProducer getConfigProducer() {
return parent;
}
/** Returns the mutable list of spoolers which is then used to add spoolers */
public List<VespaSpoolerService> getVespaSpoolers() {
return vespaSpoolers;
}
public LoadTypeSet getLoadTypes() {
return loadTypes;
}
public void getConfig(LoadTypeConfig.Builder builder) {
for (LoadType t : loadTypes.getNameMap().values()) {
if (t != LoadType.DEFAULT) {
builder.type(getLoadTypeConfig(t));
}
}
}
private LoadTypeConfig.Type.Builder getLoadTypeConfig(LoadType loadType) {
LoadTypeConfig.Type.Builder builder = new LoadTypeConfig.Type.Builder();
builder.name(loadType.getName());
builder.id(loadType.getId());
builder.priority(loadType.getPriority().toString());
return builder;
}
}
|