use of com.hazelcast.ringbuffer.impl.operations.ReplicationOperation in project hazelcast by hazelcast.
the class RingbufferService method prepareReplicationOperation.
@Override
public Operation prepareReplicationOperation(PartitionReplicationEvent event) {
Map<String, RingbufferContainer> migrationData = new HashMap<String, RingbufferContainer>();
IPartitionService partitionService = nodeEngine.getPartitionService();
for (Map.Entry<String, RingbufferContainer> entry : containers.entrySet()) {
String name = entry.getKey();
int partitionId = partitionService.getPartitionId(getPartitionKey(name));
RingbufferContainer container = entry.getValue();
int backupCount = container.getConfig().getTotalBackupCount();
if (partitionId == event.getPartitionId() && backupCount >= event.getReplicaIndex()) {
migrationData.put(name, container);
}
}
if (migrationData.isEmpty()) {
return null;
}
return new ReplicationOperation(migrationData, event.getPartitionId(), event.getReplicaIndex());
}
Aggregations