use of org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture in project ignite by apache.
the class GridDhtAtomicCache method getAsync0.
/**
* Entry point to all public API single get methods.
*
* @param key Key.
* @param forcePrimary Force primary flag.
* @param subjId Subject ID.
* @param taskName Task name.
* @param deserializeBinary Deserialize binary flag.
* @param expiryPlc Expiry policy.
* @param skipVals Skip values flag.
* @param skipStore Skip store flag.
* @param needVer Need version.
* @return Get future.
*/
private IgniteInternalFuture<V> getAsync0(KeyCacheObject key, boolean forcePrimary, UUID subjId, String taskName, boolean deserializeBinary, boolean recovery, @Nullable ExpiryPolicy expiryPlc, boolean skipVals, boolean skipStore, boolean needVer) {
AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion();
IgniteCacheExpiryPolicy expiry = skipVals ? null : expiryPolicy(expiryPlc);
GridPartitionedSingleGetFuture fut = new GridPartitionedSingleGetFuture(ctx, key, topVer, !skipStore, forcePrimary, subjId, taskName, deserializeBinary, expiry, skipVals, needVer, false, recovery);
fut.init();
return (IgniteInternalFuture<V>) fut;
}
use of org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture in project ignite by apache.
the class GridDhtColocatedCache method getAsync.
/**
* {@inheritDoc}
*/
@Override
protected IgniteInternalFuture<V> getAsync(final K key, boolean forcePrimary, boolean skipTx, @Nullable UUID subjId, String taskName, final boolean deserializeBinary, final boolean skipVals, final boolean needVer) {
ctx.checkSecurity(SecurityPermission.CACHE_READ);
if (keyCheck)
validateCacheKey(key);
GridNearTxLocal tx = ctx.tm().threadLocalTx(ctx);
final CacheOperationContext opCtx = ctx.operationContextPerCall();
final boolean recovery = opCtx != null && opCtx.recovery();
if (tx != null && !tx.implicit() && !skipTx) {
return asyncOp(tx, new AsyncOp<V>() {
@Override
public IgniteInternalFuture<V> op(GridNearTxLocal tx, AffinityTopologyVersion readyTopVer) {
IgniteInternalFuture<Map<Object, Object>> fut = tx.getAllAsync(ctx, readyTopVer, Collections.singleton(ctx.toCacheKeyObject(key)), deserializeBinary, skipVals, false, opCtx != null && opCtx.skipStore(), recovery, needVer);
return fut.chain(new CX1<IgniteInternalFuture<Map<Object, Object>>, V>() {
@SuppressWarnings("unchecked")
@Override
public V applyx(IgniteInternalFuture<Map<Object, Object>> e) throws IgniteCheckedException {
Map<Object, Object> map = e.get();
assert map.isEmpty() || map.size() == 1 : map.size();
if (skipVals) {
Boolean val = map.isEmpty() ? false : (Boolean) F.firstValue(map);
return (V) (val);
}
return (V) F.firstValue(map);
}
});
}
}, opCtx, /*retry*/
false);
}
AffinityTopologyVersion topVer = tx == null ? ctx.affinity().affinityTopologyVersion() : tx.topologyVersion();
subjId = ctx.subjectIdPerCall(subjId, opCtx);
GridPartitionedSingleGetFuture fut = new GridPartitionedSingleGetFuture(ctx, ctx.toCacheKeyObject(key), topVer, opCtx == null || !opCtx.skipStore(), forcePrimary, subjId, taskName, deserializeBinary, skipVals ? null : expiryPolicy(opCtx != null ? opCtx.expiry() : null), skipVals, needVer, /*keepCacheObjects*/
false, opCtx != null && opCtx.recovery());
fut.init();
return (IgniteInternalFuture<V>) fut;
}
use of org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture in project ignite by apache.
the class GridDhtColocatedCache method loadAsync.
/**
* @param key Key to load.
* @param readThrough Read through flag.
* @param forcePrimary Force get from primary node flag.
* @param topVer Topology version.
* @param subjId Subject ID.
* @param taskName Task name.
* @param deserializeBinary Deserialize binary flag.
* @param expiryPlc Expiry policy.
* @param skipVals Skip values flag.
* @param needVer If {@code true} returns values as tuples containing value and version.
* @param keepCacheObj Keep cache objects flag.
* @return Load future.
*/
public final IgniteInternalFuture<Object> loadAsync(KeyCacheObject key, boolean readThrough, boolean forcePrimary, AffinityTopologyVersion topVer, @Nullable UUID subjId, String taskName, boolean deserializeBinary, @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean skipVals, boolean needVer, boolean keepCacheObj, boolean recovery) {
GridPartitionedSingleGetFuture fut = new GridPartitionedSingleGetFuture(ctx, ctx.toCacheKeyObject(key), topVer, readThrough, forcePrimary, subjId, taskName, deserializeBinary, expiryPlc, skipVals, needVer, keepCacheObj, recovery);
fut.init();
return fut;
}
use of org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture in project ignite by apache.
the class GridDhtColocatedCache method loadAsync.
/**
* @param key Key to load.
* @param readThrough Read through flag.
* @param forcePrimary Force get from primary node flag.
* @param topVer Topology version.
* @param taskName Task name.
* @param deserializeBinary Deserialize binary flag.
* @param expiryPlc Expiry policy.
* @param skipVals Skip values flag.
* @param needVer If {@code true} returns values as tuples containing value and version.
* @param keepCacheObj Keep cache objects flag.
* @param txLbl Transaction label.
* @return Load future.
*/
public final IgniteInternalFuture<Object> loadAsync(KeyCacheObject key, boolean readThrough, boolean forcePrimary, AffinityTopologyVersion topVer, String taskName, boolean deserializeBinary, @Nullable IgniteCacheExpiryPolicy expiryPlc, boolean skipVals, boolean needVer, boolean keepCacheObj, boolean recovery, @Nullable MvccSnapshot mvccSnapshot, @Nullable String txLbl) {
GridPartitionedSingleGetFuture fut = new GridPartitionedSingleGetFuture(ctx, ctx.toCacheKeyObject(key), topVer, readThrough, forcePrimary, taskName, deserializeBinary, expiryPlc, skipVals, needVer, keepCacheObj, recovery, txLbl, mvccSnapshot);
fut.init();
return fut;
}
use of org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture in project ignite by apache.
the class GridDhtAtomicCache method getAsync0.
/**
* Entry point to all public API single get methods.
*
* @param key Key.
* @param forcePrimary Force primary flag.
* @param taskName Task name.
* @param deserializeBinary Deserialize binary flag.
* @param readRepairStrategy Read Repair strategy.
* @param expiryPlc Expiry policy.
* @param skipVals Skip values flag.
* @param skipStore Skip store flag.
* @param needVer Need version.
* @return Get future.
*/
private IgniteInternalFuture<V> getAsync0(KeyCacheObject key, boolean forcePrimary, String taskName, boolean deserializeBinary, boolean recovery, ReadRepairStrategy readRepairStrategy, @Nullable ExpiryPolicy expiryPlc, boolean skipVals, boolean skipStore, boolean needVer) {
AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion();
IgniteCacheExpiryPolicy expiry = skipVals ? null : expiryPolicy(expiryPlc);
if (readRepairStrategy != null) {
return new GridNearReadRepairCheckOnlyFuture(ctx, Collections.singleton(ctx.toCacheKeyObject(key)), readRepairStrategy, !skipStore, taskName, deserializeBinary, recovery, expiry, skipVals, needVer, false, null).single();
}
GridPartitionedSingleGetFuture fut = new GridPartitionedSingleGetFuture(ctx, key, topVer, !skipStore, forcePrimary, taskName, deserializeBinary, expiry, skipVals, needVer, false, recovery, null, null);
fut.init();
return (IgniteInternalFuture<V>) fut;
}
Aggregations