Interface StorageCollisionHandler

All Known Implementing Classes:
StoreProcessHelper

public interface StorageCollisionHandler
This interface can be used to implement a handler that is called if a collision occurs during a store operation.
  • Method Summary

    Modifier and Type Method Description
    java.util.Set<java.lang.String> mergeGroups​(java.util.Set<java.lang.String> toStoreGroups, java.util.Set<java.lang.String> inNetworkGroups)  
    java.util.Set<java.security.PublicKey> mergeReaders​(java.util.Set<java.security.PublicKey> toStoreReaders, java.util.Set<java.security.PublicKey> inNetworkReaders)  
    java.io.Serializable onCollision​(EnvelopeVersion toStore, EnvelopeVersion inNetwork, long numberOfCollisions)
    This method is called if an envelope is already known for the given identifier and version.
  • Method Details

    • onCollision

      java.io.Serializable onCollision​(EnvelopeVersion toStore, EnvelopeVersion inNetwork, long numberOfCollisions) throws StopMergingException
      This method is called if an envelope is already known for the given identifier and version.
      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

      java.util.Set<java.security.PublicKey> mergeReaders​(java.util.Set<java.security.PublicKey> toStoreReaders, java.util.Set<java.security.PublicKey> inNetworkReaders)
    • mergeGroups

      java.util.Set<java.lang.String> mergeGroups​(java.util.Set<java.lang.String> toStoreGroups, java.util.Set<java.lang.String> inNetworkGroups)