Interface IracManager
- All Known Implementing Classes:
DefaultIracManager,NoOpIracManager
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.voidcheckStaleKeys(Address origin, Collection<IracManagerKeyInfo> keys) Checks a remote node's list ofIracManagerKeyInfofor stale or outdated entries.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.Returns aStreamcontaining all keys that have not been acknowledged by other sites.voidreceiveState(int segment, Object key, RequestUUID owner, 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, RequestUUID owner) Similar totrackUpdatedKey(int, Object, RequestUUID)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, RequestUUID owner) Sets thekeyas changed by thelockOwner.
-
Method Details
-
trackUpdatedKey
Sets thekeyas changed by thelockOwner.- Parameters:
segment- The key's segment.key- The key changed.owner- The lock owner who updated the key.
-
trackExpiredKey
Similar totrackUpdatedKey(int, Object, RequestUUID)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.owner- 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, RequestUUID). 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
-
receiveState
Receives the state related to thekey.- Parameters:
segment- The key's segment.key- The key modified.owner- 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.
-
pendingKeys
Stream<IracManagerKeyInfo> pendingKeys()Returns aStreamcontaining all keys that have not been acknowledged by other sites.This stream represents keys for which a corresponding acknowledgment has not been received from all participating sites. This can be used to identify pending operations or potential data inconsistencies.
- Returns:
- A
Streamof unacknowledged keys.
-
checkStaleKeys
Checks a remote node's list ofIracManagerKeyInfofor stale or outdated entries.This method iterates through the provided list of key information and identifies entries that are considered stale. For each stale entry found, a cleanup command is invoked to remove the corresponding key on the remote node.
- Parameters:
origin- The node that initiated the check.keys- The list of key information to be inspected for stale entries.
-