Interface IracVersionGenerator

  • All Superinterfaces:
    org.infinispan.commons.api.Lifecycle
    All Known Implementing Classes:
    DefaultIracVersionGenerator, NoOpIracVersionGenerator

    public interface IracVersionGenerator
    extends org.infinispan.commons.api.Lifecycle
    A version generator for the IRAC protocol.

    It also stores the tombstone from the keys removed.

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

    Since:
    11.0
    Author:
    Pedro Ruivo
    • Method Detail

      • generateNewMetadata

        IracMetadata generateNewMetadata​(int segment)
        Generator 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.
      • 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.
      • storeTombstone

        void storeTombstone​(Object key,
                            IracMetadata metadata)
        Stores a tombstone for a key removed.

        It overwrites any existing tombstone.

        Parameters:
        key - The key.
        metadata - The IracMetadata.
      • getTombstone

        IracMetadata getTombstone​(Object key)
        Returns the tombstone associated to the key or null if it doesn't exist.
        Parameters:
        key - The key.
        Returns:
        The tombstone.
      • removeTombstone

        void removeTombstone​(Object key,
                             IracMetadata iracMetadata)
        Removes the tombstone for key if the metadata matches.
        Parameters:
        key - The key.
        iracMetadata - The expected IracMetadata.
      • removeTombstone

        void removeTombstone​(Object key)
        Removes the tombstone for key.
        Parameters:
        key - The key.
      • onTopologyChange

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