Interface StorageCollisionHandler

All Known Implementing Classes:

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<> mergeReaders​(java.util.Set<> toStoreReaders, java.util.Set<> inNetworkReaders) 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 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.
      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 the merged content from both envelopes, which is automatically wrapped in a new store operation.
      StopMergingException - If there should be made no further merging attempt.
    • mergeReaders

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

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