public class PartitionReplicaManager extends Object implements PartitionReplicaVersionManager
| Modifier and Type | Method and Description | 
|---|---|
| void | clearPartitionReplicaVersions(int partitionId,
                             ServiceNamespace namespace) | 
| void | clearReplicaSyncRequest(int partitionId,
                       ServiceNamespace namespace,
                       int replicaIndex)Resets the state of the replica synchronization request for the given partition and replica. | 
| void | finalizeReplicaSync(int partitionId,
                   int replicaIndex,
                   ServiceNamespace namespace,
                   long[] versions)Set the new replica versions for the partition with the  partitionIdand reset any ongoing replica
 synchronization request for this partition and replica index. | 
| Collection<ServiceNamespace> | getNamespaces(int partitionId)Returns all registered namespaces for given partition ID | 
| long[] | getPartitionReplicaVersions(int partitionId,
                           ServiceNamespace namespace)Returns replica versions for given partition and namespace. | 
| ServiceNamespace | getServiceNamespace(Operation operation)Returns  ServiceNamespacefor given operation. | 
| long[] | incrementPartitionReplicaVersions(int partitionId,
                                 ServiceNamespace namespace,
                                 int backupCount)Increments replica versions for given partition and namespace by the number of backup count. | 
| boolean | isPartitionReplicaVersionDirty(int partitionId,
                              ServiceNamespace namespace) | 
| boolean | isPartitionReplicaVersionStale(int partitionId,
                              ServiceNamespace namespace,
                              long[] versions,
                              int replicaIndex)Returns whether given replica version is behind the current version or not. | 
| void | releaseReplicaSyncPermit() | 
| void | retainNamespaces(int partitionId,
                Set<ServiceNamespace> namespaces) | 
| void | setPartitionReplicaVersions(int partitionId,
                           ServiceNamespace namespace,
                           long[] versions,
                           int replicaOffset) | 
| void | triggerPartitionReplicaSync(int partitionId,
                           Collection<ServiceNamespace> namespaces,
                           int replicaIndex)This method is called on a backup node (replica). | 
| boolean | tryToAcquireReplicaSyncPermit() | 
| void | updatePartitionReplicaVersions(int partitionId,
                              ServiceNamespace namespace,
                              long[] versions,
                              int replicaIndex)Updates the partition replica version and triggers replica sync if the replica is dirty (e.g. | 
public void triggerPartitionReplicaSync(int partitionId,
                                        Collection<ServiceNamespace> namespaces,
                                        int replicaIndex)
delayMillis is greater than 0partitionId - the partition which is being synchronizednamespaces - namespaces of partition replica fragmentsreplicaIndex - the index of the replica which is being synchronizedIllegalArgumentException - if the replica index is not between 0 and InternalPartition.MAX_REPLICA_COUNTpublic ServiceNamespace getServiceNamespace(Operation operation)
PartitionReplicaVersionManagerServiceNamespace for given operation. If operation is instance of
 ServiceNamespaceAware then ServiceNamespaceAware.getServiceNamespace()
 will be used. Otherwise NonFragmentedServiceNamespace will be returned.getServiceNamespace in interface PartitionReplicaVersionManageroperation - operationpublic long[] incrementPartitionReplicaVersions(int partitionId,
                                                ServiceNamespace namespace,
                                                int backupCount)
PartitionReplicaVersionManagerincrementPartitionReplicaVersions in interface PartitionReplicaVersionManagerpartitionId - partition IDnamespace - replica namespacebackupCount - number of desired backupspublic void updatePartitionReplicaVersions(int partitionId,
                                           ServiceNamespace namespace,
                                           long[] versions,
                                           int replicaIndex)
PartitionReplicaVersionManagerupdatePartitionReplicaVersions in interface PartitionReplicaVersionManagerpartitionId - the ID of the partition for which we received a new versionnamespace - replica namespaceversions - the received replica versionsreplicaIndex - the index of this replicapublic boolean isPartitionReplicaVersionStale(int partitionId,
                                              ServiceNamespace namespace,
                                              long[] versions,
                                              int replicaIndex)
PartitionReplicaVersionManagerisPartitionReplicaVersionStale in interface PartitionReplicaVersionManagerpartitionId - partition IDnamespace - replica namespaceversions - replica versionsreplicaIndex - specific replica indexpublic boolean isPartitionReplicaVersionDirty(int partitionId,
                                              ServiceNamespace namespace)
public long[] getPartitionReplicaVersions(int partitionId,
                                          ServiceNamespace namespace)
PartitionReplicaVersionManagergetPartitionReplicaVersions in interface PartitionReplicaVersionManagerpartitionId - partition IDnamespace - replica namespacepublic void setPartitionReplicaVersions(int partitionId,
                                        ServiceNamespace namespace,
                                        long[] versions,
                                        int replicaOffset)
public void clearPartitionReplicaVersions(int partitionId,
                                          ServiceNamespace namespace)
public void finalizeReplicaSync(int partitionId,
                                int replicaIndex,
                                ServiceNamespace namespace,
                                long[] versions)
partitionId and reset any ongoing replica
 synchronization request for this partition and replica index.partitionId - the partition IDreplicaIndex - the index of the replicaversions - the new replica versions for the partitionpublic void clearReplicaSyncRequest(int partitionId,
                                    ServiceNamespace namespace,
                                    int replicaIndex)
partitionId - the partition being synchronizednamespace - namespacereplicaIndex - the index of the replica being synchronizedpublic boolean tryToAcquireReplicaSyncPermit()
public void releaseReplicaSyncPermit()
public Collection<ServiceNamespace> getNamespaces(int partitionId)
PartitionReplicaVersionManagergetNamespaces in interface PartitionReplicaVersionManagerpartitionId - partition IDpublic void retainNamespaces(int partitionId,
                             Set<ServiceNamespace> namespaces)
Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.