public class Replication extends Object implements PeerMapChangeListener, ReplicationListener
| Constructor and Description |
|---|
Replication(StorageLayer backend,
PeerAddress selfAddress,
PeerMap peerMap,
int replicationFactor,
boolean nRoot,
boolean keepData)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addResponsibilityListener(ResponsibilityListener responsibilityListener)
Add responsibility listener.
|
void |
dataInserted(Number160 locationKey)
Update responsibilities.
|
void |
dataRemoved(Number160 locationKey) |
boolean |
is0RootReplication() |
boolean |
isKeepingData() |
boolean |
isNRootReplication() |
boolean |
isReplication()
Checks if the user enabled replication.
|
void |
keepData(boolean keepData) |
void |
nRootReplication(boolean nRootReplication) |
void |
peerInserted(PeerAddress peerAddress,
boolean verified) |
void |
peerRemoved(PeerAddress peerAddress,
PeerStatatistic peerStatatistic) |
void |
peerUpdated(PeerAddress peerAddress,
PeerStatatistic peerStatatistic) |
void |
removeResponsibilityListener(ResponsibilityListener responsibilityListener)
Remove a responsibility listener.
|
int |
replicationFactor() |
Replication |
replicationFactor(int replicationFactor) |
public Replication(StorageLayer backend, PeerAddress selfAddress, PeerMap peerMap, int replicationFactor, boolean nRoot, boolean keepData)
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 factornRoot - true for n-root replication, false for 0-root replicationkeepData - flag indicating if data will be kept in memory after loss of replication responsibilitypublic Replication replicationFactor(int replicationFactor)
public int replicationFactor()
public void nRootReplication(boolean nRootReplication)
nRootReplication - flag
Set true for n-root replication or false for 0-root replication.public boolean isNRootReplication()
true if n-root replication is enabledpublic boolean is0RootReplication()
true if 0-root replication is enabledpublic void keepData(boolean keepData)
keepData - flag
If true data will be kept in memory after loosing replication responsibility.
If false data will be deleted.public boolean isKeepingData()
true if data will keep in memory after loosing replication responsibilitypublic boolean isReplication()
public void addResponsibilityListener(ResponsibilityListener responsibilityListener)
responsibilityListener - The responsibility listener.public void removeResponsibilityListener(ResponsibilityListener responsibilityListener)
responsibilityListener - The responsibility listener.public void dataRemoved(Number160 locationKey)
dataRemoved in interface ReplicationListenerpublic void dataInserted(Number160 locationKey)
dataInserted in interface ReplicationListenerlocationKey - The location key.public void peerInserted(PeerAddress peerAddress, boolean verified)
peerInserted in interface PeerMapChangeListenerpublic void peerRemoved(PeerAddress peerAddress, PeerStatatistic peerStatatistic)
peerRemoved in interface PeerMapChangeListenerpublic void peerUpdated(PeerAddress peerAddress, PeerStatatistic peerStatatistic)
peerUpdated in interface PeerMapChangeListenerCopyright © 2014. All rights reserved.