@InterfaceAudience.Private public class ZKReplicationPeerStorage extends ZKReplicationStorageBase implements ReplicationPeerStorage
Modifier and Type | Field and Description |
---|---|
static byte[] |
DISABLED_ZNODE_BYTES |
static byte[] |
ENABLED_ZNODE_BYTES |
static String |
PEERS_STATE_ZNODE |
static String |
PEERS_STATE_ZNODE_DEFAULT |
static String |
PEERS_ZNODE |
static String |
PEERS_ZNODE_DEFAULT |
private String |
peerStateNodeName
The name of the znode that contains the replication status of a remote slave (i.e.
|
private String |
peersZNode
The name of the znode that contains a list of all remote slave (i.e.
|
conf, REPLICATION_ZNODE, REPLICATION_ZNODE_DEFAULT, replicationZNode, zookeeper
Constructor and Description |
---|
ZKReplicationPeerStorage(ZKWatcher zookeeper,
org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
void |
addPeer(String peerId,
ReplicationPeerConfig peerConfig,
boolean enabled)
Add a replication peer.
|
ReplicationPeerConfig |
getPeerConfig(String peerId)
Get the peer config of a replication peer.
|
String |
getPeerNode(String peerId) |
String |
getPeerStateNode(String peerId) |
boolean |
isPeerEnabled(String peerId)
Test whether a replication peer is enabled.
|
List<String> |
listPeerIds()
Return the peer ids of all replication peers.
|
void |
removePeer(String peerId)
Remove a replication peer.
|
void |
setPeerState(String peerId,
boolean enabled)
Set the state of peer,
true to ENABLED , otherwise to DISABLED . |
void |
updatePeerConfig(String peerId,
ReplicationPeerConfig peerConfig)
Update the config a replication peer.
|
toByteArray
public static final String PEERS_ZNODE
public static final String PEERS_ZNODE_DEFAULT
public static final String PEERS_STATE_ZNODE
public static final String PEERS_STATE_ZNODE_DEFAULT
public static final byte[] ENABLED_ZNODE_BYTES
public static final byte[] DISABLED_ZNODE_BYTES
private final String peerStateNodeName
private final String peersZNode
public ZKReplicationPeerStorage(ZKWatcher zookeeper, org.apache.hadoop.conf.Configuration conf)
public String getPeerStateNode(String peerId)
public String getPeerNode(String peerId)
public void addPeer(String peerId, ReplicationPeerConfig peerConfig, boolean enabled) throws ReplicationException
ReplicationPeerStorage
addPeer
in interface ReplicationPeerStorage
ReplicationException
- if there are errors accessing the storage service.public void removePeer(String peerId) throws ReplicationException
ReplicationPeerStorage
removePeer
in interface ReplicationPeerStorage
ReplicationException
- if there are errors accessing the storage service.public void setPeerState(String peerId, boolean enabled) throws ReplicationException
ReplicationPeerStorage
true
to ENABLED
, otherwise to DISABLED
.setPeerState
in interface ReplicationPeerStorage
ReplicationException
- if there are errors accessing the storage service.public void updatePeerConfig(String peerId, ReplicationPeerConfig peerConfig) throws ReplicationException
ReplicationPeerStorage
updatePeerConfig
in interface ReplicationPeerStorage
ReplicationException
- if there are errors accessing the storage service.public List<String> listPeerIds() throws ReplicationException
ReplicationPeerStorage
listPeerIds
in interface ReplicationPeerStorage
ReplicationException
- if there are errors accessing the storage service.public boolean isPeerEnabled(String peerId) throws ReplicationException
ReplicationPeerStorage
isPeerEnabled
in interface ReplicationPeerStorage
ReplicationException
- if there are errors accessing the storage service.public ReplicationPeerConfig getPeerConfig(String peerId) throws ReplicationException
ReplicationPeerStorage
getPeerConfig
in interface ReplicationPeerStorage
ReplicationException
- if there are errors accessing the storage service.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.