You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mnemonic.apache.org by ga...@apache.org on 2021/02/11 04:25:52 UTC
[mnemonic] branch master updated: MNEMONIC-609: Extract query and
memory interface from mnemonic-core to mnemonic-common
This is an automated email from the ASF dual-hosted git repository.
garyw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mnemonic.git
The following commit(s) were added to refs/heads/master by this push:
new 41d88c8 MNEMONIC-609: Extract query and memory interface from mnemonic-core to mnemonic-common
41d88c8 is described below
commit 41d88c8d81af542a997b57715ad9005d21658a0b
Author: Yanhui Zhao <yz...@apache.org>
AuthorDate: Mon Feb 8 20:21:07 2021 -0800
MNEMONIC-609: Extract query and memory interface from mnemonic-core to mnemonic-common
Signed-off-by: Yanhui Zhao <yz...@apache.org>
---
mnemonic-common/build.gradle | 2 +
mnemonic-common/pom.xml | 8 +
.../java/org/apache/mnemonic/DurableType.java} | 42 ++-
.../mnemonic/query/memory/AttributeInfo.java | 62 ++++
.../apache/mnemonic/query/memory/EntityInfo.java} | 43 ++-
.../apache/mnemonic/query/memory/Queryable.java | 115 +++++++
.../apache/mnemonic/query/memory/ResultSet.java} | 36 ++-
.../apache/mnemonic/query/memory/SortOrder.java} | 28 +-
.../service/computing/GeneralComputingService.java | 53 ++++
.../mnemonic/service/computing/ValueInfo.java} | 42 ++-
.../service/memory/MemoryServiceFeature.java} | 32 +-
.../memory/NonVolatileMemoryAllocatorService.java | 157 +++++++++
.../mnemonic/service/memory/QueryableService.java | 135 ++++++++
.../memory/VolatileMemoryAllocatorService.java | 353 +++++++++++++++++++++
14 files changed, 1042 insertions(+), 66 deletions(-)
diff --git a/mnemonic-common/build.gradle b/mnemonic-common/build.gradle
index 2f37957..673b297 100644
--- a/mnemonic-common/build.gradle
+++ b/mnemonic-common/build.gradle
@@ -19,6 +19,8 @@ description = 'mnemonic-common'
dependencies {
api 'org.apache.commons:commons-lang3'
+ api 'org.flowcomputing.commons:commons-resgc'
+ api 'org.flowcomputing.commons:commons-primitives'
api 'org.slf4j:slf4j-api'
api 'org.slf4j:jul-to-slf4j'
api 'org.slf4j:jcl-over-slf4j'
diff --git a/mnemonic-common/pom.xml b/mnemonic-common/pom.xml
index 8025e35..567b07c 100644
--- a/mnemonic-common/pom.xml
+++ b/mnemonic-common/pom.xml
@@ -41,6 +41,14 @@
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.flowcomputing.commons</groupId>
+ <artifactId>commons-resgc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.flowcomputing.commons</groupId>
+ <artifactId>commons-primitives</artifactId>
+ </dependency>
<!-- logging dependencies -->
<!-- assume all APIs will be used -->
<dependency>
diff --git a/mnemonic-common/build.gradle b/mnemonic-common/src/main/java/org/apache/mnemonic/DurableType.java
similarity index 63%
copy from mnemonic-common/build.gradle
copy to mnemonic-common/src/main/java/org/apache/mnemonic/DurableType.java
index 2f37957..94e2cdf 100644
--- a/mnemonic-common/build.gradle
+++ b/mnemonic-common/src/main/java/org/apache/mnemonic/DurableType.java
@@ -6,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,15 +15,35 @@
* limitations under the License.
*/
-description = 'mnemonic-common'
+package org.apache.mnemonic;
+
+/**
+ * defines the types of generic field
+ *
+ */
+public enum DurableType {
+
+ BOOLEAN(1),
+ CHARACTER(2),
+ BYTE(3),
+ SHORT(4),
+ INTEGER(5),
+ LONG(6),
+ FLOAT(7),
+ DOUBLE(8),
+ STRING(9),
+ DURABLE(10),
+ BUFFER(11),
+ CHUNK(12);
+
+ private int value;
+
+ DurableType(int val) {
+ this.value = val;
+ }
+
+ public int getValue() {
+ return value;
+ }
-dependencies {
- api 'org.apache.commons:commons-lang3'
- api 'org.slf4j:slf4j-api'
- api 'org.slf4j:jul-to-slf4j'
- api 'org.slf4j:jcl-over-slf4j'
- api 'log4j:log4j'
- api 'org.slf4j:slf4j-log4j12'
- testCompileOnly 'org.testng:testng'
}
-test.useTestNG()
diff --git a/mnemonic-common/src/main/java/org/apache/mnemonic/query/memory/AttributeInfo.java b/mnemonic-common/src/main/java/org/apache/mnemonic/query/memory/AttributeInfo.java
new file mode 100644
index 0000000..c767604
--- /dev/null
+++ b/mnemonic-common/src/main/java/org/apache/mnemonic/query/memory/AttributeInfo.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.mnemonic.query.memory;
+
+import org.apache.mnemonic.DurableType;
+
+public class AttributeInfo {
+
+ private String name;
+
+ private DurableType type;
+
+ private SortOrder sortOrder;
+
+ private long entityFieldId;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public SortOrder getSortOrder() {
+ return sortOrder;
+ }
+
+ public void setSortOrder(SortOrder sortOrder) {
+ this.sortOrder = sortOrder;
+ }
+
+ public DurableType getType() {
+ return type;
+ }
+
+ public void setType(DurableType type) {
+ this.type = type;
+ }
+
+ public long getEntityFieldId() {
+ return entityFieldId;
+ }
+
+ public void setEntityFieldId(long entityFieldId) {
+ this.entityFieldId = entityFieldId;
+ }
+}
diff --git a/mnemonic-common/build.gradle b/mnemonic-common/src/main/java/org/apache/mnemonic/query/memory/EntityInfo.java
similarity index 52%
copy from mnemonic-common/build.gradle
copy to mnemonic-common/src/main/java/org/apache/mnemonic/query/memory/EntityInfo.java
index 2f37957..5dabeb1 100644
--- a/mnemonic-common/build.gradle
+++ b/mnemonic-common/src/main/java/org/apache/mnemonic/query/memory/EntityInfo.java
@@ -6,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,16 +14,37 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package org.apache.mnemonic.query.memory;
-description = 'mnemonic-common'
+public class EntityInfo {
-dependencies {
- api 'org.apache.commons:commons-lang3'
- api 'org.slf4j:slf4j-api'
- api 'org.slf4j:jul-to-slf4j'
- api 'org.slf4j:jcl-over-slf4j'
- api 'log4j:log4j'
- api 'org.slf4j:slf4j-log4j12'
- testCompileOnly 'org.testng:testng'
+ private String className;
+
+ private String entityName;
+
+ private AttributeInfo[] attributeInfo;
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public String getEntityName() {
+ return entityName;
+ }
+
+ public void setEntityName(String entityName) {
+ this.entityName = entityName;
+ }
+
+ public AttributeInfo[] getAttributeInfo() {
+ return attributeInfo;
+ }
+
+ public void setAttributeInfo(AttributeInfo[] attributeInfo) {
+ this.attributeInfo = attributeInfo;
+ }
}
-test.useTestNG()
diff --git a/mnemonic-common/src/main/java/org/apache/mnemonic/query/memory/Queryable.java b/mnemonic-common/src/main/java/org/apache/mnemonic/query/memory/Queryable.java
new file mode 100644
index 0000000..ac7ea4d
--- /dev/null
+++ b/mnemonic-common/src/main/java/org/apache/mnemonic/query/memory/Queryable.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.mnemonic.query.memory;
+
+import org.apache.mnemonic.service.computing.ValueInfo;
+
+/**
+ * Queryable interface for memory services
+ * It is optional for underlying services
+ *
+ */
+public interface Queryable {
+
+ /**
+ * Retrieve existing class names
+ *
+ * @return an array of class names
+ */
+ String[] getClassNames();
+
+ /**
+ * Retrieve existing entity names according to specified class name
+ *
+ * @param clsname
+ * specify the class name
+ *
+ * @return an array of entity names
+ */
+ String[] getEntityNames(String clsname);
+
+ /**
+ * retrieve entity info
+ *
+ * @param clsname
+ * specify a class name
+ *
+ * @param etyname
+ * specify a entity name
+ *
+ * @return an entity info
+ */
+ EntityInfo getEntityInfo(String clsname, String etyname);
+
+ /**
+ * create an entity
+ *
+ * @param entityinfo
+ * specify an entity info to create
+ */
+ void createEntity(EntityInfo entityinfo);
+
+ /**
+ * destroy an entity
+ *
+ * @param clsname
+ * specify a class name
+ *
+ * @param etyname
+ * specify an entity name
+ */
+ void destroyEntity(String clsname, String etyname);
+
+ /**
+ * update entity queryable info for a set of durable objects
+ *
+ * @param clsname
+ * specify a class name
+ *
+ * @param etyname
+ * specify an entity name
+ *
+ * @param updobjs
+ * specify a set of durable objects for update
+ */
+ void updateQueryableInfo(String clsname, String etyname, ValueInfo updobjs);
+
+ /**
+ * delete a set of durable objects
+ *
+ * @param clsname
+ * specify a class name
+ *
+ * @param etyname
+ * specify an entity name
+ *
+ * @param updobjs
+ * specify a set of durable objects to delete
+ */
+ void deleteQueryableInfo(String clsname, String etyname, ValueInfo updobjs);
+
+ /**
+ * do query using a querying string
+ *
+ * @param querystr
+ * specify a query string
+ *
+ * @return a result set
+ */
+ ResultSet query(String querystr);
+
+}
diff --git a/mnemonic-common/build.gradle b/mnemonic-common/src/main/java/org/apache/mnemonic/query/memory/ResultSet.java
similarity index 58%
copy from mnemonic-common/build.gradle
copy to mnemonic-common/src/main/java/org/apache/mnemonic/query/memory/ResultSet.java
index 2f37957..4194ca1 100644
--- a/mnemonic-common/build.gradle
+++ b/mnemonic-common/src/main/java/org/apache/mnemonic/query/memory/ResultSet.java
@@ -6,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,16 +14,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package org.apache.mnemonic.query.memory;
-description = 'mnemonic-common'
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.Iterator;
-dependencies {
- api 'org.apache.commons:commons-lang3'
- api 'org.slf4j:slf4j-api'
- api 'org.slf4j:jul-to-slf4j'
- api 'org.slf4j:jcl-over-slf4j'
- api 'log4j:log4j'
- api 'org.slf4j:slf4j-log4j12'
- testCompileOnly 'org.testng:testng'
+public class ResultSet implements Iterable<Long>, Closeable {
+
+ private Queryable m_queryable;
+
+ private long m_qid;
+
+ public ResultSet(Queryable queryable, long qid) {
+ m_queryable = queryable;
+ m_qid = qid;
+ }
+
+ @Override
+ public Iterator<Long> iterator() {
+ return null;
+ }
+
+ @Override
+ public void close() throws IOException {
+
+ }
}
-test.useTestNG()
diff --git a/mnemonic-common/build.gradle b/mnemonic-common/src/main/java/org/apache/mnemonic/query/memory/SortOrder.java
similarity index 69%
copy from mnemonic-common/build.gradle
copy to mnemonic-common/src/main/java/org/apache/mnemonic/query/memory/SortOrder.java
index 2f37957..114a881 100644
--- a/mnemonic-common/build.gradle
+++ b/mnemonic-common/src/main/java/org/apache/mnemonic/query/memory/SortOrder.java
@@ -6,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,16 +14,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package org.apache.mnemonic.query.memory;
-description = 'mnemonic-common'
+public enum SortOrder {
+
+ NONE(1),
+ ASCENDING(2),
+ DESCENDING(3);
+
+ private int value;
+
+ SortOrder(int val) {
+ this.value = val;
+ }
+
+ public int getValue() {
+ return value;
+ }
-dependencies {
- api 'org.apache.commons:commons-lang3'
- api 'org.slf4j:slf4j-api'
- api 'org.slf4j:jul-to-slf4j'
- api 'org.slf4j:jcl-over-slf4j'
- api 'log4j:log4j'
- api 'org.slf4j:slf4j-log4j12'
- testCompileOnly 'org.testng:testng'
}
-test.useTestNG()
diff --git a/mnemonic-common/src/main/java/org/apache/mnemonic/service/computing/GeneralComputingService.java b/mnemonic-common/src/main/java/org/apache/mnemonic/service/computing/GeneralComputingService.java
new file mode 100644
index 0000000..79456a8
--- /dev/null
+++ b/mnemonic-common/src/main/java/org/apache/mnemonic/service/computing/GeneralComputingService.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mnemonic.service.computing;
+
+//import java.util.List;
+
+public interface GeneralComputingService {
+ /**
+ * Provide the service identifier for this allocator
+ *
+ * @return the service identifier of this allocator
+ */
+ String getServiceId();
+
+ /**
+ * prepare native parameter frames for native execution
+ *
+ * @param npfs
+ * a list of frame of native parameter
+ */
+ // void setNativeParameterFrames(List<List<long[]>> npfs);
+
+ /**
+ * perform native functionalities according to prepared computing parameters
+ *
+ * @param mode
+ * a selection mode of run instance
+ *
+ * @param valinfos
+ * an array of value info
+ *
+ * @return the array of handler about updated object graphs if any
+ */
+ long[] perform(String mode, ValueInfo[] valinfos);
+
+ long[] perform(String mode, ValueInfo[] valinfos, long dcHandler, long dcSize);
+
+}
diff --git a/mnemonic-common/build.gradle b/mnemonic-common/src/main/java/org/apache/mnemonic/service/computing/ValueInfo.java
similarity index 57%
copy from mnemonic-common/build.gradle
copy to mnemonic-common/src/main/java/org/apache/mnemonic/service/computing/ValueInfo.java
index 2f37957..12b8a96 100644
--- a/mnemonic-common/build.gradle
+++ b/mnemonic-common/src/main/java/org/apache/mnemonic/service/computing/ValueInfo.java
@@ -6,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,15 +15,35 @@
* limitations under the License.
*/
-description = 'mnemonic-common'
+package org.apache.mnemonic.service.computing;
+
+import org.apache.mnemonic.DurableType;
+
+public class ValueInfo {
+
+ /**
+ * a handler to a object graph
+ */
+ public long handler;
+
+ /**
+ * a table for native address mapping
+ */
+ public long[][] transtable;
+
+ /**
+ * an array of memory service functions
+ */
+ public long[] memfuncs;
+
+ /**
+ * a list of frame of native parameter
+ */
+ public long[][] frames;
+
+ /**
+ * a type of this specified value
+ */
+ public DurableType dtype;
-dependencies {
- api 'org.apache.commons:commons-lang3'
- api 'org.slf4j:slf4j-api'
- api 'org.slf4j:jul-to-slf4j'
- api 'org.slf4j:jcl-over-slf4j'
- api 'log4j:log4j'
- api 'org.slf4j:slf4j-log4j12'
- testCompileOnly 'org.testng:testng'
}
-test.useTestNG()
diff --git a/mnemonic-common/build.gradle b/mnemonic-common/src/main/java/org/apache/mnemonic/service/memory/MemoryServiceFeature.java
similarity index 66%
copy from mnemonic-common/build.gradle
copy to mnemonic-common/src/main/java/org/apache/mnemonic/service/memory/MemoryServiceFeature.java
index 2f37957..ee607c0 100644
--- a/mnemonic-common/build.gradle
+++ b/mnemonic-common/src/main/java/org/apache/mnemonic/service/memory/MemoryServiceFeature.java
@@ -6,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,16 +14,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package org.apache.mnemonic.service.memory;
-description = 'mnemonic-common'
+public enum MemoryServiceFeature {
+
+ VOLATILE(1),
+ NONVOLATILE(2),
+ TRANSACTABLE(3),
+ QUERYABLE(4),
+ ABSTRACTADDRESSING(5),
+ EXPANDABLE(6),
+ SHRINKABLE(7);
+
+ private int value;
+
+ MemoryServiceFeature(int val) {
+ this.value = val;
+ }
+
+ public int getValue() {
+ return value;
+ }
-dependencies {
- api 'org.apache.commons:commons-lang3'
- api 'org.slf4j:slf4j-api'
- api 'org.slf4j:jul-to-slf4j'
- api 'org.slf4j:jcl-over-slf4j'
- api 'log4j:log4j'
- api 'org.slf4j:slf4j-log4j12'
- testCompileOnly 'org.testng:testng'
}
-test.useTestNG()
diff --git a/mnemonic-common/src/main/java/org/apache/mnemonic/service/memory/NonVolatileMemoryAllocatorService.java b/mnemonic-common/src/main/java/org/apache/mnemonic/service/memory/NonVolatileMemoryAllocatorService.java
new file mode 100644
index 0000000..4fcc64d
--- /dev/null
+++ b/mnemonic-common/src/main/java/org/apache/mnemonic/service/memory/NonVolatileMemoryAllocatorService.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mnemonic.service.memory;
+
+import java.nio.ByteBuffer;
+
+public interface NonVolatileMemoryAllocatorService extends VolatileMemoryAllocatorService {
+
+ /**
+ * retrieve a bytebuffer from its handler
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param handler
+ * the handler of a nonvolatile bytebuffer
+ *
+ * @return the nonvolatile bytebuffer
+ *
+ */
+ ByteBuffer retrieveByteBuffer(long id, long handler);
+
+ /**
+ * retrieve the size of a nonvolatile memory object
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param addr
+ * the address of a nonvolatile object
+ *
+ * @return the size of nonvolatile object
+ *
+ */
+ long retrieveSize(long id, long addr);
+
+ /**
+ * get the handler of a nonvolatile bytebuffer
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param buf
+ * the nonvolatile bytebuffer
+ *
+ * @return the handler of this specified nonvolatile bytebuffer
+ *
+ */
+ long getByteBufferHandler(long id, ByteBuffer buf);
+
+ /**
+ * set a handler to a key.
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param key
+ * the key to set this handler
+ *
+ * @param handler
+ * the handler
+ */
+ void setHandler(long id, long key, long handler);
+
+ /**
+ * get a handler from specified key.
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param key
+ * the key to get its handler
+ *
+ * @return the handler of the specified key
+ */
+ long getHandler(long id, long key);
+
+ /**
+ * return the number of available keys to use.
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @return the number of keys
+ */
+ long handlerCapacity(long id);
+
+ /**
+ * Make any cached changes to a memory resource persistent.
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param addr
+ * the address of a memory resource
+ *
+ * @param length
+ * the length of the memory resource
+ *
+ * @param autodetect
+ * if NULL == address and autodetect : persist whole pool
+ * if 0L == length and autodetect : persist block
+ */
+ void syncToNonVolatileMemory(long id, long addr, long length, boolean autodetect);
+
+ /**
+ * flush processors cache for a memory resource
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param addr
+ * the address of a memory resource
+ *
+ * @param length
+ * the length of the memory resource
+ *
+ * @param autodetect
+ * if NULL == address and autodetect : flush whole pool
+ * if 0L == length and autodetect : flush block
+ */
+ void syncToLocal(long id, long addr, long length, boolean autodetect);
+
+ /**
+ * wait for any memory resource stores to drain from HW buffers.
+ *
+ * @param id
+ * the identifier of backed memory pool
+ */
+ void drain(long id);
+
+ /**
+ * return the base address of this persistent memory pool.
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @return the base address of this pmem pool
+ */
+ long getBaseAddress(long id);
+
+}
diff --git a/mnemonic-common/src/main/java/org/apache/mnemonic/service/memory/QueryableService.java b/mnemonic-common/src/main/java/org/apache/mnemonic/service/memory/QueryableService.java
new file mode 100644
index 0000000..7a527fd
--- /dev/null
+++ b/mnemonic-common/src/main/java/org/apache/mnemonic/service/memory/QueryableService.java
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.mnemonic.service.memory;
+
+import org.apache.mnemonic.query.memory.EntityInfo;
+import org.apache.mnemonic.query.memory.ResultSet;
+import org.apache.mnemonic.service.computing.ValueInfo;
+
+public interface QueryableService {
+ /**
+ * Retrieve existing class names
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @return an array of class names
+ */
+ String[] getClassNames(long id);
+
+ /**
+ * Retrieve existing entity names according to specified class name
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param clsname
+ * specify the class name
+ *
+ * @return an array of entity names
+ */
+ String[] getEntityNames(long id, String clsname);
+
+ /**
+ * retrieve entity info
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param clsname
+ * specify a class name
+ *
+ * @param etyname
+ * specify a entity name
+ *
+ * @return an entity info
+ */
+ EntityInfo getEntityInfo(long id, String clsname, String etyname);
+
+ /**
+ * create an entity
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param entityinfo
+ * specify an entity info to create
+ */
+ void createEntity(long id, EntityInfo entityinfo);
+
+ /**
+ * destroy an entity
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param clsname
+ * specify a class name
+ *
+ * @param etyname
+ * specify an entity name
+ */
+ void destroyEntity(long id, String clsname, String etyname);
+
+ /**
+ * update entity queryable info for a set of durable objects
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param clsname
+ * specify a class name
+ *
+ * @param etyname
+ * specify an entity name
+ *
+ * @param updobjs
+ * specify a set of durable objects for update
+ */
+ void updateQueryableInfo(long id, String clsname, String etyname, ValueInfo updobjs);
+
+ /**
+ * delete a set of durable objects
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param clsname
+ * specify a class name
+ *
+ * @param etyname
+ * specify an entity name
+ *
+ * @param updobjs
+ * specify a set of durable objects to delete
+ */
+ void deleteQueryableInfo(long id, String clsname, String etyname, ValueInfo updobjs);
+
+ /**
+ * do query using a querying string
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param querystr
+ * specify a query string
+ *
+ * @return a result set
+ */
+ ResultSet query(long id, String querystr);
+
+}
diff --git a/mnemonic-common/src/main/java/org/apache/mnemonic/service/memory/VolatileMemoryAllocatorService.java b/mnemonic-common/src/main/java/org/apache/mnemonic/service/memory/VolatileMemoryAllocatorService.java
new file mode 100644
index 0000000..b856299
--- /dev/null
+++ b/mnemonic-common/src/main/java/org/apache/mnemonic/service/memory/VolatileMemoryAllocatorService.java
@@ -0,0 +1,353 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mnemonic.service.memory;
+
+import org.flowcomputing.commons.resgc.ReclaimContext;
+
+import java.nio.ByteBuffer;
+import java.util.Set;
+
+public interface VolatileMemoryAllocatorService extends QueryableService {
+
+
+ /**
+ * retrieve a bytebuffer from its handler
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param handler
+ * the handler of a nonvolatile bytebuffer
+ *
+ * @return the nonvolatile bytebuffer
+ *
+ */
+ ByteBuffer retrieveByteBuffer(long id, long handler);
+
+ /**
+ * retrieve the size of a nonvolatile memory object
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param handler
+ * the handler of a nonvolatile object
+ *
+ * @return the size of nonvolatile object
+ *
+ */
+ long retrieveSize(long id, long handler);
+
+ /**
+ * get the handler of a nonvolatile bytebuffer
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param buf
+ * the nonvolatile bytebuffer
+ *
+ * @return the handler of this specified nonvolatile bytebuffer
+ *
+ */
+ long getByteBufferHandler(long id, ByteBuffer buf);
+
+ /**
+ * set a handler to a key.
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param key
+ * the key to set this handler
+ *
+ * @param handler
+ * the handler
+ */
+ void setHandler(long id, long key, long handler);
+
+ /**
+ * get a handler from specified key.
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param key
+ * the key to get its handler
+ *
+ * @return the handler of the specified key
+ */
+ long getHandler(long id, long key);
+
+ /**
+ * return the number of available keys to use.
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @return the number of keys
+ */
+ long handlerCapacity(long id);
+
+ /**
+ * return the base address of this persistent memory pool.
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @return the base address of this pmem pool
+ */
+ long getBaseAddress(long id);
+
+ /**
+ * Provide the service identifier for this allocator
+ *
+ * @return the service identifier of this allocator
+ */
+ String getServiceId();
+
+ /**
+ * Initialize a memory pool through native interface backed by native library.
+ *
+ * @param capacity
+ * the capacity of memory pool
+ *
+ * @param uri
+ * the location of memory pool will be created
+ *
+ * @param isnew
+ * a place holder, always specify it as true
+ *
+ * @return the identifier of created memory pool
+ */
+ long init(long capacity, String uri, boolean isnew);
+
+ /**
+ * Adjust the capacity of a memory pool
+ *
+ * @param id
+ * specify the id of underlying native allocator
+ *
+ * @param reserve
+ * reserve certain amount of memory space in tail for use
+ *
+ * @return the new capacity
+ */
+ long adjustCapacity(long id, long reserve);
+
+ /**
+ * close the memory pool through native interface.
+ *
+ * @param id
+ * specify the id of underlying native allocator
+ */
+ void close(long id);
+
+ /**
+ * force to synchronize an uncommitted data to backed memory pool.
+ *
+ * @param id
+ * specify the id of underlying native allocator
+ *
+ * @param addr
+ * the address of a memory resource
+ *
+ * @param length
+ * the length of the memory resource
+ *
+ * @param autodetect
+ * if NULL == address and autodetect : sync. whole pool
+ * if 0L == length and autodetect : sync. block
+ */
+ void syncToVolatileMemory(long id, long addr, long length, boolean autodetect);
+
+ /**
+ * get the capacity of its managed memory space
+ *
+ * @param id
+ * specify the id of underlying native allocator
+ *
+ * @return the capacity of this allocator managed memory resource/device
+ */
+ long capacity(long id);
+
+ /**
+ * allocate specified size of memory block from backed memory pool.
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param size
+ * specify size of memory block to be allocated
+ *
+ * @param initzero
+ * indicate if initialize it with zeros
+ *
+ * @return the address of allocated memory block from native memory pool
+ */
+ long allocate(long id, long size, boolean initzero);
+
+ /**
+ * reallocate a specified size of memory block from backed memory pool.
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param addr
+ * the address of previous allocated memory block. it can be null.
+ *
+ * @param size
+ * specify new size of memory block to be reallocated
+ *
+ * @param initzero
+ * indicate if initialize it with zeros
+ *
+ * @return the address of reallocated memory block from native memory pool
+ */
+ long reallocate(long id, long addr, long size, boolean initzero);
+
+ /**
+ * free a memory block by specify its address into backed memory pool.
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param addr
+ * the address of allocated memory block.
+ *
+ * @param rctx
+ * the reclaim context.
+ */
+ void free(long id, long addr, ReclaimContext rctx);
+
+ /**
+ * create a ByteBuffer object which backed buffer is coming from backed native
+ * memory pool.
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param size
+ * the size of backed buffer that is managed by created ByteBuffer
+ * object.
+ *
+ * @return a created ByteBuffer object with a backed native memory block
+ */
+ ByteBuffer createByteBuffer(long id, long size);
+
+ /**
+ * resize a ByteBuffer object which backed buffer is coming from backed native
+ * memory pool. NOTE: the ByteBuffer object will be renewed and lost metadata
+ * e.g. position, mark and etc.
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param bytebuf
+ * the specified ByteBuffer object to be destroyed
+ *
+ * @param size
+ * the new size of backed buffer that is managed by created
+ * ByteBuffer object.
+ *
+ * @return a created ByteBuffer object with a backed native memory block
+ */
+ ByteBuffer resizeByteBuffer(long id, ByteBuffer bytebuf, long size);
+
+ /**
+ * destroy a native memory block backed ByteBuffer object.
+ *
+ * @param id
+ * the identifier of backed memory pool
+ *
+ * @param bytebuf
+ * the specified ByteBuffer object to be destroyed
+ *
+ * @param rctx
+ * the reclaim context.
+ */
+ void destroyByteBuffer(long id, ByteBuffer bytebuf, ReclaimContext rctx);
+
+ /**
+ * begin a transaction
+ * @param readOnly
+ * specify if the transaction is readonly
+ */
+ void beginTransaction(boolean readOnly);
+
+ /**
+ * commit current transaction
+ */
+ void commitTransaction();
+
+ /**
+ * abort current transaction
+ */
+ void abortTransaction();
+
+ /**
+ * determine if in a transaction
+ * @return the true if it is in a transaction
+ */
+ boolean isInTransaction();
+
+ /**
+ * provide a set of features that the memory service can offer
+ *
+ * @return a set of features that supported by this memory service
+ */
+ Set<MemoryServiceFeature> getFeatures();
+
+ /**
+ * calculate the abstract address from portable address
+ *
+ * @param addr
+ * the portable address
+ *
+ * @return the abstract address
+ */
+ byte[] getAbstractAddress(long addr);
+
+ /**
+ * translate the portable address
+ *
+ * @param addr
+ * the address to be translated
+ *
+ * @return the portable address
+ */
+ long getPortableAddress(long addr);
+
+ /**
+ * translate the effective address
+ *
+ * @param addr
+ * the address to be translated
+ *
+ * @return the effective address
+ */
+ long getEffectiveAddress(long addr);
+
+ /**
+ * retrieve an array of memory functions
+ *
+ * @return an memory function array
+ */
+ long[] getMemoryFunctions();
+
+}