Package org.infinispan.xsite.irac
Interface IracManager
- All Known Implementing Classes:
DefaultIracManager,NoOpIracManager
public interface IracManager
It manages the keys changed in the local cluster and sends to all asynchronous backup configured.
The lockOwner is the last command (or transaction) who updated the key. It is used to detect conflicting
local updates while sending to the remote backups (sites).
- Since:
- 11.0
- Author:
- Pedro Ruivo
-
Method Summary
Modifier and TypeMethodDescriptionChecks if the given key is expired on all other sites.booleancontainsKey(Object key) Checks if the key is present.voidIncrease the count of conflicts if merge policy discard update (local value wins)voidIncrease the count of conflicts if merge policy created a new value (merge remote value with local value)voidIncrease the count of conflicts if merge policy applies update (remote value wins)voidIncrease the count of discards.voidonTopologyUpdate(CacheTopology oldCacheTopology, CacheTopology newCacheTopology) Notifies a topology changed.voidreceiveState(int segment, Object key, Object lockOwner, IracMetadata tombstone) Receives the state related to thekey.voidremoveState(IracManagerKeyInfo state) Removes the state associated to a single key.voidrequestState(Address requestor, IntSet segments) Requests the state stored in this instance for the givensegments.voidtrackClear(boolean sendClear) Sets all keys as removed.voidtrackExpiredKey(int segment, Object key, Object lockOwner) Similar totrackUpdatedKey(int, Object, Object)but it tracks expired keys instead.trackForStateTransfer(Collection<XSiteState> stateList) Tracks a set of keys to be sent to the remote site.voidtrackUpdatedKey(int segment, Object key, Object lockOwner) Sets thekeyas changed by thelockOwner.
-
Method Details
-
trackUpdatedKey
Sets thekeyas changed by thelockOwner.- Parameters:
segment- The key's segment.key- The key changed.lockOwner- The lock owner who updated the key.
-
trackExpiredKey
Similar totrackUpdatedKey(int, Object, Object)but it tracks expired keys instead.Expired key need a different conflict resolution algorithm since remove expired should never win any conflict.
- Parameters:
segment- The key's segment.key- The key expired.lockOwner- The lock owner who updated the key.
-
trackForStateTransfer
Tracks a set of keys to be sent to the remote site.There is no much difference between this method and
trackUpdatedKey(int, Object, Object). It just returns aCompletionStageto notify when the keys were sent. It is required by the cross-site state transfer protocol to know when it has finish.- Parameters:
stateList- The list ofXSiteState.- Returns:
- A
CompletionStagewhich is completed when all the keys instateListhave been sent to the remote site.
-
trackClear
void trackClear(boolean sendClear) Sets all keys as removed.- Parameters:
sendClear- iftrue, anIracClearKeysRequestis sent to the backup sites.
-
removeState
Removes the state associated to a single key.- Parameters:
state- The state to remove.
-
onTopologyUpdate
Notifies a topology changed.- Parameters:
oldCacheTopology- The oldCacheTopology.newCacheTopology- The newCacheTopology.
-
requestState
Requests the state stored in this instance for the givensegments.- Parameters:
requestor- The requestor.segments- The segments requested.
-
receiveState
Receives the state related to thekey.- Parameters:
segment- The key's segment.key- The key modified.lockOwner- The lastlockOwner.tombstone- The tombstone (can benull)
-
checkAndTrackExpiration
Checks if the given key is expired on all other sites. If the key is expired on all other sites this will return true- Parameters:
key- The key to check if it is expired or not- Returns:
- Whether this key is expired on all other sites
-
incrementNumberOfDiscards
void incrementNumberOfDiscards()Increase the count of discards. -
incrementNumberOfConflictLocalWins
void incrementNumberOfConflictLocalWins()Increase the count of conflicts if merge policy discard update (local value wins) -
incrementNumberOfConflictRemoteWins
void incrementNumberOfConflictRemoteWins()Increase the count of conflicts if merge policy applies update (remote value wins) -
incrementNumberOfConflictMerged
void incrementNumberOfConflictMerged()Increase the count of conflicts if merge policy created a new value (merge remote value with local value) -
containsKey
Checks if the key is present.A key is present as long as its latest update was not confirmed by all remote sites.
- Parameters:
key- The key to check.- Returns:
trueif the key is present.
-