You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mnemonic.apache.org by yz...@apache.org on 2021/02/22 03:25:10 UTC
[mnemonic] branch master updated: MNEMONIC-611: Cleanup query,
service-memory, service-computing interface from mnemonic-core
This is an automated email from the ASF dual-hosted git repository.
yzhao 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 7dc6faf MNEMONIC-611: Cleanup query, service-memory, service-computing interface from mnemonic-core
7dc6faf is described below
commit 7dc6faf7211d9363bc503cb7aeb4cc1b7b814297
Author: Zhen Li <rh...@gmail.com>
AuthorDate: Fri Feb 19 23:30:56 2021 -0800
MNEMONIC-611: Cleanup query, service-memory, service-computing interface from mnemonic-core
Signed-off-by: Zhen Li <rh...@gmail.com>
---
mnemonic-core/build.gradle | 1 +
mnemonic-core/pom.xml | 5 +
.../service/computing/GeneralComputingService.java | 53 ----
.../mnemonic/service/computing/ValueInfo.java | 49 ---
.../service/memory/MemoryServiceFeature.java | 39 ---
.../memory/NonVolatileMemoryAllocatorService.java | 157 ---------
.../mnemonic/service/memory/QueryableService.java | 135 --------
.../memory/VolatileMemoryAllocatorService.java | 353 ---------------------
8 files changed, 6 insertions(+), 786 deletions(-)
diff --git a/mnemonic-core/build.gradle b/mnemonic-core/build.gradle
index 010a8fb..1a4c56e 100644
--- a/mnemonic-core/build.gradle
+++ b/mnemonic-core/build.gradle
@@ -24,6 +24,7 @@ compileTestJava {
}
dependencies {
+ api project(':mnemonic-common')
api 'org.apache.commons:commons-lang3'
api 'org.flowcomputing.commons:commons-resgc'
api 'org.flowcomputing.commons:commons-primitives'
diff --git a/mnemonic-core/pom.xml b/mnemonic-core/pom.xml
index 1326f64..0709b18 100644
--- a/mnemonic-core/pom.xml
+++ b/mnemonic-core/pom.xml
@@ -74,6 +74,11 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.mnemonic</groupId>
+ <artifactId>mnemonic-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
diff --git a/mnemonic-core/src/main/java/org/apache/mnemonic/service/computing/GeneralComputingService.java b/mnemonic-core/src/main/java/org/apache/mnemonic/service/computing/GeneralComputingService.java
deleted file mode 100644
index 79456a8..0000000
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/service/computing/GeneralComputingService.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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-core/src/main/java/org/apache/mnemonic/service/computing/ValueInfo.java b/mnemonic-core/src/main/java/org/apache/mnemonic/service/computing/ValueInfo.java
deleted file mode 100644
index 12b8a96..0000000
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/service/computing/ValueInfo.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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 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;
-
-}
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
deleted file mode 100644
index ee607c0..0000000
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/MemoryServiceFeature.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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;
-
-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;
- }
-
-}
diff --git a/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/NonVolatileMemoryAllocatorService.java b/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/NonVolatileMemoryAllocatorService.java
deleted file mode 100644
index 4fcc64d..0000000
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/NonVolatileMemoryAllocatorService.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * 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-core/src/main/java/org/apache/mnemonic/service/memory/QueryableService.java b/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/QueryableService.java
deleted file mode 100644
index 7a527fd..0000000
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/QueryableService.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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-core/src/main/java/org/apache/mnemonic/service/memory/VolatileMemoryAllocatorService.java b/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/VolatileMemoryAllocatorService.java
deleted file mode 100644
index b856299..0000000
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/VolatileMemoryAllocatorService.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * 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();
-
-}