ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [29/50] [abbrv] incubator-ignite git commit: # ignite-42
Date Thu, 22 Jan 2015 14:47:20 GMT
# ignite-42


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

Branch: refs/heads/ignite-35
Commit: 020844b7398f82d1c59f064cb3b01822e9f010d4
Parents: 792a8b5
Author: sboikov <semen.boikov@inria.fr>
Authored: Wed Jan 21 23:28:26 2015 +0300
Committer: sboikov <semen.boikov@inria.fr>
Committed: Wed Jan 21 23:29:22 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/cache/CacheConfiguration.java | 32 ++++++++++++++++++++
 .../cache/IgniteCacheInvokeReadThroughTest.java |  4 +--
 2 files changed, 34 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/020844b7/modules/core/src/main/java/org/apache/ignite/cache/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheConfiguration.java
index 86ac8df..7aaeeef 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheConfiguration.java
@@ -172,6 +172,9 @@ public class CacheConfiguration extends MutableConfiguration {
     @Deprecated
     public static final int DFLT_CONT_QUERY_MAX_BUF_SIZE = 1024;
 
+    /** Default value for 'readFromBackup' flag. */
+    public static final boolean DFLT_READ_FROM_BACKUP = true;
+
     /** Cache name. */
     private String name;
 
@@ -334,6 +337,12 @@ public class CacheConfiguration extends MutableConfiguration {
     /** Query configuration. */
     private GridCacheQueryConfiguration qryCfg;
 
+    /**
+     * Flag indicating whether data can be read from backup.
+     * If {@code false} always get data from primary node (never from backup).
+     */
+    private boolean readFromBackup = DFLT_READ_FROM_BACKUP;
+
     /** Empty constructor (all values are initialized to their defaults). */
     public CacheConfiguration() {
         /* No-op. */
@@ -403,6 +412,7 @@ public class CacheConfiguration extends MutableConfiguration {
         preloadThrottle = cc.getPreloadThrottle();
         qryCfg = cc.getQueryConfiguration();
         qryIdxEnabled = cc.isQueryIndexEnabled();
+        readFromBackup = cc.isReadFromBackup();
         seqReserveSize = cc.getAtomicSequenceReserveSize();
         startSize = cc.getStartSize();
         storeFactory = cc.getCacheStoreFactory();
@@ -1733,6 +1743,28 @@ public class CacheConfiguration extends MutableConfiguration {
         this.qryCfg = qryCfg;
     }
 
+    /**
+     * Gets flag indicating whether data can be read from backup.
+     * If {@code false} always get data from primary node (never from backup).
+     * <p>
+     * Default value is defined by {@link #DFLT_READ_FROM_BACKUP}.
+     *
+     * @return {@code true} if data can be read from backup node or {@code false} if data
always
+     *      should be read from primary node and never from backup.
+     */
+    public boolean isReadFromBackup() {
+        return readFromBackup;
+    }
+
+    /**
+     * Sets read from backup flag.
+     *
+     * @param readFromBackup {@code true} to allow reads from backups.
+     */
+    public void setReadFromBackup(boolean readFromBackup) {
+        this.readFromBackup = readFromBackup;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(CacheConfiguration.class, this);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/020844b7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java
index 4bdc029..e25d7d1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java
@@ -18,8 +18,8 @@
 package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.*;
+import org.apache.ignite.cache.store.*;
 import org.gridgain.grid.cache.*;
-import org.gridgain.grid.cache.store.*;
 
 import javax.cache.processor.*;
 
@@ -55,7 +55,7 @@ public class IgniteCacheInvokeReadThroughTest extends IgniteCacheAbstractTest
{
     }
 
     /** {@inheritDoc} */
-    @Override protected GridCacheStore<?, ?> cacheStore() {
+    @Override protected CacheStore<?, ?> cacheStore() {
         return new TestStore();
     }
 


Mime
View raw message