summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/search/TransactionLogServer.java
blob: a364c129a07c004105ef369ab8d631245c6c7b10 (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
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.search;

import com.yahoo.searchlib.TranslogserverConfig;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.vespa.model.AbstractService;
import com.yahoo.vespa.model.builder.xml.dom.VespaDomBuilder;
import org.w3c.dom.Element;

/**
 * @author hmusum
 */
public class TransactionLogServer extends AbstractService  {

    private static final long serialVersionUID = 1L;

    public TransactionLogServer(AbstractConfigProducer searchNode, String clusterName) {
        super(searchNode, "transactionlogserver");
        portsMeta.on(0).tag("tls");
        setProp("clustername", clusterName);
        setProp("clustertype", "search");
    }

    public static class Builder extends VespaDomBuilder.DomConfigProducerBuilder<TransactionLogServer> {
        private final String clusterName;
        public Builder(String clusterName) {
            this.clusterName = clusterName;
        }

        @Override
        protected TransactionLogServer doBuild(AbstractConfigProducer ancestor, Element producerSpec) {
            return new TransactionLogServer(ancestor, clusterName);
        }
    }

    public int getPortCount() {
        return 1;
    }

    /**
     * Returns the port used by the TLS.
     *
     * @return The port.
     */
    public int getTlsPort() {
        return getRelativePort(0);
    }

    /**
     * Returns the directory used by the TLS.
     *
     * @return The directory.
     */
    private String getTlsDir() {
        return "tls";
    }

    public void getConfig(TranslogserverConfig.Builder builder) {
        builder.listenport(getTlsPort()).basedir(getTlsDir());
    }

}