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.boolean
containsKey
(Object key) Checks if the key is present.void
Increase the count of conflicts if merge policy discard update (local value wins)void
Increase the count of conflicts if merge policy created a new value (merge remote value with local value)void
Increase the count of conflicts if merge policy applies update (remote value wins)void
Increase the count of discards.void
onTopologyUpdate
(CacheTopology oldCacheTopology, CacheTopology newCacheTopology) Notifies a topology changed.void
receiveState
(int segment, Object key, Object lockOwner, IracMetadata tombstone) Receives the state related to thekey
.void
removeState
(IracManagerKeyInfo state) Removes the state associated to a single key.void
requestState
(Address requestor, IntSet segments) Requests the state stored in this instance for the givensegments
.void
trackClear
(boolean sendClear) Sets all keys as removed.void
trackExpiredKey
(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.void
trackUpdatedKey
(int segment, Object key, Object lockOwner) Sets thekey
as changed by thelockOwner
.
-
Method Details
-
trackUpdatedKey
Sets thekey
as 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 aCompletionStage
to 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
CompletionStage
which is completed when all the keys instateList
have been sent to the remote site.
-
trackClear
void trackClear(boolean sendClear) Sets all keys as removed.- Parameters:
sendClear
- iftrue
, anIracClearKeysRequest
is 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:
true
if the key is present.
-