Package i5.las2peer.persistency.helper
Class StoreProcessHelper
java.lang.Object
i5.las2peer.persistency.helper.StoreProcessHelper
- All Implemented Interfaces:
StorageCollisionHandler
,StorageExceptionHandler
,StorageStoreResultHandler
public class StoreProcessHelper
extends Object
implements StorageStoreResultHandler, StorageCollisionHandler, StorageExceptionHandler
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
mergeGroups
(Set<String> toStoreGroups, Set<String> inNetworkGroups) mergeReaders
(Set<PublicKey> toStoreReaders, Set<PublicKey> inNetworkReaders) onCollision
(EnvelopeVersion toStore, EnvelopeVersion inNetwork, long numberOfCollisions) This method is called if an envelope is already known for the given identifier and version.void
This method is called in its own thread to handle the given exception.void
onResult
(Serializable serializable, int successfulOperations) This method is called in its own thread to handle the result of a store operation.
-
Constructor Details
-
StoreProcessHelper
public StoreProcessHelper()
-
-
Method Details
-
onResult
Description copied from interface:StorageStoreResultHandler
This method is called in its own thread to handle the result of a store operation.- Specified by:
onResult
in interfaceStorageStoreResultHandler
- Parameters:
serializable
- The serializable that was stored in the network.successfulOperations
- The number of successful insert operations (replications).
-
onCollision
public Serializable onCollision(EnvelopeVersion toStore, EnvelopeVersion inNetwork, long numberOfCollisions) throws StopMergingException Description copied from interface:StorageCollisionHandler
This method is called if an envelope is already known for the given identifier and version.- Specified by:
onCollision
in interfaceStorageCollisionHandler
- Parameters:
toStore
- This is the envelope that was requested to be stored in the network.inNetwork
- This is the colliding envelope that was fetched from the network.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.- Returns:
- 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.
-
mergeReaders
- Specified by:
mergeReaders
in interfaceStorageCollisionHandler
-
mergeGroups
- Specified by:
mergeGroups
in interfaceStorageCollisionHandler
-
onException
Description copied from interface:StorageExceptionHandler
This method is called in its own thread to handle the given exception.- Specified by:
onException
in interfaceStorageExceptionHandler
- Parameters:
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.
-
getResult
- Throws:
Exception
-