Search in sources :

Example 31 with IterationPointer

use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.

the class MapFetchKeysMessageTask method prepareOperation.

@Override
protected Operation prepareOperation() {
    MapOperationProvider operationProvider = getMapOperationProvider(parameters.name);
    IterationPointer[] pointers = decodePointers(parameters.iterationPointers);
    return operationProvider.createFetchKeysOperation(parameters.name, pointers, parameters.batch);
}
Also used : IterationPointer(com.hazelcast.internal.iteration.IterationPointer) MapOperationProvider(com.hazelcast.map.impl.operation.MapOperationProvider)

Example 32 with IterationPointer

use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.

the class MapFetchKeysMessageTask method encodeResponse.

@Override
protected ClientMessage encodeResponse(Object response) {
    if (response == null) {
        return MapFetchKeysCodec.encodeResponse(Collections.emptyList(), Collections.emptyList());
    }
    MapKeysWithCursor mapKeysWithCursor = (MapKeysWithCursor) response;
    IterationPointer[] pointers = mapKeysWithCursor.getIterationPointers();
    return MapFetchKeysCodec.encodeResponse(encodePointers(pointers), mapKeysWithCursor.getBatch());
}
Also used : MapKeysWithCursor(com.hazelcast.map.impl.iterator.MapKeysWithCursor) IterationPointer(com.hazelcast.internal.iteration.IterationPointer)

Example 33 with IterationPointer

use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.

the class MapFetchWithQueryMessageTask method encodeResponse.

@Override
protected ClientMessage encodeResponse(Object response) {
    ResultSegment resp = (ResultSegment) response;
    QueryResult queryResult = (QueryResult) resp.getResult();
    List<Data> serialized = new ArrayList<>(queryResult.size());
    for (QueryResultRow row : queryResult) {
        serialized.add(row.getValue());
    }
    IterationPointer[] pointers = resp.getPointers();
    return MapFetchWithQueryCodec.encodeResponse(serialized, encodePointers(pointers));
}
Also used : QueryResult(com.hazelcast.map.impl.query.QueryResult) IterationPointer(com.hazelcast.internal.iteration.IterationPointer) QueryResultRow(com.hazelcast.map.impl.query.QueryResultRow) ArrayList(java.util.ArrayList) ResultSegment(com.hazelcast.map.impl.query.ResultSegment) Data(com.hazelcast.internal.serialization.Data)

Example 34 with IterationPointer

use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.

the class MapFetchEntriesMessageTask method encodeResponse.

@Override
protected ClientMessage encodeResponse(Object response) {
    if (response == null) {
        return MapFetchEntriesCodec.encodeResponse(Collections.emptyList(), Collections.emptyList());
    }
    MapEntriesWithCursor mapEntriesWithCursor = (MapEntriesWithCursor) response;
    IterationPointer[] pointers = mapEntriesWithCursor.getIterationPointers();
    return MapFetchEntriesCodec.encodeResponse(encodePointers(pointers), mapEntriesWithCursor.getBatch());
}
Also used : IterationPointer(com.hazelcast.internal.iteration.IterationPointer) MapEntriesWithCursor(com.hazelcast.map.impl.iterator.MapEntriesWithCursor)

Example 35 with IterationPointer

use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.

the class ClientMapPartitionIterator method fetchWithoutPrefetchValues.

private List fetchWithoutPrefetchValues(HazelcastClientInstanceImpl client) {
    ClientMessage request = MapFetchKeysCodec.encodeRequest(mapProxy.getName(), encodePointers(pointers), fetchSize);
    ClientInvocation clientInvocation = new ClientInvocation(client, request, mapProxy.getName(), partitionId);
    try {
        ClientInvocationFuture f = clientInvocation.invoke();
        MapFetchKeysCodec.ResponseParameters responseParameters = MapFetchKeysCodec.decodeResponse(f.get());
        IterationPointer[] pointers = decodePointers(responseParameters.iterationPointers);
        setIterationPointers(responseParameters.keys, pointers);
        return responseParameters.keys;
    } catch (Exception e) {
        throw ExceptionUtil.rethrow(e);
    }
}
Also used : IterationPointer(com.hazelcast.internal.iteration.IterationPointer) ClientInvocation(com.hazelcast.client.impl.spi.impl.ClientInvocation) MapFetchKeysCodec(com.hazelcast.client.impl.protocol.codec.MapFetchKeysCodec) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) ClientInvocationFuture(com.hazelcast.client.impl.spi.impl.ClientInvocationFuture)

Aggregations

IterationPointer (com.hazelcast.internal.iteration.IterationPointer)37 Data (com.hazelcast.internal.serialization.Data)9 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)4 ClientInvocation (com.hazelcast.client.impl.spi.impl.ClientInvocation)4 ClientInvocationFuture (com.hazelcast.client.impl.spi.impl.ClientInvocationFuture)4 AbstractMap (java.util.AbstractMap)4 ArrayList (java.util.ArrayList)4 MapOperationProvider (com.hazelcast.map.impl.operation.MapOperationProvider)3 Map (java.util.Map)3 CacheEntriesWithCursor (com.hazelcast.cache.impl.CacheEntriesWithCursor)2 HazelcastClientInstanceImpl (com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl)2 SampleableConcurrentHashMap (com.hazelcast.internal.util.SampleableConcurrentHashMap)2 MapEntriesWithCursor (com.hazelcast.map.impl.iterator.MapEntriesWithCursor)2 CacheKeysWithCursor (com.hazelcast.cache.impl.CacheKeysWithCursor)1 CacheOperationProvider (com.hazelcast.cache.impl.CacheOperationProvider)1 CacheIterateCodec (com.hazelcast.client.impl.protocol.codec.CacheIterateCodec)1 CacheIterateEntriesCodec (com.hazelcast.client.impl.protocol.codec.CacheIterateEntriesCodec)1 MapFetchEntriesCodec (com.hazelcast.client.impl.protocol.codec.MapFetchEntriesCodec)1 MapFetchKeysCodec (com.hazelcast.client.impl.protocol.codec.MapFetchKeysCodec)1 MapFetchWithQueryCodec (com.hazelcast.client.impl.protocol.codec.MapFetchWithQueryCodec)1