aboutsummaryrefslogtreecommitdiffstats
path: root/zookeeper-server/zookeeper-server-common/src/main/java/com/yahoo/vespa/zookeeper/VespaZooKeeperAdmin.java
blob: a9096125cbad90e7c9105f61465ac9beca3d8a29 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.zookeeper;

import com.yahoo.cloud.config.ZookeeperServerConfig;
import com.yahoo.net.HostName;
import java.time.Duration;

/**
 * Interface for administering a zookeeper cluster. Currently only supports reconfiguring a zookeeper cluster.
 *
 * @author hmusum
 */
public interface VespaZooKeeperAdmin {

    void reconfigure(String connectionSpec, String servers) throws ReconfigException;

    /* Timeout for connecting to ZooKeeper */
    default Duration sessionTimeout() { return Duration.ofSeconds(30); }

    default String localConnectionSpec(ZookeeperServerConfig config) { return HostName.getLocalhost() + ":" + config.clientPort(); }

}