public class Replication extends Object implements PeerMapChangeListener
| Constructor and Description |
|---|
Replication(ReplicationStorage replicationStorage,
PeerAddress selfAddress,
PeerMap peerMap,
int replicationFactor)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addResponsibilityListener(ResponsibilityListener responsibilityListener)
Add responsibility listener.
|
int |
getReplicationFactor() |
boolean |
isReplicationEnabled()
Checks if the user enabled replication.
|
void |
peerInserted(PeerAddress peerAddress,
boolean verified)
This method is called if a peer is added to the map.
|
void |
peerRemoved(PeerAddress peerAddress,
PeerStatatistic peerStatatistic)
This method is called if a peer is removed from the map.
|
void |
peerUpdated(PeerAddress peerAddress,
PeerStatatistic peerStatatistic)
This method is called if a peer is updated.
|
void |
removeResponsibilityListener(ResponsibilityListener responsibilityListener)
Remove a responsibility listener.
|
void |
setReplicationFactor(int replicationFactor) |
void |
updateAndNotifyResponsibilities(Number160 locationKey)
Update responsibilities.
|
public Replication(ReplicationStorage replicationStorage, PeerAddress selfAddress, PeerMap peerMap, int replicationFactor)
replicationStorage - The interface where we shore the replication responsibilitiesselfAddress - My address to know for what my peer is responsiblepeerMap - The map of my neighborsreplicationFactor - The replication factorpublic void setReplicationFactor(int replicationFactor)
replicationFactor - Set the replication factorpublic int getReplicationFactor()
public boolean isReplicationEnabled()
public void addResponsibilityListener(ResponsibilityListener responsibilityListener)
responsibilityListener - The responsibility listener.public void removeResponsibilityListener(ResponsibilityListener responsibilityListener)
responsibilityListener - The responsibility listener.public void updateAndNotifyResponsibilities(Number160 locationKey)
locationKey - The location key.public void peerInserted(PeerAddress peerAddress, boolean verified)
PeerMapChangeListenerpeerInserted in interface PeerMapChangeListenerpeerAddress - The peer that has been added.verified - True if the peer was inserted in the verified mappublic void peerRemoved(PeerAddress peerAddress, PeerStatatistic peerStatatistic)
PeerMapChangeListenerpeerRemoved in interface PeerMapChangeListenerpeerAddress - The peer that has been removed and add to the cache.peerStatatistic - Contains information statistical informationpublic void peerUpdated(PeerAddress peerAddress, PeerStatatistic peerStatatistic)
PeerMapChangeListenerpeerUpdated in interface PeerMapChangeListenerpeerAddress - The peer can change its IP and some statistical datapeerStatatistic - Contains information statistical informationCopyright © 2014. All rights reserved.