Search in sources :

Example 6 with GridClientCacheRequest

use of org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest in project ignite by apache.

the class TestBinaryClient method cacheMetrics.

/**
     * @param cacheName Cache name.
     * @return Metrics.
     * @throws IgniteCheckedException In case of error.
     */
public <K> Map<String, Long> cacheMetrics(@NotNull String cacheName) throws IgniteCheckedException {
    GridClientCacheRequest metrics = new GridClientCacheRequest(METRICS);
    metrics.requestId(idCntr.getAndIncrement());
    metrics.cacheName(cacheName);
    return makeRequest(metrics).getObject();
}
Also used : GridClientCacheRequest(org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest)

Example 7 with GridClientCacheRequest

use of org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest in project ignite by apache.

the class TestBinaryClient method cacheRemove.

/**
     * @param cacheName Cache name.
     * @param key Key.
     * @return Whether entry was actually removed.
     * @throws IgniteCheckedException In case of error.
     */
@SuppressWarnings("unchecked")
public <K> boolean cacheRemove(@NotNull String cacheName, K key) throws IgniteCheckedException {
    assert key != null;
    GridClientCacheRequest req = new GridClientCacheRequest(RMV);
    req.requestId(idCntr.getAndIncrement());
    req.cacheName(cacheName);
    req.key(key);
    return makeRequest(req).<Boolean>getObject();
}
Also used : GridClientCacheRequest(org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest)

Example 8 with GridClientCacheRequest

use of org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest in project ignite by apache.

the class TestBinaryClient method cacheCompareAndSet.

/**
     * @param cacheName Cache name.
     * @param key Key.
     * @param val1 Value 1.
     * @param val2 Value 2.
     * @return Whether new value was actually set.
     * @throws IgniteCheckedException In case of error.
     */
public <K, V> boolean cacheCompareAndSet(@NotNull String cacheName, K key, @Nullable V val1, @Nullable V val2) throws IgniteCheckedException {
    assert key != null;
    GridClientCacheRequest msg = new GridClientCacheRequest(CAS);
    msg.requestId(idCntr.getAndIncrement());
    msg.cacheName(cacheName);
    msg.key(key);
    msg.value(val1);
    msg.value2(val2);
    return makeRequest(msg).<Boolean>getObject();
}
Also used : GridClientCacheRequest(org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest)

Example 9 with GridClientCacheRequest

use of org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest in project ignite by apache.

the class GridClientNioTcpConnection method cacheRemoveAll.

/** {@inheritDoc} */
@Override
public <K> GridClientFutureAdapter<Boolean> cacheRemoveAll(String cacheName, Collection<K> keys, Set<GridClientCacheFlag> flags, UUID destNodeId) throws GridClientConnectionResetException, GridClientClosedException {
    assert keys != null;
    GridClientCacheRequest req = new GridClientCacheRequest(RMV_ALL);
    req.cacheName(cacheName);
    req.keys((Iterable<Object>) keys);
    req.cacheFlagsOn(encodeCacheFlags(flags));
    return makeRequest(req, destNodeId);
}
Also used : GridClientCacheRequest(org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest)

Example 10 with GridClientCacheRequest

use of org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest in project ignite by apache.

the class GridClientNioTcpConnection method cacheAppend.

/** {@inheritDoc} */
@Override
public <K, V> GridClientFutureAdapter<Boolean> cacheAppend(String cacheName, K key, V val, Set<GridClientCacheFlag> flags, UUID destNodeId) throws GridClientConnectionResetException, GridClientClosedException {
    assert key != null;
    assert val != null;
    GridClientCacheRequest append = new GridClientCacheRequest(APPEND);
    append.cacheName(cacheName);
    append.key(key);
    append.value(val);
    append.cacheFlagsOn(encodeCacheFlags(flags));
    return makeRequest(append, destNodeId);
}
Also used : GridClientCacheRequest(org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest)

Aggregations

GridClientCacheRequest (org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest)24 ByteBuffer (java.nio.ByteBuffer)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 GridClientOptimizedMarshaller (org.apache.ignite.internal.client.marshaller.optimized.GridClientOptimizedMarshaller)3 GridNioSession (org.apache.ignite.internal.util.nio.GridNioSession)3 GridClientMessage (org.apache.ignite.internal.processors.rest.client.message.GridClientMessage)2 ArrayList (java.util.ArrayList)1 EnumMap (java.util.EnumMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1 GridClientMarshaller (org.apache.ignite.internal.client.marshaller.GridClientMarshaller)1 GridClientAuthenticationRequest (org.apache.ignite.internal.processors.rest.client.message.GridClientAuthenticationRequest)1 GridClientStateRequest (org.apache.ignite.internal.processors.rest.client.message.GridClientStateRequest)1 GridClientTaskRequest (org.apache.ignite.internal.processors.rest.client.message.GridClientTaskRequest)1 GridClientTopologyRequest (org.apache.ignite.internal.processors.rest.client.message.GridClientTopologyRequest)1 GridRestCacheRequest (org.apache.ignite.internal.processors.rest.request.GridRestCacheRequest)1 GridRestChangeStateRequest (org.apache.ignite.internal.processors.rest.request.GridRestChangeStateRequest)1 GridRestRequest (org.apache.ignite.internal.processors.rest.request.GridRestRequest)1 GridRestTaskRequest (org.apache.ignite.internal.processors.rest.request.GridRestTaskRequest)1