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)
This method is called if a peer is added to the map
|
void |
peerRemoved(PeerAddress peerAddress)
This method is called if a peer is removed from the map
|
void |
peerUpdated(PeerAddress peerAddress)
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)
PeerMapChangeListener
peerInserted
in interface PeerMapChangeListener
peerAddress
- The peer that has been added.public void peerRemoved(PeerAddress peerAddress)
PeerMapChangeListener
peerRemoved
in interface PeerMapChangeListener
peerAddress
- The peer that has been removed and add to the cache.public void peerUpdated(PeerAddress peerAddress)
PeerMapChangeListener
peerUpdated
in interface PeerMapChangeListener
peerAddress
- The peer can change its IP and some statistical dataCopyright © 2013. All Rights Reserved.