use of com.hazelcast.query.impl.MapIndexInfo in project hazelcast by hazelcast.
the class MapReplicationStateHolder method writeData.
@Override
public void writeData(ObjectDataOutput out) throws IOException {
out.writeInt(storesByMapName.size());
for (Map.Entry<String, RecordStore<Record>> entry : storesByMapName.entrySet()) {
String mapName = entry.getKey();
RecordStore<Record> recordStore = entry.getValue();
out.writeString(mapName);
writeRecordStore(mapName, recordStore, out);
recordStore.getStats().writeData(out);
}
out.writeInt(loaded.size());
for (Map.Entry<String, Boolean> loadedEntry : loaded.entrySet()) {
out.writeString(loadedEntry.getKey());
out.writeBoolean(loadedEntry.getValue());
}
out.writeInt(mapIndexInfos.size());
for (MapIndexInfo mapIndexInfo : mapIndexInfos) {
out.writeObject(mapIndexInfo);
}
}
use of com.hazelcast.query.impl.MapIndexInfo 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.query.impl.MapIndexInfo in project hazelcast by hazelcast.
the class MapReplicationStateHolder method readData.
@Override
public void readData(ObjectDataInput in) throws IOException {
int size = in.readInt();
data = createHashMap(size);
merkleTreeDiffByMapName = new HashMap<>();
recordStoreStatsPerMapName = createHashMap(size);
for (int i = 0; i < size; i++) {
String mapName = in.readString();
boolean differentialReplication = in.readBoolean();
if (differentialReplication) {
readDifferentialData(mapName, in);
} else {
readRecordStoreData(mapName, in);
}
}
int loadedSize = in.readInt();
loaded = createHashMap(loadedSize);
for (int i = 0; i < loadedSize; i++) {
loaded.put(in.readString(), in.readBoolean());
}
int mapIndexInfoSize = in.readInt();
mapIndexInfos = new ArrayList<>(mapIndexInfoSize);
for (int i = 0; i < mapIndexInfoSize; i++) {
MapIndexInfo mapIndexInfo = in.readObject();
mapIndexInfos.add(mapIndexInfo);
}
}
use of com.hazelcast.query.impl.MapIndexInfo in project hazelcast by hazelcast.
the class MapChunkContext method createMapIndexInfo.
public final MapIndexInfo createMapIndexInfo() {
MapContainer mapContainer = recordStore.getMapContainer();
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(partitionId);
if (indexes != null && indexes.haveAtLeastOneIndexOrDefinition()) {
for (Index index : indexes.getIndexes()) {
indexConfigs.add(index.getConfig());
}
indexConfigs.addAll(indexes.getIndexDefinitions());
}
}
return new MapIndexInfo(mapName).addIndexCofigs(indexConfigs);
}
use of com.hazelcast.query.impl.MapIndexInfo in project hazelcast by hazelcast.
the class MapDataSerializerHook method createFactory.
@Override
public DataSerializableFactory createFactory() {
ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructors = new ConstructorFunction[LEN];
constructors[PUT] = arg -> new PutOperation();
constructors[GET] = arg -> new GetOperation();
constructors[REMOVE] = arg -> new RemoveOperation();
constructors[PUT_BACKUP] = arg -> new PutBackupOperation();
constructors[REMOVE_BACKUP] = arg -> new RemoveBackupOperation();
constructors[EVICT_BACKUP] = arg -> new EvictBackupOperation();
constructors[CREATE_ACCUMULATOR_INFO] = arg -> new AccumulatorInfo();
constructors[DATA_COLLECTION] = arg -> new DataCollection();
constructors[ENTRIES] = arg -> new MapEntries();
constructors[ENTRY_VIEW] = arg -> (IdentifiedDataSerializable) EntryViews.createSimpleEntryView();
constructors[QUERY_RESULT_ROW] = arg -> new QueryResultRow();
constructors[QUERY_RESULT] = arg -> new QueryResult();
constructors[CONTAINS_KEY] = arg -> new ContainsKeyOperation();
constructors[KEYS_WITH_CURSOR] = arg -> new MapKeysWithCursor();
constructors[ENTRIES_WITH_CURSOR] = arg -> new MapEntriesWithCursor();
constructors[SET] = arg -> new SetOperation();
constructors[LOAD_MAP] = arg -> new LoadMapOperation();
constructors[KEY_LOAD_STATUS] = arg -> new KeyLoadStatusOperation();
constructors[LOAD_ALL] = arg -> new LoadAllOperation();
constructors[ENTRY_BACKUP] = arg -> new EntryBackupOperation();
constructors[ENTRY_OPERATION] = arg -> new EntryOperation();
constructors[PUT_ALL] = arg -> new PutAllOperation();
constructors[PUT_ALL_BACKUP] = arg -> new PutAllBackupOperation();
constructors[REMOVE_IF_SAME] = arg -> new RemoveIfSameOperation();
constructors[REPLACE] = arg -> new ReplaceOperation();
constructors[SIZE] = arg -> new MapSizeOperation();
constructors[CLEAR_BACKUP] = arg -> new ClearBackupOperation();
constructors[CLEAR] = arg -> new ClearOperation();
constructors[DELETE] = arg -> new DeleteOperation();
constructors[EVICT] = arg -> new EvictOperation();
constructors[EVICT_ALL] = arg -> new EvictAllOperation();
constructors[EVICT_ALL_BACKUP] = arg -> new EvictAllBackupOperation();
constructors[GET_ALL] = arg -> new GetAllOperation();
constructors[IS_EMPTY] = arg -> new MapIsEmptyOperation();
constructors[IS_PARTITION_LOADED] = arg -> new IsPartitionLoadedOperation();
constructors[PARTITION_WIDE_ENTRY] = arg -> new PartitionWideEntryOperation();
constructors[PARTITION_WIDE_ENTRY_BACKUP] = arg -> new PartitionWideEntryBackupOperation();
constructors[PARTITION_WIDE_PREDICATE_ENTRY] = arg -> new PartitionWideEntryWithPredicateOperation();
constructors[PARTITION_WIDE_PREDICATE_ENTRY_BACKUP] = arg -> new PartitionWideEntryWithPredicateBackupOperation();
constructors[ADD_INDEX] = arg -> new AddIndexOperation();
constructors[AWAIT_MAP_FLUSH] = arg -> new AwaitMapFlushOperation();
constructors[CONTAINS_VALUE] = arg -> new ContainsValueOperation();
constructors[GET_ENTRY_VIEW] = arg -> new GetEntryViewOperation();
constructors[FETCH_ENTRIES] = arg -> new MapFetchEntriesOperation();
constructors[FETCH_KEYS] = arg -> new MapFetchKeysOperation();
constructors[FLUSH_BACKUP] = arg -> new MapFlushBackupOperation();
constructors[FLUSH] = arg -> new MapFlushOperation();
constructors[MULTIPLE_ENTRY_BACKUP] = arg -> new MultipleEntryBackupOperation();
constructors[MULTIPLE_ENTRY] = arg -> new MultipleEntryOperation();
constructors[MULTIPLE_ENTRY_PREDICATE_BACKUP] = arg -> new MultipleEntryWithPredicateBackupOperation();
constructors[MULTIPLE_ENTRY_PREDICATE] = arg -> new MultipleEntryWithPredicateOperation();
constructors[NOTIFY_MAP_FLUSH] = arg -> new NotifyMapFlushOperation();
constructors[PUT_IF_ABSENT] = arg -> new PutIfAbsentOperation();
constructors[PUT_FROM_LOAD_ALL] = arg -> new PutFromLoadAllOperation();
constructors[PUT_FROM_LOAD_ALL_BACKUP] = arg -> new PutFromLoadAllBackupOperation();
constructors[QUERY_PARTITION] = arg -> new QueryPartitionOperation();
constructors[QUERY_OPERATION] = arg -> new QueryOperation();
constructors[PUT_TRANSIENT] = arg -> new PutTransientOperation();
constructors[REPLACE_IF_SAME] = arg -> new ReplaceIfSameOperation();
constructors[TRY_PUT] = arg -> new TryPutOperation();
constructors[TRY_REMOVE] = arg -> new TryRemoveOperation();
constructors[TXN_LOCK_AND_GET] = arg -> new TxnLockAndGetOperation();
constructors[TXN_DELETE] = arg -> new TxnDeleteOperation();
constructors[TXN_PREPARE] = arg -> new TxnPrepareOperation();
constructors[TXN_PREPARE_BACKUP] = arg -> new TxnPrepareBackupOperation();
constructors[TXN_ROLLBACK] = arg -> new TxnRollbackOperation();
constructors[TXN_ROLLBACK_BACKUP] = arg -> new TxnRollbackBackupOperation();
constructors[TXN_SET] = arg -> new TxnSetOperation();
constructors[TXN_UNLOCK] = arg -> new TxnUnlockOperation();
constructors[TXN_UNLOCK_BACKUP] = arg -> new TxnUnlockBackupOperation();
constructors[IS_PARTITION_LOADED_FACTORY] = arg -> new IsPartitionLoadedOperationFactory();
constructors[ADD_INDEX_FACTORY] = arg -> new AddIndexOperationFactory();
constructors[CLEAR_FACTORY] = arg -> new ClearOperationFactory();
constructors[CONTAINS_VALUE_FACTORY] = arg -> new ContainsValueOperationFactory();
constructors[EVICT_ALL_FACTORY] = arg -> new EvictAllOperationFactory();
constructors[IS_EMPTY_FACTORY] = arg -> new IsEmptyOperationFactory();
constructors[KEY_LOAD_STATUS_FACTORY] = arg -> new KeyLoadStatusOperationFactory();
constructors[MAP_FLUSH_FACTORY] = arg -> new MapFlushOperationFactory();
constructors[MAP_GET_ALL_FACTORY] = arg -> new MapGetAllOperationFactory();
constructors[LOAD_ALL_FACTORY] = arg -> new MapLoadAllOperationFactory();
constructors[PARTITION_WIDE_ENTRY_FACTORY] = arg -> new PartitionWideEntryOperationFactory();
constructors[PARTITION_WIDE_PREDICATE_ENTRY_FACTORY] = arg -> new PartitionWideEntryWithPredicateOperationFactory();
constructors[PUT_ALL_PARTITION_AWARE_FACTORY] = arg -> new PutAllPartitionAwareOperationFactory();
constructors[SIZE_FACTORY] = arg -> new SizeOperationFactory();
constructors[MULTIPLE_ENTRY_FACTORY] = arg -> new MultipleEntryOperationFactory();
constructors[ENTRY_EVENT_FILTER] = arg -> new EntryEventFilter();
constructors[EVENT_LISTENER_FILTER] = arg -> new EventListenerFilter();
constructors[PARTITION_LOST_EVENT_FILTER] = arg -> new MapPartitionLostEventFilter();
constructors[NEAR_CACHE_SINGLE_INVALIDATION] = arg -> new SingleNearCacheInvalidation();
constructors[NEAR_CACHE_BATCH_INVALIDATION] = arg -> new BatchNearCacheInvalidation();
constructors[ADD_INTERCEPTOR] = arg -> new AddInterceptorOperation();
constructors[MAP_REPLICATION] = arg -> new MapReplicationOperation();
constructors[POST_JOIN_MAP_OPERATION] = arg -> new PostJoinMapOperation();
constructors[MAP_INDEX_INFO] = arg -> new MapIndexInfo();
constructors[INTERCEPTOR_INFO] = arg -> new PostJoinMapOperation.InterceptorInfo();
constructors[REMOVE_INTERCEPTOR] = arg -> new RemoveInterceptorOperation();
constructors[QUERY_EVENT_FILTER] = arg -> new QueryEventFilter();
constructors[UUID_FILTER] = arg -> new UuidFilter();
constructors[MAP_TRANSACTION_LOG_RECORD] = arg -> new MapTransactionLogRecord();
constructors[VERSIONED_VALUE] = arg -> new VersionedValue();
constructors[MAP_REPLICATION_STATE_HOLDER] = arg -> new MapReplicationStateHolder();
constructors[WRITE_BEHIND_STATE_HOLDER] = arg -> new WriteBehindStateHolder();
constructors[AGGREGATION_RESULT] = arg -> new AggregationResult();
constructors[QUERY] = arg -> new Query();
constructors[MAP_INVALIDATION_METADATA] = arg -> new MapGetInvalidationMetaDataOperation();
constructors[MAP_INVALIDATION_METADATA_RESPONSE] = arg -> new MapGetInvalidationMetaDataOperation.MetaDataResponse();
constructors[MAP_NEAR_CACHE_STATE_HOLDER] = arg -> new MapNearCacheStateHolder();
constructors[MAP_ASSIGN_AND_GET_UUIDS] = arg -> new MapAssignAndGetUuidsOperation();
constructors[MAP_ASSIGN_AND_GET_UUIDS_FACTORY] = arg -> new MapAssignAndGetUuidsOperationFactory();
constructors[DESTROY_QUERY_CACHE] = arg -> new DestroyQueryCacheOperation();
constructors[MADE_PUBLISHABLE] = arg -> new MadePublishableOperation();
constructors[MADE_PUBLISHABLE_FACTORY] = arg -> new MadePublishableOperationFactory();
constructors[PUBLISHER_CREATE] = arg -> new PublisherCreateOperation();
constructors[READ_AND_RESET_ACCUMULATOR] = arg -> new ReadAndResetAccumulatorOperation();
constructors[SET_READ_CURSOR] = arg -> new SetReadCursorOperation();
constructors[ACCUMULATOR_CONSUMER] = arg -> new ConsumeAccumulatorOperation();
constructors[LAZY_MAP_ENTRY] = arg -> new LazyMapEntry();
constructors[TRIGGER_LOAD_IF_NEEDED] = arg -> new TriggerLoadIfNeededOperation();
constructors[IS_KEYLOAD_FINISHED] = arg -> new IsKeyLoadFinishedOperation();
constructors[REMOVE_FROM_LOAD_ALL] = arg -> new RemoveFromLoadAllOperation();
constructors[ENTRY_REMOVING_PROCESSOR] = arg -> EntryRemovingProcessor.ENTRY_REMOVING_PROCESSOR;
constructors[ENTRY_OFFLOADABLE_SET_UNLOCK] = arg -> new EntryOffloadableSetUnlockOperation();
constructors[LOCK_AWARE_LAZY_MAP_ENTRY] = arg -> new LockAwareLazyMapEntry();
constructors[FETCH_WITH_QUERY] = arg -> new MapFetchWithQueryOperation();
constructors[RESULT_SEGMENT] = arg -> new ResultSegment();
constructors[EVICT_BATCH_BACKUP] = arg -> new EvictBatchBackupOperation();
constructors[EVENT_JOURNAL_SUBSCRIBE_OPERATION] = arg -> new MapEventJournalSubscribeOperation();
constructors[EVENT_JOURNAL_READ] = arg -> new MapEventJournalReadOperation<>();
constructors[EVENT_JOURNAL_DESERIALIZING_MAP_EVENT] = arg -> new DeserializingEventJournalMapEvent<>();
constructors[EVENT_JOURNAL_INTERNAL_MAP_EVENT] = arg -> new InternalEventJournalMapEvent();
constructors[EVENT_JOURNAL_READ_RESULT_SET] = arg -> new MapEventJournalReadResultSetImpl<>();
constructors[MERGE_FACTORY] = arg -> new MergeOperationFactory();
constructors[MERGE] = arg -> new MergeOperation();
constructors[SET_TTL] = arg -> new SetTtlOperation();
constructors[SET_TTL_BACKUP] = arg -> new SetTtlBackupOperation();
constructors[MERKLE_TREE_NODE_ENTRIES] = arg -> new MerkleTreeNodeEntries();
constructors[ADD_INDEX_BACKUP] = arg -> new AddIndexBackupOperation();
constructors[TXN_SET_BACKUP] = arg -> new TxnSetBackupOperation();
constructors[TXN_DELETE_BACKUP] = arg -> new TxnDeleteBackupOperation();
constructors[SET_WITH_EXPIRY] = arg -> new SetWithExpiryOperation();
constructors[PUT_WITH_EXPIRY] = arg -> new PutWithExpiryOperation();
constructors[PUT_TRANSIENT_WITH_EXPIRY] = arg -> new PutTransientWithExpiryOperation();
constructors[PUT_IF_ABSENT_WITH_EXPIRY] = arg -> new PutIfAbsentWithExpiryOperation();
constructors[PUT_TRANSIENT_BACKUP] = arg -> new PutTransientBackupOperation();
constructors[COMPUTE_IF_PRESENT_PROCESSOR] = arg -> new ComputeIfPresentEntryProcessor<>();
constructors[COMPUTE_IF_ABSENT_PROCESSOR] = arg -> new ComputeIfAbsentEntryProcessor<>();
constructors[KEY_VALUE_CONSUMING_PROCESSOR] = arg -> new KeyValueConsumingEntryProcessor<>();
constructors[COMPUTE_MAP_OPERATION_PROCESSOR] = arg -> new ComputeEntryProcessor<>();
constructors[MERGE_MAP_OPERATION_PROCESSOR] = arg -> new MergeEntryProcessor<>();
constructors[MAP_ENTRY_REPLACING_PROCESSOR] = arg -> new MapEntryReplacingEntryProcessor<>();
constructors[LOCAL_RECORD_STORE_STATS] = arg -> new LocalRecordStoreStatsImpl();
constructors[MAP_FETCH_INDEX_OPERATION] = arg -> new MapFetchIndexOperation();
constructors[INDEX_ITERATION_POINTER] = arg -> new IndexIterationPointer();
constructors[MAP_FETCH_INDEX_OPERATION_RESULT] = arg -> new MapFetchIndexOperationResult();
constructors[MAP_CHUNK] = arg -> new MapChunk();
return new ArrayDataSerializableFactory(constructors);
}
Aggregations