use of com.hazelcast.internal.services.ObjectNamespace in project hazelcast by hazelcast.
the class CacheReplicationOperation method prepare.
public final void prepare(CachePartitionSegment segment, Collection<ServiceNamespace> namespaces, int replicaIndex) {
for (ServiceNamespace namespace : namespaces) {
ObjectNamespace ns = (ObjectNamespace) namespace;
ICacheRecordStore recordStore = segment.getRecordStore(ns.getObjectName());
if (recordStore == null) {
continue;
}
CacheConfig cacheConfig = recordStore.getConfig();
if (cacheConfig.getTotalBackupCount() >= replicaIndex) {
storeRecordsToReplicate(recordStore);
}
}
configs.addAll(segment.getCacheConfigs());
nearCacheStateHolder.prepare(segment, namespaces);
classesAlwaysAvailable = segment.getCacheService().getNodeEngine().getTenantControlService().getTenantControlFactory().isClassesAlwaysAvailable();
}
use of com.hazelcast.internal.services.ObjectNamespace in project hazelcast by hazelcast.
the class CacheNearCacheStateHolder method prepare.
void prepare(CachePartitionSegment segment, Collection<ServiceNamespace> namespaces) {
ICacheService cacheService = segment.getCacheService();
MetaDataGenerator metaData = getPartitionMetaDataGenerator(cacheService);
int partitionId = segment.getPartitionId();
partitionUuid = metaData.getOrCreateUuid(partitionId);
List<Object> nameSeqPairs = new ArrayList<>(namespaces.size());
for (ServiceNamespace namespace : namespaces) {
ObjectNamespace ns = (ObjectNamespace) namespace;
String cacheName = ns.getObjectName();
nameSeqPairs.add(cacheName);
nameSeqPairs.add(metaData.currentSequence(cacheName, partitionId));
}
cacheNameSequencePairs = nameSeqPairs;
}
use of com.hazelcast.internal.services.ObjectNamespace in project hazelcast by hazelcast.
the class MapReplicationStateHolder method prepare.
void prepare(PartitionContainer container, Collection<ServiceNamespace> namespaces, int replicaIndex) {
storesByMapName = createHashMap(namespaces.size());
loaded = createHashMap(namespaces.size());
mapIndexInfos = new ArrayList<>(namespaces.size());
for (ServiceNamespace namespace : namespaces) {
ObjectNamespace mapNamespace = (ObjectNamespace) namespace;
String mapName = mapNamespace.getObjectName();
RecordStore recordStore = container.getExistingRecordStore(mapName);
if (recordStore == null) {
continue;
}
MapContainer mapContainer = recordStore.getMapContainer();
MapConfig mapConfig = mapContainer.getMapConfig();
if (mapConfig.getTotalBackupCount() < replicaIndex) {
continue;
}
loaded.put(mapName, recordStore.isLoaded());
storesByMapName.put(mapName, recordStore);
statsByMapName.put(mapName, mapContainer.getMapServiceContext().getLocalMapStatsProvider().getLocalMapStatsImpl(mapName).getReplicationStats());
Set<IndexConfig> indexConfigs = new HashSet<>();
if (mapContainer.isGlobalIndexEnabled()) {
// global-index
final Indexes indexes = mapContainer.getIndexes();
for (Index index : indexes.getIndexes()) {
indexConfigs.add(index.getConfig());
}
indexConfigs.addAll(indexes.getIndexDefinitions());
} else {
// partitioned-index
final Indexes indexes = mapContainer.getIndexes(container.getPartitionId());
if (indexes != null && indexes.haveAtLeastOneIndexOrDefinition()) {
for (Index index : indexes.getIndexes()) {
indexConfigs.add(index.getConfig());
}
indexConfigs.addAll(indexes.getIndexDefinitions());
}
}
MapIndexInfo mapIndexInfo = new MapIndexInfo(mapName);
mapIndexInfo.addIndexCofigs(indexConfigs);
mapIndexInfos.add(mapIndexInfo);
}
}
use of com.hazelcast.internal.services.ObjectNamespace in project hazelcast by hazelcast.
the class MapNearCacheStateHolder method prepare.
void prepare(PartitionContainer container, Collection<ServiceNamespace> namespaces) {
MapService mapService = container.getMapService();
MetaDataGenerator metaData = getPartitionMetaDataGenerator(mapService);
int partitionId = container.getPartitionId();
partitionUuid = metaData.getOrCreateUuid(partitionId);
List<Object> nameSeqPairs = new ArrayList<>(namespaces.size());
for (ServiceNamespace namespace : namespaces) {
ObjectNamespace mapNamespace = (ObjectNamespace) namespace;
String mapName = mapNamespace.getObjectName();
nameSeqPairs.add(mapName);
nameSeqPairs.add(metaData.currentSequence(mapName, partitionId));
}
mapNameSequencePairs = nameSeqPairs;
}
use of com.hazelcast.internal.services.ObjectNamespace in project hazelcast by hazelcast.
the class RingbufferService method prepareReplicationOperation.
@Override
public Operation prepareReplicationOperation(PartitionReplicationEvent event, Collection<ServiceNamespace> namespaces) {
int partitionId = event.getPartitionId();
Map<ObjectNamespace, RingbufferContainer> partitionContainers = containers.get(partitionId);
if (isNullOrEmpty(partitionContainers)) {
return null;
}
Map<ObjectNamespace, RingbufferContainer> migrationData = new HashMap<>();
for (ServiceNamespace namespace : namespaces) {
ObjectNamespace ns = (ObjectNamespace) namespace;
RingbufferContainer container = partitionContainers.get(ns);
if (container != null && container.getConfig().getTotalBackupCount() >= event.getReplicaIndex()) {
migrationData.put(ns, container);
}
}
if (migrationData.isEmpty()) {
return null;
}
return new ReplicationOperation(migrationData, event.getPartitionId(), event.getReplicaIndex());
}
Aggregations