Interface IracVersionGenerator

All Superinterfaces:
Lifecycle
All Known Implementing Classes:
DefaultIracVersionGenerator, NoOpIracVersionGenerator

public interface IracVersionGenerator extends Lifecycle
A version generator for the IRAC protocol.

The version is segment based and the new version is also after than the previous one.

Since:
11.0
Author:
Pedro Ruivo
  • Method Details

    • generateNewMetadata

      IracMetadata generateNewMetadata(int segment)
      Generates a new IracMetadata for a given segment.

      The IracEntryVersion created is always higher than the previous one for the same segment.

      Parameters:
      segment - The segment.
      Returns:
      The IracMetadata created.
    • generateMetadataWithCurrentVersion

      IracMetadata generateMetadataWithCurrentVersion(int segment)
      Generate a new IracMetadata for a given segment.

      The IracEntryVersion created will be the same as the previous one for the same segment. If there was no version prior then it will create an initial version.

      Parameters:
      segment - The segment.
      Returns:
      The IracMetadata created.
    • generateNewMetadata

      IracMetadata generateNewMetadata(int segment, IracEntryVersion versionSeen)
      Same as generateNewMetadata(int) but it makes sure the new version is higher than versionSeen.
      Parameters:
      segment - The segment.
      versionSeen - The IracEntryVersion seen before. Can be null.
      Returns:
      The IracMetadata created.
    • updateVersion

      void updateVersion(int segment, IracEntryVersion remoteVersion)
      Updates the version for the segment with a new remoteVersion seen.

      This method should merge both the current version internally stored and the remoteVersion to achieve an IracEntryVersion higher than both.

      Parameters:
      segment - The segment.
      remoteVersion - The remote IracEntryVersion received.
    • onTopologyChange

      void onTopologyChange(CacheTopology newTopology)
      Invoked when a topology change occurs in the cluster.
      Parameters:
      newTopology - The new CacheTopology