Class DefaultIracVersionGenerator
java.lang.Object
org.infinispan.container.versioning.irac.DefaultIracVersionGenerator
- All Implemented Interfaces:
Lifecycle
,IracVersionGenerator
Default implementation of
IracVersionGenerator
.- Since:
- 11.0
- Author:
- Pedro Ruivo
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongenerateMetadataWithCurrentVersion
(int segment) Generate a newIracMetadata
for a givensegment
.generateNewMetadata
(int segment) Generates a newIracMetadata
for a givensegment
.generateNewMetadata
(int segment, IracEntryVersion versionSeen) Same asIracVersionGenerator.generateNewMetadata(int)
but it makes sure the new version is higher thanversionSeen
.void
onTopologyChange
(CacheTopology newTopology) Invoked when a topology change occurs in the cluster.peek()
void
start()
Invoked on component startvoid
stop()
Invoked on component stopvoid
updateVersion
(int segment, IracEntryVersion remoteVersion) Updates the version for thesegment
with a newremoteVersion
seen.
-
Constructor Details
-
DefaultIracVersionGenerator
public DefaultIracVersionGenerator(int numberOfSegments)
-
-
Method Details
-
start
public void start()Description copied from interface:Lifecycle
Invoked on component start -
stop
public void stop()Description copied from interface:Lifecycle
Invoked on component stop -
generateNewMetadata
Description copied from interface:IracVersionGenerator
Generates a newIracMetadata
for a givensegment
.The
IracEntryVersion
created is always higher than the previous one for the samesegment
.- Specified by:
generateNewMetadata
in interfaceIracVersionGenerator
- Parameters:
segment
- The segment.- Returns:
- The
IracMetadata
created.
-
generateMetadataWithCurrentVersion
Description copied from interface:IracVersionGenerator
Generate a newIracMetadata
for a givensegment
.The
IracEntryVersion
created will be the same as the previous one for the samesegment
. If there was no version prior then it will create an initial version.- Specified by:
generateMetadataWithCurrentVersion
in interfaceIracVersionGenerator
- Parameters:
segment
- The segment.- Returns:
- The
IracMetadata
created.
-
generateNewMetadata
Description copied from interface:IracVersionGenerator
Same asIracVersionGenerator.generateNewMetadata(int)
but it makes sure the new version is higher thanversionSeen
.- Specified by:
generateNewMetadata
in interfaceIracVersionGenerator
- Parameters:
segment
- The segment.versionSeen
- TheIracEntryVersion
seen before. Can benull
.- Returns:
- The
IracMetadata
created.
-
updateVersion
Description copied from interface:IracVersionGenerator
Updates the version for thesegment
with a newremoteVersion
seen.This method should merge both the current version internally stored and the
remoteVersion
to achieve anIracEntryVersion
higher than both.- Specified by:
updateVersion
in interfaceIracVersionGenerator
- Parameters:
segment
- The segment.remoteVersion
- The remoteIracEntryVersion
received.
-
onTopologyChange
Description copied from interface:IracVersionGenerator
Invoked when a topology change occurs in the cluster.- Specified by:
onTopologyChange
in interfaceIracVersionGenerator
- Parameters:
newTopology
- The newCacheTopology
-
peek
-