Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from nicoruti/replication
Added possibility to filter replication
- Loading branch information
Showing
4 changed files
with
92 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
replication/src/main/java/net/tomp2p/replication/ReplicationFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package net.tomp2p.replication; | ||
|
||
import net.tomp2p.peers.PeerAddress; | ||
|
||
/** | ||
* Allows to filter peers that should not be considered for the replication | ||
* @author Nico Rutishauser | ||
* | ||
*/ | ||
public interface ReplicationFilter { | ||
|
||
boolean rejectReplication(PeerAddress targetAddress); | ||
} |
18 changes: 18 additions & 0 deletions
18
replication/src/main/java/net/tomp2p/replication/SlowReplicationFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package net.tomp2p.replication; | ||
|
||
import net.tomp2p.peers.PeerAddress; | ||
|
||
/** | ||
* Relieves slow peers from the replication duty | ||
* | ||
* @author Nico Rutishauser | ||
* | ||
*/ | ||
public class SlowReplicationFilter implements ReplicationFilter { | ||
|
||
@Override | ||
public boolean rejectReplication(PeerAddress targetAddress) { | ||
return targetAddress.isSlow(); | ||
} | ||
|
||
} |