#ignite-629: remove CacheFlag.SKIP_SWAP

Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/40223387
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/40223387
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/40223387

Branch: refs/heads/gg-9998
Commit: 4022338795ae45e381599aac709dbff0d56b945f
Parents: be6a161
Author: ivasilinets <ivasilin...@gridgain.com>
Authored: Fri Mar 27 17:58:12 2015 +0300
Committer: ivasilinets <ivasilin...@gridgain.com>
Committed: Fri Mar 27 17:58:12 2015 +0300

----------------------------------------------------------------------
 .../internal/client/GridClientCacheFlag.java    |  3 ---
 .../impl/connection/GridClientConnection.java   |  3 ---
 .../internal/processors/cache/CacheFlag.java    |  5 +----
 .../processors/cache/CacheProjection.java       | 21 ++++++--------------
 .../internal/processors/cache/GridCache.java    |  3 ---
 .../processors/cache/GridCacheAdapter.java      |  6 ------
 .../processors/cache/GridCacheContext.java      |  2 +-
 .../processors/cache/GridCacheMapEntry.java     |  2 +-
 .../distributed/near/GridNearCacheAdapter.java  |  8 --------
 .../handlers/cache/GridCacheCommandHandler.java |  3 ---
 10 files changed, 9 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/40223387/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientCacheFlag.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientCacheFlag.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientCacheFlag.java
index a49e506..707a31b 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientCacheFlag.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientCacheFlag.java
@@ -26,9 +26,6 @@ public enum GridClientCacheFlag {
     /** Skips store, i.e. no read-through and no write-through behavior. */
     SKIP_STORE,
 
-    /** Skip swap space for reads and writes. */
-    SKIP_SWAP,
-
     /**
      * Disable deserialization of portable objects on get operations.
      * If set and portable marshaller is used, {@link 
GridClientData#get(Object)}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/40223387/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnection.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnection.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnection.java
index 50b0216..4e5add7 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnection.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnection.java
@@ -106,9 +106,6 @@ public abstract class GridClientConnection {
         if (flagSet.contains(GridClientCacheFlag.SKIP_STORE))
             bits |= 1;
 
-        if (flagSet.contains(GridClientCacheFlag.SKIP_SWAP))
-            bits |= 1 << 1;
-
         return bits;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/40223387/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlag.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlag.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlag.java
index ba026a6..5bef17d 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlag.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlag.java
@@ -44,10 +44,7 @@ public enum CacheFlag {
     CLONE,
 
     /** Skips store, i.e. no read-through and no write-through behavior. */
-    SKIP_STORE,
-
-    /** Skip swap space for reads and writes. */
-    SKIP_SWAP;
+    SKIP_STORE;
 
     /** */
     private static final CacheFlag[] VALS = values();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/40223387/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
index 200ee10..9fd1285 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
@@ -1114,8 +1114,7 @@ public interface CacheProjection<K, V> extends 
Iterable<Cache.Entry<K, V>> {
      * Evicts entry associated with given key from cache. Note, that entry 
will be evicted
      * only if it's not used (not participating in any locks or transactions).
      * <p>
-     * If {@link 
org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to 
{@code true} and
-     * {@link CacheFlag#SKIP_SWAP} is not enabled, the evicted entry will
+     * If {@link 
org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to 
{@code true}, the evicted entry will
      * be swapped to offheap, and then to disk.
      *
      * @param key Key to evict from cache.
@@ -1128,8 +1127,7 @@ public interface CacheProjection<K, V> extends 
Iterable<Cache.Entry<K, V>> {
      * evicted only if it's not used (not participating in any locks or
      * transactions).
      * <p>
-     * If {@link 
org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to 
{@code true} and
-     * {@link CacheFlag#SKIP_SWAP} is not enabled, the evicted entry will
+     * If {@link 
org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to 
{@code true}, the evicted entry will
      * be swapped to offheap, and then to disk.
      * */
     public void evictAll();
@@ -1139,8 +1137,7 @@ public interface CacheProjection<K, V> extends 
Iterable<Cache.Entry<K, V>> {
      * that entry will be evicted only if it's not used (not
      * participating in any locks or transactions).
      * <p>
-     * If {@link 
org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to 
{@code true} and
-     * {@link CacheFlag#SKIP_SWAP} is not enabled, the evicted entry will
+     * If {@link 
org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to 
{@code true}, the evicted entry will
      * be swapped to offheap, and then to disk.
      *
      * @param keys Keys to evict.
@@ -1151,8 +1148,7 @@ public interface CacheProjection<K, V> extends 
Iterable<Cache.Entry<K, V>> {
      * Clears all entries from this cache only if the entry is not
      * currently locked or participating in a transaction.
      * <p>
-     * If {@link 
org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to 
{@code true} and
-     * {@link CacheFlag#SKIP_SWAP} is not enabled, the evicted entries will
+     * If {@link 
org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to 
{@code true}, the evicted entries will
      * also be cleared from swap.
      * <p>
      * Note that this operation is local as it merely clears
@@ -1165,8 +1161,7 @@ public interface CacheProjection<K, V> extends 
Iterable<Cache.Entry<K, V>> {
      * Clears an entry from this cache and swap storage only if the entry
      * is not currently locked, and is not participating in a transaction.
      * <p>
-     * If {@link 
org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to 
{@code true} and
-     * {@link CacheFlag#SKIP_SWAP} is not enabled, the evicted entries will
+     * If {@link 
org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to 
{@code true}, the evicted entries will
      * also be cleared from swap.
      * <p>
      * Note that this operation is local as it merely clears
@@ -1184,8 +1179,7 @@ public interface CacheProjection<K, V> extends 
Iterable<Cache.Entry<K, V>> {
      * Clears entries from this cache and swap storage only if the entry
      * is not currently locked, and is not participating in a transaction.
      * <p>
-     * If {@link 
org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to 
{@code true} and
-     * {@link CacheFlag#SKIP_SWAP} is not enabled, the evicted entries will
+     * If {@link 
org.apache.ignite.configuration.CacheConfiguration#isSwapEnabled()} is set to 
{@code true}, the evicted entries will
      * also be cleared from swap.
      * <p>
      * Note that this operation is local as it merely clears
@@ -1725,9 +1719,6 @@ public interface CacheProjection<K, V> extends 
Iterable<Cache.Entry<K, V>> {
      * into memory.
      * <h2 class="header">Transactions</h2>
      * This method is not transactional.
-     * <h2 class="header">Cache Flags</h2>
-     * This method is not available if any of the following flags are set on 
projection:
-     * {@link CacheFlag#SKIP_SWAP}
      *
      * @param keys Keys to promote entries for.
      * @throws IgniteCheckedException If promote failed.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/40223387/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCache.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCache.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCache.java
index e3ef493..e5d356b 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCache.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCache.java
@@ -158,9 +158,6 @@ public interface GridCache<K, V> extends CacheProjection<K, 
V> {
      * <p>
      * Returned iterator supports {@code remove} operation which delegates to
      * <code>removex(Object, org.apache.ignite.lang.IgnitePredicate[])</code> 
method.
-     * <h2 class="header">Cache Flags</h2>
-     * This method is not available if any of the following flags are set on 
projection:
-     * {@link org.apache.ignite.internal.processors.cache.CacheFlag#SKIP_SWAP}.
      *
      * @return Iterator over keys.
      * @throws IgniteCheckedException If failed.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/40223387/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 7f6be72..79c8fce 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -4205,8 +4205,6 @@ public abstract class GridCacheAdapter<K, V> implements 
GridCache<K, V>,
      */
     @SuppressWarnings("IfMayBeConditional")
     @Nullable public V promote(K key, boolean deserializePortable) throws 
IgniteCheckedException {
-        ctx.denyOnFlags(F.asList(SKIP_SWAP));
-
         A.notNull(key, "key");
 
         if (keyCheck)
@@ -4241,8 +4239,6 @@ public abstract class GridCacheAdapter<K, V> implements 
GridCache<K, V>,
 
     /** {@inheritDoc} */
     @Override public void promoteAll(@Nullable Collection<? extends K> keys) 
throws IgniteCheckedException {
-        ctx.denyOnFlags(F.asList(SKIP_SWAP));
-
         if (F.isEmpty(keys))
             return;
 
@@ -4289,8 +4285,6 @@ public abstract class GridCacheAdapter<K, V> implements 
GridCache<K, V>,
 
     /** {@inheritDoc} */
     @Override public Iterator<Map.Entry<K, V>> swapIterator() throws 
IgniteCheckedException {
-        ctx.denyOnFlags(F.asList(SKIP_SWAP));
-
         return ctx.swap().lazySwapIterator();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/40223387/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index fe836be..60c503b 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -1489,7 +1489,7 @@ public class GridCacheContext<K, V> implements 
Externalizable {
      * @return {@code True} if swap store of off-heap cache are enabled.
      */
     public boolean isSwapOrOffheapEnabled() {
-        return (swapMgr.swapEnabled() && !hasFlag(SKIP_SWAP)) || 
isOffHeapEnabled();
+        return swapMgr.swapEnabled() || isOffHeapEnabled();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/40223387/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index cf689ee..d32eb21 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -427,7 +427,7 @@ public abstract class GridCacheMapEntry implements 
GridCacheEntryEx {
      * @throws IgniteCheckedException If failed.
      */
     @Nullable @Override public CacheObject unswap(boolean ignoreFlags, boolean 
needVal) throws IgniteCheckedException {
-        boolean swapEnabled = cctx.swap().swapEnabled() && (ignoreFlags || 
!cctx.hasFlag(SKIP_SWAP));
+        boolean swapEnabled = cctx.swap().swapEnabled();
 
         if (!swapEnabled && !cctx.isOffHeapEnabled())
             return null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/40223387/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index 1ef0162..c986926 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -521,24 +521,18 @@ public abstract class GridNearCacheAdapter<K, V> extends 
GridDistributedCacheAda
 
     /** {@inheritDoc} */
     @Override public V promote(K key, boolean deserializePortable) throws 
IgniteCheckedException {
-        ctx.denyOnFlags(F.asList(SKIP_SWAP));
-
         // Unswap only from dht(). Near cache does not have swap storage.
         return dht().promote(key, deserializePortable);
     }
 
     /** {@inheritDoc} */
     @Override public V promote(K key) throws IgniteCheckedException {
-        ctx.denyOnFlags(F.asList(SKIP_SWAP));
-
         // Unswap only from dht(). Near cache does not have swap storage.
         return dht().promote(key);
     }
 
     /** {@inheritDoc} */
     @Override public void promoteAll(@Nullable Collection<? extends K> keys) 
throws IgniteCheckedException {
-        ctx.denyOnFlags(F.asList(SKIP_SWAP));
-
         // Unswap only from dht(). Near cache does not have swap storage.
         // In near-only cache this is a no-op.
         if (ctx.affinityNode())
@@ -552,8 +546,6 @@ public abstract class GridNearCacheAdapter<K, V> extends 
GridDistributedCacheAda
 
     /** {@inheritDoc} */
     @Override public Iterator<Map.Entry<K, V>> swapIterator() throws 
IgniteCheckedException {
-        ctx.denyOnFlags(F.asList(SKIP_SWAP));
-
         return dht().swapIterator();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/40223387/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
index d9330b0..0724605 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
@@ -111,9 +111,6 @@ public class GridCacheCommandHandler extends 
GridRestCommandHandlerAdapter {
         if ((cacheFlagsBits & 1) != 0)
             flagSet.add(CacheFlag.SKIP_STORE);
 
-        if ((cacheFlagsBits & (1 << 1)) != 0)
-            flagSet.add(CacheFlag.SKIP_SWAP);
-
         return flagSet.toArray(new CacheFlag[flagSet.size()]);
     }
 

Reply via email to