@Override public GridBiTuple<V, GridCacheVersion> apply(V v) { return F.t(v, ver); } }));
/** * Swaps values. * * @return New tuple with swapped values. */ public GridBiTuple<V2, V1> swap() { return F.t(val2, val1); }
/** * @return Current value and stamp. */ public GridBiTuple<T, S> get() { return F.t(val, stamp); }
/** * @param type Event type. * @param topVer Topology version. * @param node Node. * @param topSnapshot Topology snapshot. */ void addEvent(int type, long topVer, GridNode node, Collection<GridNode> topSnapshot) { assert node != null; evts.add(F.t(type, topVer, node, topSnapshot)); }
/** * Add key to request. * * @param key Key to evict. * @param ver Entry version. * @param near {@code true} if key should be evicted from near cache. */ void addKey(K key, GridCacheVersion ver, boolean near) { assert key != null; assert ver != null; entries.add(F.t(key, ver, near)); }
/** {@inheritDoc} */ @Override public GridFuture<GridCacheReturn<V>> putxAsync0(K key, V val, @Nullable GridCacheEntryEx<K, V> cached, long ttl, GridPredicate<GridCacheEntry<K, V>>[] filter) { return putAllAsync(F.t(key, val), true, cached, ttl, filter); }
/** * @param mode Call mode. * @param job Job. */ private T7(GridClosureCallMode mode, Callable<R> job) { super(U.peerDeployAware(job)); t = F.t(mode, job); }
/** * @param entry Entry. * @param updRes Entry update result. * @param entries All entries. */ private void addDeleted(GridDhtCacheEntry<K, V> entry, GridCacheUpdateAtomicResult<K, V> updRes, Collection<GridDhtCacheEntry<K, V>> entries) { if (updRes.removeVersion() != null) { if (deleted == null) deleted = new ArrayList<>(entries.size()); deleted.add(F.t(entry, updRes.removeVersion())); } }
/** {@inheritDoc} */ @Override public GridFuture<V> putAsync(K key, V val, @Nullable GridCacheEntryEx<K, V> cached, long ttl, GridPredicate<GridCacheEntry<K, V>>[] filter) { return putAllAsync(F.t(key, val), true, cached, ttl, filter). chain((GridClosure<GridFuture<GridCacheReturn<V>>, V>) RET2VAL); }
/** * Gracefully stops worker by adding STOP_INFO to queue. */ private void stop() { delReqs.offer(F.t(new GridFutureAdapter<>(ggfsCtx.kernalContext()), stopInfo)); }
/** {@inheritDoc} */ @Override public GridFuture<Boolean> putxAsync(K key, V val, @Nullable GridCacheEntryEx<K, V> cached, long ttl, GridPredicate<GridCacheEntry<K, V>>[] filter) { return putAllAsync(F.t(key, val), false, cached, ttl, filter) .chain((GridClosure<GridFuture<GridCacheReturn<V>>, Boolean>)RET2FLAG); }
/** {@inheritDoc} */ @Nullable @Override public GridBiTuple<Long, Long> reduce(List<GridComputeJobResult> results) throws GridException { long used = 0; long max = 0; for (GridComputeJobResult res : results) { GridBiTuple<Long, Long> data = res.getData(); if (data != null) { used += data.get1(); max += data.get2(); } } return F.t(used, max); }
/** * @param key Key to read from swap storage. * @return Value from swap storage. * @throws GridException In case of any errors. */ @Nullable private GridTuple<V> peekSwap(K key) throws GridException { GridCacheSwapEntry<V> e = ctx.swap().read(key); return e != null ? F.t(e.value()) : null; }
/** {@inheritDoc} */ @Override public boolean putx(K key, V val, @Nullable GridCacheEntryEx<K, V> cached, long ttl, GridPredicate<GridCacheEntry<K, V>>[] filter) throws GridException { return putAllAsync0(F.t(key, val), null, null, false, cached, ttl, filter).get().success(); }
@Nullable @Override public GridBiTuple<Long, Long> execute() throws GridException { GridGgfs ggfs = ((GridKernal)g).context().ggfs().ggfs(ggfsName); if (ggfs == null) return F.t(0L, 0L); GridGgfsMetrics metrics = ggfs.metrics(); long loc = metrics.localSpaceSize(); return F.t(loc, metrics.maxSpaceSize()); } });
@Override public void apply(UUID nodeId, GridCacheDgcRequest<K, V> req) { if (log.isDebugEnabled()) log.debug("Received DGC request [rmtNodeId=" + nodeId + ", req=" + req + ']'); reqWorker.addDgcRequest(F.t(nodeId, req)); } };
/** * @param key Key to read from persistent store. * @return Value from persistent store. * @throws GridException In case of any errors. */ @Nullable private GridTuple<V> peekDb(K key) throws GridException { V val = ctx.store().loadFromStore(ctx.tm().localTxx(), key); return val != null ? F.t(val) : null; }
@Override public void apply(UUID nodeId, GridCacheDgcResponse<K, V> res) { if (log.isDebugEnabled()) log.debug("Received DGC response [rmtNodeId=" + nodeId + ", res=" + res + ']'); resWorker.addDgcResponse(F.t(nodeId, res)); } };
/** {@inheritDoc} */ @Override public boolean putx(K key, V val, GridPredicate<GridCacheEntry<K, V>>[] filter) throws GridException { return putAllAsync0(F.t(key, val), null, null, false, null, -1, filter).get().success(); }
/** {@inheritDoc} */ @Override public void finishUnmarshal(GridCacheContext<K, V> ctx, ClassLoader ldr) throws GridException { super.finishUnmarshal(ctx, ldr); if (ownedValsBytes != null && ownedVals == null) { ownedVals = new HashMap<>(); for (byte[] bytes : ownedValsBytes) { GridTuple4<K, GridCacheVersion, byte[], Boolean> tup = ctx.marshaller().unmarshal(bytes, ldr); V val = tup.get4() ? (V)tup.get3() : ctx.marshaller().<V>unmarshal(tup.get3(), ldr); ownedVals.put(tup.get1(), F.t(tup.get2(), val, tup.get4() ? null : tup.get3())); } } }