@InterfaceAudience.Private public class ReplicationPeerImpl extends Object implements ReplicationPeer
ReplicationPeer.PeerState
Modifier and Type | Field and Description |
---|---|
private static int |
AND_BITS |
private org.apache.hadoop.conf.Configuration |
conf |
private String |
id |
private ReplicationPeerConfig |
peerConfig |
private List<ReplicationPeerConfigListener> |
peerConfigListeners |
private ReplicationPeer.PeerState |
peerState |
private static int |
SHIFT |
private int |
syncReplicationStateBits |
Constructor and Description |
---|
ReplicationPeerImpl(org.apache.hadoop.conf.Configuration conf,
String id,
ReplicationPeerConfig peerConfig,
boolean peerState,
SyncReplicationState syncReplicationState,
SyncReplicationState newSyncReplicationState)
Constructor that takes all the objects required to communicate with the specified peer, except
for the region server addresses.
|
Modifier and Type | Method and Description |
---|---|
org.apache.hadoop.conf.Configuration |
getConfiguration()
Get the configuration object required to communicate with this peer
|
String |
getId()
Get the identifier of this peer
|
Set<String> |
getNamespaces()
Get replicable namespace set of this peer
|
SyncReplicationState |
getNewSyncReplicationState() |
private static SyncReplicationState |
getNewSyncReplicationState(int bits) |
long |
getPeerBandwidth()
Get the per node bandwidth upper limit for this peer
|
ReplicationPeerConfig |
getPeerConfig()
Get the peer config object
|
ReplicationPeer.PeerState |
getPeerState()
Returns the state of the peer by reading local cache.
|
SyncReplicationState |
getSyncReplicationState()
Returns the sync replication state of the peer by reading local cache.
|
private static SyncReplicationState |
getSyncReplicationState(int bits) |
Pair<SyncReplicationState,SyncReplicationState> |
getSyncReplicationStateAndNewState() |
Map<TableName,List<String>> |
getTableCFs()
Get replicable (table, cf-list) map of this peer
|
void |
registerPeerConfigListener(ReplicationPeerConfigListener listener)
Register a peer config listener to catch the peer config change event.
|
void |
setNewSyncReplicationState(SyncReplicationState newState) |
void |
setPeerConfig(ReplicationPeerConfig peerConfig) |
void |
setPeerState(boolean enabled) |
void |
transitSyncReplicationState() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isPeerEnabled, trackPeerConfigChanges
private final org.apache.hadoop.conf.Configuration conf
private volatile ReplicationPeerConfig peerConfig
private volatile ReplicationPeer.PeerState peerState
private volatile int syncReplicationStateBits
private static final int SHIFT
private static final int AND_BITS
private final List<ReplicationPeerConfigListener> peerConfigListeners
public ReplicationPeerImpl(org.apache.hadoop.conf.Configuration conf, String id, ReplicationPeerConfig peerConfig, boolean peerState, SyncReplicationState syncReplicationState, SyncReplicationState newSyncReplicationState)
conf
- configuration object to this peerid
- string representation of this peer's identifierpeerConfig
- configuration for the replication peerpublic void setPeerState(boolean enabled)
public void setPeerConfig(ReplicationPeerConfig peerConfig)
public void setNewSyncReplicationState(SyncReplicationState newState)
public void transitSyncReplicationState()
public String getId()
getId
in interface ReplicationPeer
public ReplicationPeer.PeerState getPeerState()
ReplicationPeer
getPeerState
in interface ReplicationPeer
private static SyncReplicationState getSyncReplicationState(int bits)
private static SyncReplicationState getNewSyncReplicationState(int bits)
public Pair<SyncReplicationState,SyncReplicationState> getSyncReplicationStateAndNewState()
public SyncReplicationState getNewSyncReplicationState()
public SyncReplicationState getSyncReplicationState()
ReplicationPeer
If the peer is not a synchronous replication peer, a SyncReplicationState.NONE
will be
returned.
getSyncReplicationState
in interface ReplicationPeer
public ReplicationPeerConfig getPeerConfig()
ReplicationPeer
getPeerConfig
in interface ReplicationPeer
public org.apache.hadoop.conf.Configuration getConfiguration()
ReplicationPeer
getConfiguration
in interface ReplicationPeer
public Map<TableName,List<String>> getTableCFs()
ReplicationPeer
getTableCFs
in interface ReplicationPeer
public Set<String> getNamespaces()
ReplicationPeer
getNamespaces
in interface ReplicationPeer
public long getPeerBandwidth()
ReplicationPeer
getPeerBandwidth
in interface ReplicationPeer
public void registerPeerConfigListener(ReplicationPeerConfigListener listener)
ReplicationPeer
registerPeerConfigListener
in interface ReplicationPeer
listener
- listener to catch the peer config change event.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.