Package com.hazelcast.query.impl

Examples of com.hazelcast.query.impl.IndexService


    public String getServiceName() {
        return MapService.SERVICE_NAME;
    }

    public void addMapIndex(MapContainer mapContainer) {
        final IndexService indexService = mapContainer.getIndexService();
        if (indexService.hasIndex()) {
            MapIndexInfo mapIndexInfo = new MapIndexInfo(mapContainer.getName());
            for (Index index : indexService.getIndexes()) {
                mapIndexInfo.addIndexInfo(index.getAttributeName(), index.isOrdered());
            }
            indexInfoList.add(mapIndexInfo);
        }
    }
View Full Code Here


    @Override
    public void run() throws Exception {
        MapService mapService = getService();
        for (MapIndexInfo mapIndex : indexInfoList) {
            final MapContainer mapContainer = mapService.getMapContainer(mapIndex.mapName);
            final IndexService indexService = mapContainer.getIndexService();
            for (MapIndexInfo.IndexInfo indexInfo : mapIndex.lsIndexes) {
                indexService.addOrGetIndex(indexInfo.attributeName, indexInfo.ordered);
            }
        }
        for (InterceptorInfo interceptorInfo : interceptorInfoList) {
            final MapContainer mapContainer = mapService.getMapContainer(interceptorInfo.mapName);
            Map<String, MapInterceptor> interceptorMap = mapContainer.getInterceptorMap();
View Full Code Here

    public void run() throws Exception {
        MapService mapService = getService();
        MapContainer mapContainer = mapService.getMapContainer(name);
        RecordStore rs = mapService.getPartitionContainer(getPartitionId()).getRecordStore(name);
        Map<Data, Record> records = rs.getReadonlyRecordMap();
        IndexService indexService = mapContainer.getIndexService();
        SerializationService ss = getNodeEngine().getSerializationService();
        Index index = indexService.addOrGetIndex(attributeName, ordered);
        for (Record record : records.values()) {
            Data key = record.getKey();
            Object value = record.getValue();
            index.saveEntryIndex(new QueryEntry(ss, key, key, value));
        }
View Full Code Here

    public QueryOperation() {
    }

    public void run() throws Exception {
        List<Integer> initialPartitions = mapService.getOwnedPartitions();
        IndexService indexService = mapService.getMapContainer(name).getIndexService();
        Set<QueryableEntry> entries = null;
        // TODO: fix
        if (!getNodeEngine().getPartitionService().hasOnGoingMigration()) {
            entries = indexService.query(predicate);
        }
        result = new QueryResult();
        if (entries != null) {
            for (QueryableEntry entry : entries) {
                result.add(new QueryResultEntryImpl(entry.getKeyData(), entry.getKeyData(), entry.getValueData()));
View Full Code Here

        final LockService lockService = nodeEngine.getSharedService(LockService.SERVICE_NAME);
        if (lockService != null) {
            final DefaultObjectNamespace namespace = new DefaultObjectNamespace(MapService.SERVICE_NAME, name);
            lockService.clearLockStore(partitionId, namespace);
        }
        final IndexService indexService = mapContainer.getIndexService();
        if (indexService.hasIndex()) {
            for (Data key : records.keySet()) {
                indexService.removeEntryIndex(key);
            }
        }
        cancelAssociatedSchedulers(records.keySet());
        clearRecordsMap(Collections.<Data, Record>emptyMap());
        resetSizeEstimator();
View Full Code Here

        }
        return oldValue;
    }

    private void removeIndex(Data key) {
        final IndexService indexService = mapContainer.getIndexService();
        if (indexService.hasIndex()) {
            indexService.removeEntryIndex(key);
        }
    }
View Full Code Here

        }
    }

    private void saveIndex(Record record) {
        Data dataKey = record.getKey();
        final IndexService indexService = mapContainer.getIndexService();
        if (indexService.hasIndex()) {
            SerializationService ss = mapService.getSerializationService();
            QueryableEntry queryableEntry = new QueryEntry(ss, dataKey, dataKey, record.getValue());
            indexService.saveEntryIndex(queryableEntry);
        }
    }
View Full Code Here

    private void migrateIndex(PartitionMigrationEvent event) {
        final PartitionContainer container = partitionContainers[event.getPartitionId()];
        for (RecordStore recordStore : container.getMaps().values()) {
            final MapContainer mapContainer = getMapContainer(recordStore.getName());
            final IndexService indexService = mapContainer.getIndexService();
            if (indexService.hasIndex()) {
                for (Record record : recordStore.getReadonlyRecordMap().values()) {
                    if (event.getMigrationEndpoint() == MigrationEndpoint.SOURCE) {
                        indexService.removeEntryIndex(record.getKey());
                    } else {
                        Object value = record.getValue();
                        if (value != null) {
                            indexService.saveEntryIndex(new QueryEntry(getSerializationService(), record.getKey(), record.getKey(), value));
                        }
                    }
                }
            }
        }
View Full Code Here

    private void migrateIndex(PartitionMigrationEvent event) {
        final PartitionContainer container = mapServiceContext.getPartitionContainer(event.getPartitionId());
        for (RecordStore recordStore : container.getMaps().values()) {
            final MapContainer mapContainer = mapServiceContext.getMapContainer(recordStore.getName());
            final IndexService indexService = mapContainer.getIndexService();
            if (indexService.hasIndex()) {
                final Iterator<Record> iterator = recordStore.iterator();
                while (iterator.hasNext()) {
                    final Record record = iterator.next();
                    if (event.getMigrationEndpoint() == MigrationEndpoint.SOURCE) {
                        indexService.removeEntryIndex(record.getKey());
                    } else {
                        Object value = record.getValue();
                        if (value != null) {
                            indexService.saveEntryIndex(new QueryEntry(serializationService, record.getKey(),
                                    record.getKey(), value));
                        }
                    }
                }
            }
View Full Code Here

    }


    protected void saveIndex(Record record) {
        Data dataKey = record.getKey();
        final IndexService indexService = mapContainer.getIndexService();
        if (indexService.hasIndex()) {
            SerializationService ss = mapServiceContext.getNodeEngine().getSerializationService();
            QueryableEntry queryableEntry = new QueryEntry(ss, dataKey, dataKey, record.getValue());
            indexService.saveEntryIndex(queryableEntry);
        }
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.query.impl.IndexService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.