@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 |
NEW_SYNC_REPLICATION_STATE_ZNODE |
static byte[] |
NONE_STATE_ZNODE_BYTES |
static String |
PEERS_STATE_ZNODE |
static String |
PEERS_STATE_ZNODE_DEFAULT |
static String |
PEERS_ZNODE |
static String |
PEERS_ZNODE_DEFAULT |
static String |
SYNC_REPLICATION_STATE_ZNODE |
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,
SyncReplicationState syncReplicationState)
Add a replication peer.
|
String |
getNewSyncReplicationStateNode(String peerId) |
ReplicationPeerConfig |
getPeerConfig(String peerId)
Get the peer config of a replication peer.
|
SyncReplicationState |
getPeerNewSyncReplicationState(String peerId)
Get the new sync replication state.
|
String |
getPeerNode(String peerId) |
String |
getPeerStateNode(String peerId) |
SyncReplicationState |
getPeerSyncReplicationState(String peerId)
Get the sync replication state.
|
String |
getSyncReplicationStateNode(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 |
setPeerNewSyncReplicationState(String peerId,
SyncReplicationState state)
Set the new sync replication state that we are going to transit to.
|
void |
setPeerState(String peerId,
boolean enabled)
Set the state of peer,
true to ENABLED, otherwise to DISABLED. |
void |
transitPeerSyncReplicationState(String peerId)
Overwrite the sync replication state with the new sync replication state which is set with the
ReplicationPeerStorage.setPeerNewSyncReplicationState(String, SyncReplicationState) method above, and clear
the new sync replication state. |
void |
updatePeerConfig(String peerId,
ReplicationPeerConfig peerConfig)
Update the config a replication peer.
|
toByteArraypublic 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
public static final String SYNC_REPLICATION_STATE_ZNODE
public static final String NEW_SYNC_REPLICATION_STATE_ZNODE
public static final byte[] NONE_STATE_ZNODE_BYTES
public ZKReplicationPeerStorage(ZKWatcher zookeeper, org.apache.hadoop.conf.Configuration conf)
public void addPeer(String peerId, ReplicationPeerConfig peerConfig, boolean enabled, SyncReplicationState syncReplicationState) throws ReplicationException
ReplicationPeerStorageaddPeer in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public void removePeer(String peerId) throws ReplicationException
ReplicationPeerStorageremovePeer in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public void setPeerState(String peerId, boolean enabled) throws ReplicationException
ReplicationPeerStoragetrue to ENABLED, otherwise to DISABLED.setPeerState in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public void updatePeerConfig(String peerId, ReplicationPeerConfig peerConfig) throws ReplicationException
ReplicationPeerStorageupdatePeerConfig in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public List<String> listPeerIds() throws ReplicationException
ReplicationPeerStoragelistPeerIds in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public boolean isPeerEnabled(String peerId) throws ReplicationException
ReplicationPeerStorageisPeerEnabled in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public ReplicationPeerConfig getPeerConfig(String peerId) throws ReplicationException
ReplicationPeerStoragegetPeerConfig in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public void setPeerNewSyncReplicationState(String peerId, SyncReplicationState state) throws ReplicationException
ReplicationPeerStoragesetPeerNewSyncReplicationState in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public void transitPeerSyncReplicationState(String peerId) throws ReplicationException
ReplicationPeerStorageReplicationPeerStorage.setPeerNewSyncReplicationState(String, SyncReplicationState) method above, and clear
the new sync replication state.transitPeerSyncReplicationState in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public SyncReplicationState getPeerNewSyncReplicationState(String peerId) throws ReplicationException
ReplicationPeerStorageSyncReplicationState.NONE if we are not
in a transition.getPeerNewSyncReplicationState in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public SyncReplicationState getPeerSyncReplicationState(String peerId) throws ReplicationException
ReplicationPeerStoragegetPeerSyncReplicationState in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.