mnemonic-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject incubator-mnemonic git commit: MNEMONIC-375: Support expandable durable memory service
Date Sun, 01 Oct 2017 05:47:43 GMT
Repository: incubator-mnemonic
Updated Branches:
  refs/heads/master 50e2a574b -> 0280d047b


MNEMONIC-375: Support expandable durable memory service


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

Branch: refs/heads/master
Commit: 0280d047b64ef81b26391dde2c3c611665038a2d
Parents: 50e2a57
Author: paleyss <paleyitsky@gmail.com>
Authored: Fri Sep 29 23:02:17 2017 -0700
Committer: paleyss <paleyitsky@gmail.com>
Committed: Fri Sep 29 23:21:09 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/mnemonic/CommonAllocator.java     | 10 ++++++++++
 .../org/apache/mnemonic/NonVolatileMemAllocator.java  | 14 ++++++++++++++
 .../java/org/apache/mnemonic/SysMemAllocator.java     | 14 ++++++++++++++
 .../org/apache/mnemonic/VolatileMemAllocator.java     | 14 ++++++++++++++
 .../mnemonic/service/memory/MemoryServiceFeature.java |  3 ++-
 5 files changed, 54 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/0280d047/mnemonic-core/src/main/java/org/apache/mnemonic/CommonAllocator.java
----------------------------------------------------------------------
diff --git a/mnemonic-core/src/main/java/org/apache/mnemonic/CommonAllocator.java b/mnemonic-core/src/main/java/org/apache/mnemonic/CommonAllocator.java
index 3ca8a7b..6738568 100644
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/CommonAllocator.java
+++ b/mnemonic-core/src/main/java/org/apache/mnemonic/CommonAllocator.java
@@ -44,6 +44,16 @@ public abstract class CommonAllocator<A extends CommonAllocator<A>>
implements A
   }
 
   /**
+   * expand this memory pool
+   *
+   * @param size
+   *          specify the size to expand
+   *
+   * @return the real size expanded
+   */
+  public abstract long expand(long size);
+
+  /**
    * set a reclaimer to reclaim memory buffer
    * 
    * @param reclaimer

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/0280d047/mnemonic-core/src/main/java/org/apache/mnemonic/NonVolatileMemAllocator.java
----------------------------------------------------------------------
diff --git a/mnemonic-core/src/main/java/org/apache/mnemonic/NonVolatileMemAllocator.java
b/mnemonic-core/src/main/java/org/apache/mnemonic/NonVolatileMemAllocator.java
index d81dabb..f2e1541 100644
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/NonVolatileMemAllocator.java
+++ b/mnemonic-core/src/main/java/org/apache/mnemonic/NonVolatileMemAllocator.java
@@ -28,6 +28,7 @@ import org.flowcomputing.commons.resgc.ResReclaim;
 
 import java.nio.ByteBuffer;
 
+import static org.apache.mnemonic.service.memory.MemoryServiceFeature.EXPANDABLE;
 import static org.apache.mnemonic.service.memory.MemoryServiceFeature.QUERYABLE;
 
 /**
@@ -702,4 +703,17 @@ public class NonVolatileMemAllocator extends RestorableAllocator<NonVolatileMemA
     }
     return m_querable;
   }
+
+  @Override
+  public long expand(long size) {
+    long ret = 0L;
+    if (null != m_features) {
+      if (m_features.contains(EXPANDABLE)) {
+        return m_nvmasvc.adjustCapacity(m_nid, size);
+      }
+    } else {
+      throw new ConfigurationException("Do not support expand operation");
+    }
+    return ret;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/0280d047/mnemonic-core/src/main/java/org/apache/mnemonic/SysMemAllocator.java
----------------------------------------------------------------------
diff --git a/mnemonic-core/src/main/java/org/apache/mnemonic/SysMemAllocator.java b/mnemonic-core/src/main/java/org/apache/mnemonic/SysMemAllocator.java
index 8b80c96..bd940fb 100644
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/SysMemAllocator.java
+++ b/mnemonic-core/src/main/java/org/apache/mnemonic/SysMemAllocator.java
@@ -28,6 +28,8 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
 
+import static org.apache.mnemonic.service.memory.MemoryServiceFeature.EXPANDABLE;
+
 /**
  * manage a system memory pool as a internal volatile allocator
  * 
@@ -333,4 +335,16 @@ public class SysMemAllocator extends CommonAllocator<SysMemAllocator>
{
     return ret;
   }
 
+  @Override
+  public long expand(long size) {
+    long ret = 0L;
+    if (null != m_features) {
+      if (m_features.contains(EXPANDABLE)) {
+        return ret = size;
+      }
+    } else {
+      throw new ConfigurationException("Do not support expand operation");
+    }
+    return ret;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/0280d047/mnemonic-core/src/main/java/org/apache/mnemonic/VolatileMemAllocator.java
----------------------------------------------------------------------
diff --git a/mnemonic-core/src/main/java/org/apache/mnemonic/VolatileMemAllocator.java b/mnemonic-core/src/main/java/org/apache/mnemonic/VolatileMemAllocator.java
index 7fa493c..71c6a26 100644
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/VolatileMemAllocator.java
+++ b/mnemonic-core/src/main/java/org/apache/mnemonic/VolatileMemAllocator.java
@@ -28,6 +28,7 @@ import org.flowcomputing.commons.resgc.ResReclaim;
 
 import java.nio.ByteBuffer;
 
+import static org.apache.mnemonic.service.memory.MemoryServiceFeature.EXPANDABLE;
 import static org.apache.mnemonic.service.memory.MemoryServiceFeature.QUERYABLE;
 
 /**
@@ -141,6 +142,19 @@ public class VolatileMemAllocator extends RestorableAllocator<VolatileMemAllocat
     return this;
   }
 
+  @Override
+  public long expand(long size) {
+    long ret = 0L;
+    if (null != m_features) {
+      if (m_features.contains(EXPANDABLE)) {
+        return m_vmasvc.adjustCapacity(m_nid, size);
+      }
+    } else {
+      throw new ConfigurationException("Do not support expand operation");
+    }
+    return ret;
+  }
+
   /**
    * release the memory pool and close it.
    *

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/0280d047/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/MemoryServiceFeature.java
----------------------------------------------------------------------
diff --git a/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/MemoryServiceFeature.java
b/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/MemoryServiceFeature.java
index 1adb625..3a6073f 100644
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/MemoryServiceFeature.java
+++ b/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/MemoryServiceFeature.java
@@ -22,7 +22,8 @@ public enum MemoryServiceFeature {
   NONVOLATILE(2),
   TRANSACTABLE(3),
   QUERYABLE(4),
-  ABSTRACTADDRESSING(5);
+  ABSTRACTADDRESSING(5),
+  EXPANDABLE(6);
 
   private int value;
 


Mime
View raw message