-
Notifications
You must be signed in to change notification settings - Fork 13
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 #19 from rwth-acis/development
Development
- Loading branch information
Showing
148 changed files
with
7,657 additions
and
5,777 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
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
Binary file not shown.
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
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
32 changes: 32 additions & 0 deletions
32
src/main/java/i5/las2peer/api/StorageCollisionHandler.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,32 @@ | ||
package i5.las2peer.api; | ||
|
||
import java.io.Serializable; | ||
import java.security.PublicKey; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
import i5.las2peer.api.exceptions.StopMergingException; | ||
import i5.las2peer.persistency.Envelope; | ||
|
||
/** | ||
* This interface can be used to implement a handler that is called if a collision occurs during a store operation. | ||
*/ | ||
public interface StorageCollisionHandler { | ||
|
||
/** | ||
* This method is called if an envelope is already known for the given identifier and version. | ||
* | ||
* @param toStore This is the envelope that was requested to be stored in the network. | ||
* @param inNetwork This is the colliding envelope that was fetched from the network. | ||
* @param numberOfCollisions This is an increasing counter on how often this method was called. It should be a hint | ||
* to the developer to reconsider his storage structure if this value reaches often high values. | ||
* @return Returns the merged content from both envelopes, which is automatically wrapped in a new store operation. | ||
* @throws StopMergingException If there should be made no further merging attempt. | ||
*/ | ||
public Serializable onCollision(Envelope toStore, Envelope inNetwork, long numberOfCollisions) | ||
throws StopMergingException; | ||
|
||
public List<PublicKey> mergeReaders(HashMap<PublicKey, byte[]> toStoreReaders, | ||
HashMap<PublicKey, byte[]> inNetworkReaders); | ||
|
||
} |
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,17 @@ | ||
package i5.las2peer.api; | ||
|
||
import i5.las2peer.persistency.Envelope; | ||
|
||
/** | ||
* This interface can be used to implement a handler that receives successfully fetched envelopes from the network. | ||
*/ | ||
public interface StorageEnvelopeHandler { | ||
|
||
/** | ||
* This method is called if the envelope was successfully fetched from the network. | ||
* | ||
* @param result The envelope that was retrieved from the network. | ||
*/ | ||
public void onEnvelopeReceived(Envelope result); | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/i5/las2peer/api/StorageExceptionHandler.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,17 @@ | ||
package i5.las2peer.api; | ||
|
||
/** | ||
* This interface can be used to implement a handler that recieves exceptions occurring during network operations. | ||
* | ||
*/ | ||
public interface StorageExceptionHandler { | ||
|
||
/** | ||
* This method is called in its own thread to handle the given exception. | ||
* | ||
* @param e An execption that occurred during a network operation. Usually the reason or metadata should be known | ||
* from the surrounding context and should be provided to this handler, too. | ||
*/ | ||
public void onException(Exception e); | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/i5/las2peer/api/StorageStoreResultHandler.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 i5.las2peer.api; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* This interface can be used to implement a handler that receives the result from a store operation. | ||
*/ | ||
public interface StorageStoreResultHandler { | ||
|
||
/** | ||
* This method is called in its own thread to handle the result of a store operation. | ||
* | ||
* @param serializable The serializable that was stored in the network. | ||
* @param successfulOperations The number of successful insert operations (replications). | ||
*/ | ||
public void onResult(Serializable serializable, int successfulOperations); | ||
|
||
} |
Oops, something went wrong.