├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── mnemonic-core ├── src │ ├── main │ │ ├── resources │ │ │ ├── META-INFO │ │ │ │ └── services │ │ │ │ │ └── javax.annotation.processing.Processor │ │ │ └── log4j2.xml │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── mnemonic │ │ │ ├── RestorableAllocator.java │ │ │ ├── GenericTypeError.java │ │ │ ├── IllegalAllocatorError.java │ │ │ ├── ConfigurationException.java │ │ │ ├── query │ │ │ └── memory │ │ │ │ ├── SortOrder.java │ │ │ │ ├── ResultSet.java │ │ │ │ └── EntityInfo.java │ │ │ ├── RetrieveDurableEntityError.java │ │ │ ├── AddressTranslateError.java │ │ │ ├── OutOfHybridMemory.java │ │ │ ├── CloseableIterator.java │ │ │ ├── HandlerStore.java │ │ │ ├── DurableEntity.java │ │ │ ├── RefBreak.java │ │ │ ├── RestoreDurableEntityError.java │ │ │ ├── DurableSetter.java │ │ │ ├── OutOfBoundsException.java │ │ │ ├── ReferenceBreakingException.java │ │ │ ├── DurableType.java │ │ │ ├── ContainerOverflowException.java │ │ │ ├── Transaction.java │ │ │ ├── DurableGetter.java │ │ │ ├── AnnotationProcessingException.java │ │ │ ├── Reclaim.java │ │ │ ├── EvictFilter.java │ │ │ ├── DropEvent.java │ │ │ └── MemoryDurableEntity.java │ └── test │ │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── mnemonic │ │ │ └── Payload.java │ │ └── resources │ │ └── testng.xml └── build.gradle ├── NOTICE ├── mnemonic-memory-services ├── mnemonic-nvml-vmem-service │ └── src │ │ └── main │ │ ├── resources │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService │ │ └── log4j2.xml │ │ └── native │ │ ├── config.h.in │ │ ├── org_apache_mnemonic_service_memory_internal_VMemServiceImpl.h │ │ └── common.h ├── mnemonic-redis-service │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── META-INF │ │ │ │ └── services │ │ │ │ │ └── org.apache.mnemonic.service.memory.NonVolatileMemoryAllocatorService │ │ │ └── log4j2.xml │ │ │ └── native │ │ │ ├── config.h.in │ │ │ └── org_apache_mnemonic_service_memory_internal_RedisServiceImpl.h │ └── build.gradle ├── mnemonic-java-vmem-service │ ├── src │ │ ├── main │ │ │ └── resources │ │ │ │ ├── META-INF │ │ │ │ └── services │ │ │ │ │ └── org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService │ │ │ │ └── log4j2.xml │ │ └── test │ │ │ └── resources │ │ │ └── testng.xml │ └── build.gradle ├── mnemonic-nvml-pmem-service │ └── src │ │ └── main │ │ ├── resources │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── org.apache.mnemonic.service.memory.NonVolatileMemoryAllocatorService │ │ └── log4j2.xml │ │ └── native │ │ ├── config.h.in │ │ ├── layout.h │ │ ├── common.h │ │ └── org_apache_mnemonic_service_memory_internal_PMemServiceImpl.h ├── mnemonic-pmalloc-service │ └── src │ │ └── main │ │ ├── resources │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── org.apache.mnemonic.service.memory.NonVolatileMemoryAllocatorService │ │ └── log4j2.xml │ │ └── native │ │ ├── config.h.in │ │ ├── pmvalloc.c │ │ ├── pmcalloc.c │ │ ├── pmsync.c │ │ ├── pmreport.c │ │ ├── pmdetach.c │ │ ├── pmaddress.c │ │ ├── pmkeys.c │ │ ├── pmalloc.c │ │ ├── pmfree.c │ │ ├── org_apache_mnemonic_service_memory_internal_PMallocServiceImpl.h │ │ └── pmalign.c ├── mnemonic-pmdk-vmem-service │ └── src │ │ └── main │ │ ├── resources │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService │ │ └── log4j2.xml │ │ └── native │ │ ├── config.h.in │ │ ├── common.h │ │ └── org_apache_mnemonic_service_memory_internal_PMDKVMemServiceImpl.h ├── mnemonic-sys-vmem-service │ └── src │ │ └── main │ │ ├── resources │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService │ │ └── log4j2.xml │ │ └── native │ │ ├── config.h.in │ │ └── org_apache_mnemonic_service_memory_internal_SysVMemServiceImpl.h ├── mnemonic-memkind-pmem-service │ └── src │ │ └── main │ │ ├── resources │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService │ │ └── log4j2.xml │ │ └── native │ │ ├── config.h.in │ │ ├── common.h │ │ └── org_apache_mnemonic_service_memory_internal_VMemKindServiceImpl.h └── mnemonic-pmdk-pmem-service │ └── src │ └── main │ ├── resources │ ├── META-INF │ │ └── services │ │ │ └── org.apache.mnemonic.service.memory.NonVolatileMemoryAllocatorService │ └── log4j2.xml │ └── native │ ├── config.h.in │ ├── layout.h │ └── common.h ├── mnemonic-computing-services └── mnemonic-utilities-service │ └── src │ ├── main │ ├── resources │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── org.apache.mnemonic.service.computing.GeneralComputingService │ │ └── log4j2.xml │ └── native │ │ ├── config.h.in │ │ ├── org_apache_mnemonic_service_computing_internal_SortServiceImpl.h │ │ └── org_apache_mnemonic_service_computing_internal_PrintServiceImpl.h │ └── test │ └── resources │ └── testng.xml ├── mnemonic-examples ├── README.md ├── src │ └── main │ │ └── resources │ │ └── log4j2.xml └── build.gradle ├── mnemonic-protocol ├── Cargo.toml ├── service │ ├── src │ │ └── main.rs │ └── Cargo.toml ├── client │ ├── Cargo.toml │ └── src │ │ └── main.rs └── protocol │ ├── Cargo.toml │ └── src │ └── lib.rs ├── .gitignore ├── tools ├── find-mnemonic-home.sh └── suppressions.xml ├── .devcontainer ├── docker-compose.devcontainer.yml ├── devcontainer.json └── Dockerfile ├── mnemonic-spark └── mnemonic-spark-core │ └── src │ ├── main │ ├── scala │ │ └── org │ │ │ └── apache │ │ │ └── mnemonic │ │ │ └── spark │ │ │ ├── DurableException.scala │ │ │ └── DurableSparkFunctions.scala │ └── resources │ │ └── log4j2.xml │ └── test │ ├── scala │ └── org │ │ └── apache │ │ └── mnemonic │ │ └── spark │ │ └── TestSpec.scala │ └── resources │ └── testng.xml ├── .gitattributes ├── mnemonic-common ├── build.gradle └── src │ └── main │ ├── java │ └── org │ │ └── apache │ │ └── mnemonic │ │ ├── resgc │ │ ├── ReclaimContext.java │ │ ├── ContextWrapper.java │ │ ├── ResReclaim.java │ │ ├── ResReclaimContext.java │ │ └── ResContextWrapper.java │ │ ├── ConfigurationException.java │ │ ├── service │ │ ├── memory │ │ │ └── MemoryServiceFeature.java │ │ └── computing │ │ │ └── ValueInfo.java │ │ ├── DurableType.java │ │ └── query │ │ └── memory │ │ └── SortOrder.java │ └── resources │ └── log4j2.xml ├── .vscode └── settings.json ├── mnemonic-benches ├── mnemonic-spark-kmeans-bench │ ├── README.md │ └── bin │ │ └── benchcommon.py └── mnemonic-sort-bench │ ├── src │ └── main │ │ └── java │ │ └── org │ │ └── apache │ │ └── mnemonic │ │ └── bench │ │ └── TextFileSort.java │ └── build.gradle ├── mnemonic-sessions ├── src │ ├── main │ │ ├── resources │ │ │ └── log4j2.xml │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── mnemonic │ │ │ └── sessions │ │ │ ├── InputSession.java │ │ │ ├── DurableComputable.java │ │ │ ├── TransformFunction.java │ │ │ ├── OutputSession.java │ │ │ └── ObjectCreator.java │ └── test │ │ └── resources │ │ └── testng.xml └── build.gradle ├── mnemonic-collections ├── src │ ├── main │ │ └── resources │ │ │ └── log4j2.xml │ └── test │ │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── mnemonic │ │ │ └── collections │ │ │ └── Payload.java │ │ └── resources │ │ └── testng.xml ├── build.gradle └── proguard.conf ├── mnemonic-hadoop └── mnemonic-hadoop-mapreduce │ ├── src │ ├── main │ │ ├── resources │ │ │ └── log4j2.xml │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── mnemonic │ │ │ └── hadoop │ │ │ ├── mapred │ │ │ ├── MneMapredRecordWriter.java │ │ │ └── MneOutputFormat.java │ │ │ └── mapreduce │ │ │ ├── MneOutputFormat.java │ │ │ └── MneMapreduceRecordWriter.java │ └── test │ │ └── resources │ │ └── testng.xml │ └── build.gradle ├── .github └── workflows │ └── docker_ubuntu.yml ├── README.md ├── .asf.yaml └── docker └── docker-Fedora └── Dockerfile /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/mnemonic/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /mnemonic-core/src/main/resources/META-INFO/services/javax.annotation.processing.Processor: -------------------------------------------------------------------------------- 1 | org.apache.mnemonic.DurableEntityProcessor 2 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Apache Mnemonic 2 | Copyright 2015 - 2021 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService: -------------------------------------------------------------------------------- 1 | org.apache.mnemonic.service.memory.internal.VMemServiceImpl 2 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-redis-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.NonVolatileMemoryAllocatorService: -------------------------------------------------------------------------------- 1 | org.apache.mnemonic.service.memory.internal.RedisServiceImpl 2 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-java-vmem-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService: -------------------------------------------------------------------------------- 1 | org.apache.mnemonic.service.memory.internal.JavaVMemServiceImpl 2 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.NonVolatileMemoryAllocatorService: -------------------------------------------------------------------------------- 1 | org.apache.mnemonic.service.memory.internal.PMemServiceImpl 2 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmalloc-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.NonVolatileMemoryAllocatorService: -------------------------------------------------------------------------------- 1 | org.apache.mnemonic.service.memory.internal.PMallocServiceImpl 2 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmdk-vmem-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService: -------------------------------------------------------------------------------- 1 | org.apache.mnemonic.service.memory.internal.PMDKVMemServiceImpl 2 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-sys-vmem-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService: -------------------------------------------------------------------------------- 1 | org.apache.mnemonic.service.memory.internal.SysVMemServiceImpl 2 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-memkind-pmem-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService: -------------------------------------------------------------------------------- 1 | org.apache.mnemonic.service.memory.internal.PMDKVMemServiceImpl 2 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmdk-pmem-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.NonVolatileMemoryAllocatorService: -------------------------------------------------------------------------------- 1 | org.apache.mnemonic.service.memory.internal.PMDKPMemServiceImpl 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /mnemonic-computing-services/mnemonic-utilities-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.computing.GeneralComputingService: -------------------------------------------------------------------------------- 1 | org.apache.mnemonic.service.computing.internal.PrintServiceImpl 2 | org.apache.mnemonic.service.computing.internal.SortServiceImpl 3 | -------------------------------------------------------------------------------- /mnemonic-examples/README.md: -------------------------------------------------------------------------------- 1 | # Mnemonic Examples 2 | 3 | The examples demonstrate how to use the [Mnemonic](http://mnemonic.apache.org/). 4 | 5 | To run the default example [Main](src/main/java/org/apache/mnemonic/examples/Main.java): 6 | ```bash 7 | $ # requires 'vmem' memory service to run, please refer to the code of test cases for details. 8 | $ mvn exec:exec -Pexample -pl mnemonic-examples 9 | ``` 10 | 11 | 12 | To run a specific example by providing the example name under the [examples](src/main/java/org/apache/mnemonic/examples): 13 | ```bash 14 | $ mvn exec:exec -Pexample -pl mnemonic-examples -Dexample.name= [-Dexample.args=""] 15 | ``` 16 | 17 | 18 | For how to run the examples in the [Docker](https://www.docker.com), please refer to the [Docker usage](http://mnemonic.apache.org/docs/docker.html) at the documentation of Mnemonic. 19 | -------------------------------------------------------------------------------- /mnemonic-protocol/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [workspace] 19 | 20 | members = ["protocol","service"] 21 | -------------------------------------------------------------------------------- /mnemonic-protocol/service/src/main.rs: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | fn main() { 19 | println!("Hello, world!"); 20 | } 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | .project 3 | .settings/ 4 | .gradle/ 5 | target/ 6 | *~ 7 | *.lo 8 | *.o 9 | *.la 10 | *.so 11 | *.class 12 | *.jar 13 | *.war 14 | *.ear 15 | hs_err_pid* 16 | **/build/ 17 | **/CMakeFiles/ 18 | *.cmake 19 | gradle-app.setting 20 | gradle.properties 21 | !gradle-wrapper.jar 22 | test-output/ 23 | build/ 24 | aclocal.m4 25 | configure 26 | dist 27 | m4 28 | Makefile.in 29 | ar-lib 30 | compile 31 | config.guess 32 | config.sub 33 | depcomp 34 | install-sh 35 | ltmain.sh 36 | missing 37 | .deps/ 38 | .libs/ 39 | Makefile 40 | config.h 41 | config.log 42 | config.status 43 | libtool 44 | stamp-h1 45 | autom4te.cache/ 46 | *.dat 47 | *.log 48 | core.* 49 | \#* 50 | .\#* 51 | dependency-reduced-pom.xml 52 | service-dist/ 53 | .*.html 54 | testlog/ 55 | .DS_Store 56 | *.patch 57 | *.swp 58 | *.pyc 59 | .cache-tests 60 | .cache-main 61 | *.mne 62 | *.iml 63 | .idea/ 64 | GPATH 65 | GRTAGS 66 | GTAGS 67 | TAGS 68 | .dccache 69 | Cargo.lock 70 | snyk-* 71 | .history/ 72 | -------------------------------------------------------------------------------- /tools/find-mnemonic-home.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one or more 5 | # contributor license agreements. See the NOTICE file distributed with 6 | # this work for additional information regarding copyright ownership. 7 | # The ASF licenses this file to You under the Apache License, Version 2.0 8 | # (the "License"); you may not use this file except in compliance with 9 | # the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | if [ -z "${MNEMONIC_HOME}" ]; then 21 | export MNEMONIC_HOME="$(cd "$(dirname "$0")"/..; pwd)" 22 | fi 23 | 24 | -------------------------------------------------------------------------------- /.devcontainer/docker-compose.devcontainer.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | services: 19 | mnemonic: 20 | build: . 21 | command: /bin/sh -c "while sleep 1000; do :; done" 22 | volumes: 23 | - ..:/ws/mnemonic:cached 24 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/config.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef GUARD 20 | #define GUARD 21 | 22 | #cmakedefine _CONFIG_HEADER_H_ 23 | 24 | #endif //GUARD 25 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-redis-service/src/main/native/config.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef GUARD 20 | #define GUARD 21 | 22 | #cmakedefine _CONFIG_HEADER_H_ 23 | 24 | #endif //GUARD 25 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-sys-vmem-service/src/main/native/config.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef GUARD 20 | #define GUARD 21 | 22 | #cmakedefine _CONFIG_HEADER_H_ 23 | 24 | #endif //GUARD 25 | -------------------------------------------------------------------------------- /mnemonic-computing-services/mnemonic-utilities-service/src/main/native/config.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef GUARD 20 | #define GUARD 21 | 22 | #cmakedefine _CONFIG_HEADER_H_ 23 | 24 | #endif //GUARD 25 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-memkind-pmem-service/src/main/native/config.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef GUARD 20 | #define GUARD 21 | 22 | #cmakedefine _CONFIG_HEADER_H_ 23 | 24 | #endif //GUARD 25 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/native/config.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef GUARD 20 | #define GUARD 21 | 22 | #cmakedefine _CONFIG_HEADER_H_ 23 | 24 | #endif //GUARD 25 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/config.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef GUARD 20 | #define GUARD 21 | 22 | #cmakedefine _CONFIG_HEADER_H_ 23 | 24 | #endif //GUARD 25 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmdk-pmem-service/src/main/native/config.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef GUARD 20 | #define GUARD 21 | 22 | #cmakedefine _CONFIG_HEADER_H_ 23 | 24 | #endif //GUARD 25 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmdk-vmem-service/src/main/native/config.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef GUARD 20 | #define GUARD 21 | 22 | #cmakedefine _CONFIG_HEADER_H_ 23 | 24 | #endif //GUARD 25 | -------------------------------------------------------------------------------- /mnemonic-protocol/client/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [package] 19 | name = "my_http_client_project" 20 | version = "0.1.0" 21 | edition = "2021" 22 | 23 | [dependencies] 24 | reqwest = "0.11" 25 | tokio = { version = "1", features = ["full"] } 26 | 27 | -------------------------------------------------------------------------------- /mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/DurableException.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic.spark 19 | 20 | class DurableException(msg: String) extends RuntimeException(msg) { 21 | 22 | } -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/RestorableAllocator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | public abstract class RestorableAllocator> extends RetrievableAllocator { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /mnemonic-protocol/protocol/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [package] 19 | name = "protocol" 20 | version = "0.1.0" 21 | edition = "2021" 22 | 23 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 24 | 25 | [dependencies] 26 | -------------------------------------------------------------------------------- /mnemonic-protocol/service/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [package] 19 | name = "service" 20 | version = "0.1.0" 21 | edition = "2021" 22 | 23 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 24 | 25 | [dependencies] 26 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Auto detect text files and perform LF normalization 19 | * text=auto 20 | 21 | *.java text diff=java eol=lf 22 | *.py text diff=python eol=lf 23 | *.c text eol=lf 24 | *.xml text eol=lf 25 | 26 | *.sh text eol=lf 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /mnemonic-common/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | description = 'mnemonic-common' 19 | 20 | dependencies { 21 | api 'org.apache.commons:commons-lang3' 22 | api 'org.apache.logging.log4j:log4j-slf4j-impl' 23 | testCompileOnly 'org.testng:testng' 24 | } 25 | test.useTestNG() 26 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | { 19 | "atlascode.enableCurlLogging": false, 20 | "atlascode.jira.showCreateIssueProblems": false, 21 | "atlascode.enableCharles": false, 22 | "atlascode.bitbucket.enabled": false, 23 | "java.compile.nullAnalysis.mode": "automatic" 24 | } -------------------------------------------------------------------------------- /mnemonic-common/src/main/java/org/apache/mnemonic/resgc/ReclaimContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic.resgc; 19 | 20 | /** 21 | * the context interface for reclaim operation. 22 | * 23 | */ 24 | public interface ReclaimContext extends Cloneable { 25 | 26 | ReclaimContext clone(); 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/pmvalloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "pminternal.h" 19 | 20 | static size_t pagesize; 21 | 22 | void * pmvalloc(void *md, size_t size) { 23 | if (pagesize == 0) { 24 | pagesize = getpagesize(); 25 | } 26 | 27 | return (pmalign(md, pagesize, size)); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /tools/suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /mnemonic-spark/mnemonic-spark-core/src/test/scala/org/apache/mnemonic/spark/TestSpec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic.spark 19 | 20 | import org.scalatest.FlatSpec 21 | import org.scalatest.Matchers 22 | import org.scalatest.BeforeAndAfter 23 | 24 | abstract class TestSpec extends FlatSpec with Matchers with BeforeAndAfter { 25 | 26 | } -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/GenericTypeError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | public class GenericTypeError extends RuntimeException { 21 | 22 | /** 23 | * 24 | */ 25 | private static final long serialVersionUID = 1L; 26 | 27 | public GenericTypeError(String s) { 28 | super(s); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/pmcalloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "pminternal.h" 19 | 20 | void * pmcalloc(void * md, size_t nmemb, size_t size) { 21 | register void * result; 22 | 23 | if ((result = pmalloc(md, nmemb * size)) != NULL) { 24 | memset(result, 0, nmemb * size); 25 | } 26 | return (result); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/IllegalAllocatorError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | public class IllegalAllocatorError extends RuntimeException { 21 | 22 | /** 23 | * 24 | */ 25 | private static final long serialVersionUID = 1L; 26 | 27 | public IllegalAllocatorError(String s) { 28 | super(s); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/pmsync.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "pminternal.h" 19 | 20 | int pmsync(void *md, void *addr, size_t length) { 21 | struct mdesc *mdp = (struct mdesc *) md; 22 | int result = -1; 23 | if (mdp->mempoolbase < (char*)addr && length > 0) { 24 | result = msync(addr, length, MS_SYNC); 25 | } 26 | return (result); 27 | } 28 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/ConfigurationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.apache.mnemonic; 19 | 20 | public class ConfigurationException extends RuntimeException { 21 | /** 22 | * 23 | */ 24 | private static final long serialVersionUID = -5833073069136059211L; 25 | 26 | public ConfigurationException(String msg) { 27 | super(msg); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /mnemonic-common/src/main/java/org/apache/mnemonic/ConfigurationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.apache.mnemonic; 19 | 20 | public class ConfigurationException extends RuntimeException { 21 | /** 22 | * 23 | */ 24 | private static final long serialVersionUID = -5833073069136059211L; 25 | 26 | public ConfigurationException(String msg) { 27 | super(msg); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/query/memory/SortOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.mnemonic.query.memory; 18 | 19 | public enum SortOrder { 20 | 21 | NONE(1), 22 | ASCENDING(2), 23 | DESCENDING(3); 24 | 25 | private int value; 26 | 27 | SortOrder(int val) { 28 | this.value = val; 29 | } 30 | 31 | public int getValue() { 32 | return value; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /mnemonic-benches/mnemonic-spark-kmeans-bench/README.md: -------------------------------------------------------------------------------- 1 | ### Generate dataset 2 | 3 | 4 | ```bash 5 | $ tools/gen_data.py [-s seed] 6 | ``` 7 | 8 | 9 | ### Configure Apache Spark 10 | 11 | ```text 12 | # conf/spark-defaults.conf for local mode 13 | 14 | spark.master local[4,0] 15 | 16 | spark.executor.memory 17 | 18 | spark.driver.memory 19 | 20 | spark.local.dir 21 | 22 | spark.jars /target/service-dist/mnemonic-pmalloc-service--linux-x86_64.jar,/target/service-dist/mnemonic-nvml-pmem-service--linux-x86_64.jar 23 | 24 | 25 | ``` 26 | 27 | 28 | ### Run Apache Spark Benchmark Workloads 29 | 30 | 31 | ```bash 32 | # regular version 33 | $ $SPARK_HOME/bin/spark-submit --class org.apache.mnemonic.bench.RegularKMeans --conf spark.durable-basedir=./mne mnemonic/mnemonic-benches/mnemonic-spark-kmeans-bench/target/mnemonic-spark-kmeans-bench-.jar 34 | 35 | # durable version 36 | $ $SPARK_HOME/bin/spark-submit --class org.apache.mnemonic.bench.DurableKMeans --conf spark.durable-basedir=./mne mnemonic/mnemonic-benches/mnemonic-spark-kmeans-bench/target/mnemonic-spark-kmeans-bench-.jar 37 | ``` 38 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/pmreport.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "pmfunction.h" 19 | #include "pminternal.h" 20 | 21 | 22 | size_t report_used_inbyte(struct mdesc * mdp) 23 | { 24 | assert(NULL != mdp); 25 | return mdp -> mblkstats.bytes_used; 26 | } 27 | 28 | size_t report_free_inbyte(struct mdesc * mdp) 29 | { 30 | assert(NULL != mdp); 31 | return mdp -> mblkstats.bytes_free; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/RetrieveDurableEntityError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | /** 21 | * 22 | * 23 | */ 24 | 25 | public class RetrieveDurableEntityError extends RuntimeException { 26 | 27 | /** 28 | * 29 | */ 30 | private static final long serialVersionUID = 3985459401986971131L; 31 | 32 | public RetrieveDurableEntityError(String s) { 33 | super(s); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/AddressTranslateError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | public class AddressTranslateError extends RuntimeException { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | /** 25 | * construct an error instance 26 | * @param s 27 | * specify an error information 28 | */ 29 | public AddressTranslateError(String s) { 30 | super(s); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/OutOfHybridMemory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | /** 21 | * this is an exception that should be throw once out of persistent memory 22 | * 23 | */ 24 | 25 | public class OutOfHybridMemory extends RuntimeException { 26 | 27 | private static final long serialVersionUID = -6315943783592441148L; 28 | 29 | public OutOfHybridMemory(String s) { 30 | super(s); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-java-vmem-service/src/test/resources/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/CloseableIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | import java.io.Closeable; 21 | import java.util.Iterator; 22 | 23 | /** 24 | * An iterator that is also a Closeable resource. 25 | * 26 | * @param the type of elements returned by this iterator 27 | */ 28 | public interface CloseableIterator extends Iterator, Closeable { 29 | // No additional methods needed, inherits from Iterator and Closeable 30 | } 31 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/HandlerStore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | public interface HandlerStore { 21 | 22 | /** 23 | * determine whether this allocator supports to store durable handler or 24 | * not 25 | * 26 | * @return true if there is 27 | */ 28 | boolean hasDurableHandlerStore(); 29 | 30 | long handlerCapacity(); 31 | 32 | long getHandler(long key); 33 | 34 | void setHandler(long key, long handler); 35 | } 36 | -------------------------------------------------------------------------------- /mnemonic-common/src/main/java/org/apache/mnemonic/resgc/ContextWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic.resgc; 19 | 20 | /** 21 | * the context wrapper interface for registering and callback. 22 | * 23 | * @param 24 | * resource type to be holden. 25 | */ 26 | public interface ContextWrapper { 27 | 28 | MRES getRes(); 29 | 30 | void setRes(MRES res); 31 | 32 | ReclaimContext getContext(); 33 | 34 | void setContext(ReclaimContext rctx); 35 | } 36 | -------------------------------------------------------------------------------- /mnemonic-common/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/DurableEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.Target; 22 | import java.lang.annotation.ElementType; 23 | import java.lang.annotation.RetentionPolicy; 24 | 25 | /** 26 | * this class defines a annotation for non-volatile entity 27 | * 28 | */ 29 | 30 | @Target(ElementType.TYPE) 31 | @Retention(RetentionPolicy.CLASS) 32 | public @interface DurableEntity { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-examples/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-sessions/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-collections/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/RefBreak.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | /** 21 | * this class defines an annotation for refbreak methods of non-volatile entity 22 | * 23 | */ 24 | 25 | import java.lang.annotation.ElementType; 26 | import java.lang.annotation.Retention; 27 | import java.lang.annotation.RetentionPolicy; 28 | import java.lang.annotation.Target; 29 | 30 | @Target(ElementType.METHOD) 31 | @Retention(RetentionPolicy.CLASS) 32 | public @interface RefBreak { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/RestoreDurableEntityError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | /** 21 | * 22 | * 23 | */ 24 | 25 | public class RestoreDurableEntityError extends RuntimeException { 26 | 27 | private static final long serialVersionUID = -2433590448661478594L; 28 | 29 | /** 30 | * construct a error instance 31 | * @param s 32 | * specify an error information 33 | */ 34 | public RestoreDurableEntityError(String s) { 35 | super(s); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/DurableSetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | /** 21 | * this class defines an annotation for setter methods of non-volatile entity 22 | * 23 | */ 24 | 25 | import java.lang.annotation.ElementType; 26 | import java.lang.annotation.Retention; 27 | import java.lang.annotation.RetentionPolicy; 28 | import java.lang.annotation.Target; 29 | 30 | @Target(ElementType.METHOD) 31 | @Retention(RetentionPolicy.CLASS) 32 | public @interface DurableSetter { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /mnemonic-spark/mnemonic-spark-core/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-benches/mnemonic-sort-bench/src/main/java/org/apache/mnemonic/bench/TextFileSort.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic.bench; 19 | 20 | import java.io.BufferedReader; 21 | import java.io.BufferedWriter; 22 | import java.io.IOException; 23 | 24 | public interface TextFileSort { 25 | 26 | void load(BufferedReader reader) throws NumberFormatException, IOException; 27 | 28 | void doSort(); 29 | 30 | void store(BufferedWriter writer) throws IOException; 31 | 32 | long[] getSortInfo(); 33 | 34 | void clear(); 35 | } 36 | -------------------------------------------------------------------------------- /mnemonic-common/src/main/java/org/apache/mnemonic/service/memory/MemoryServiceFeature.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.mnemonic.service.memory; 18 | 19 | public enum MemoryServiceFeature { 20 | 21 | VOLATILE(1), 22 | NONVOLATILE(2), 23 | TRANSACTABLE(3), 24 | QUERYABLE(4), 25 | ABSTRACTADDRESSING(5), 26 | EXPANDABLE(6), 27 | SHRINKABLE(7); 28 | 29 | private int value; 30 | 31 | MemoryServiceFeature(int val) { 32 | this.value = val; 33 | } 34 | 35 | public int getValue() { 36 | return value; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/OutOfBoundsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | /** 21 | * this Exception will be thrown once cache pool has been out of space. 22 | * 23 | */ 24 | public class OutOfBoundsException extends RuntimeException { 25 | 26 | /** 27 | * accept a exception message to describe specific condition. 28 | * 29 | * @param message 30 | * exception message 31 | */ 32 | public OutOfBoundsException(String message) { 33 | super(message); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-redis-service/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-java-vmem-service/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmalloc-service/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmdk-pmem-service/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmdk-vmem-service/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-sys-vmem-service/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-computing-services/mnemonic-utilities-service/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-memkind-pmem-service/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/ReferenceBreakingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | /** 21 | * this Exception will be thrown once cache pool has been out of space. 22 | * 23 | */ 24 | public class ReferenceBreakingException extends RuntimeException { 25 | 26 | /** 27 | * accept a exception message to describe specific condition. 28 | * 29 | * @param message 30 | * exception message 31 | */ 32 | public ReferenceBreakingException(String message) { 33 | super(message); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /mnemonic-spark/mnemonic-spark-core/src/test/resources/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 35 | -------------------------------------------------------------------------------- /mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/test/resources/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 35 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-java-vmem-service/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | plugins { 19 | id 'com.github.johnrengelman.shadow' 20 | id 'com.google.osdetector' 21 | } 22 | 23 | description = 'mnemonic-java-vmem-service' 24 | 25 | dependencies { 26 | implementation project(':mnemonic-common') 27 | testCompileOnly 'org.testng:testng' 28 | } 29 | 30 | shadowJar { 31 | minimize() 32 | destinationDirectory = file("$projectDir/../service-dist") 33 | archiveClassifier = osdetector.classifier 34 | } 35 | 36 | build.dependsOn shadowJar 37 | 38 | test.useTestNG() 39 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/pmdetach.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "pmfunction.h" 19 | #include "pminternal.h" 20 | 21 | void *pmalloc_detach(void *md) { 22 | struct mdesc mtemp; 23 | 24 | if (md != NULL) { 25 | 26 | mtemp = *(struct mdesc *) md; 27 | 28 | if ((mtemp.morespace(&mtemp, mtemp.mempoolbase - mtemp.limitpos)) 29 | == NULL) { 30 | *(struct mdesc *) md = mtemp; 31 | } else { 32 | if (mtemp.flags & PMALLOC_DEVZERO) { 33 | close(mtemp.mappingfd); 34 | } 35 | md = NULL; 36 | } 37 | } 38 | 39 | return (md); 40 | } 41 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/pmaddress.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "pminternal.h" 19 | 20 | inline void * p_addr(void *md, void *addr) { 21 | struct mdesc *mdp = (struct mdesc *) md; 22 | return NULL == addr ? NULL : addr - (size_t) (mdp->mempoolbase); 23 | } 24 | 25 | inline void * e_addr(void *md, void *addr) { 26 | struct mdesc *mdp = (struct mdesc *) md; 27 | return NULL == addr ? NULL : (size_t) addr + mdp->mempoolbase; 28 | } 29 | 30 | inline void * b_addr(void *md) { 31 | struct mdesc *mdp = (struct mdesc *) md; 32 | return mdp->mempoolbase; 33 | } 34 | -------------------------------------------------------------------------------- /.github/workflows/docker_ubuntu.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | name: build in container 19 | on: [push, pull_request] 20 | jobs: 21 | build-and-deploy: 22 | runs-on: ubuntu-latest 23 | container: 24 | image: mnemonic/mneci:v6 25 | env: 26 | MNE_MODE: development 27 | steps: 28 | - name: Delete old project folder 29 | run: | 30 | rm -rf /ws/mnemonic 31 | - name: Checkout code 32 | uses: actions/checkout@v2 33 | - name: Validate Gradle Wrapper 34 | uses: gradle/wrapper-validation-action@v1 35 | - name: Build with Maven 36 | run: mvn clean install 37 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/DurableType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | /** 21 | * defines the types of generic field 22 | * 23 | */ 24 | public enum DurableType { 25 | 26 | BOOLEAN(1), 27 | CHARACTER(2), 28 | BYTE(3), 29 | SHORT(4), 30 | INTEGER(5), 31 | LONG(6), 32 | FLOAT(7), 33 | DOUBLE(8), 34 | STRING(9), 35 | DURABLE(10), 36 | BUFFER(11), 37 | CHUNK(12); 38 | 39 | private int value; 40 | 41 | DurableType(int val) { 42 | this.value = val; 43 | } 44 | 45 | public int getValue() { 46 | return value; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /mnemonic-common/src/main/java/org/apache/mnemonic/DurableType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | /** 21 | * defines the types of generic field 22 | * 23 | */ 24 | public enum DurableType { 25 | 26 | BOOLEAN(1), 27 | CHARACTER(2), 28 | BYTE(3), 29 | SHORT(4), 30 | INTEGER(5), 31 | LONG(6), 32 | FLOAT(7), 33 | DOUBLE(8), 34 | STRING(9), 35 | DURABLE(10), 36 | BUFFER(11), 37 | CHUNK(12); 38 | 39 | private int value; 40 | 41 | DurableType(int val) { 42 | this.value = val; 43 | } 44 | 45 | public int getValue() { 46 | return value; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /mnemonic-computing-services/mnemonic-utilities-service/src/test/resources/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 35 | -------------------------------------------------------------------------------- /mnemonic-sessions/src/main/java/org/apache/mnemonic/sessions/InputSession.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.mnemonic.sessions; 20 | 21 | import java.util.Iterator; 22 | 23 | /** 24 | * Represents an input session that provides a way to iterate over elements of type V. 25 | * 26 | * @param the type of elements in the input session 27 | */ 28 | public interface InputSession extends Iterable { 29 | 30 | /** 31 | * Returns an iterator over the elements in this input session. 32 | * 33 | * @return an iterator 34 | */ 35 | @Override 36 | Iterator iterator(); 37 | 38 | } 39 | 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ================================ 4 | 5 | ## Mnemonic Official Website 6 | 7 | [![CI](https://github.com/apache/mnemonic/workflows/build%20in%20container/badge.svg)](https://github.com/apache/mnemonic/actions?query=workflow%3Abuild%20in%20container) 8 | 9 | Apache Mnemonic is a non-volatile hybrid memory storage oriented library, it proposed a non-volatile/durable Java object model and durable computing service that bring several advantages to significantly improve the performance of massive real-time data processing/analytics. developers are able to use this library to design their cache-less and SerDe-less high performance applications. 10 | 11 | ### Features: 12 | 13 | * In-place data storage on local non-volatile memory 14 | * Durable Object Model (DOM) 15 | * Durable Native Computing Model (DNCM) 16 | * Object graphs lazy loading & sharing 17 | * Auto-reclaim memory resources and Mnemonic objects 18 | * Hierarchical cache pool for massive data caching 19 | * Extensible memory services for new device adoption and allocation optimization 20 | * Durable data structure collection(WIP) 21 | * Durable computing service 22 | * Minimize memory footprint of on-heap 23 | * Reduce GC Overheads as the following chart shown (collected from Apache Spark experiments) 24 | * Drop-in Hadoop MapReduce support 25 | * Drop-in Hadoop Spark support 26 | -------------------------------------------------------------------------------- /mnemonic-common/src/main/java/org/apache/mnemonic/resgc/ResReclaim.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic.resgc; 19 | 20 | /** 21 | * Reclaim any kind of resource. it is customized by client code that is 22 | * specific to how to destroy a kind of specified resource. 23 | * 24 | * @author wg 25 | * 26 | * @param the type of a resource 27 | */ 28 | public interface ResReclaim { 29 | 30 | /** 31 | * reclaim a specified resource. 32 | * 33 | * @param cw 34 | * a resource context wrapper to be used for resource release 35 | */ 36 | void reclaim(ContextWrapper cw); 37 | } 38 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/ContainerOverflowException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | /** 21 | * this Exception will be thrown once cache pool has been out of space. 22 | * 23 | */ 24 | public class ContainerOverflowException extends RuntimeException { 25 | 26 | private static final long serialVersionUID = -8515518456414990004L; 27 | 28 | /** 29 | * accept a exception message to describe specific condition. 30 | * 31 | * @param message 32 | * exception message 33 | */ 34 | public ContainerOverflowException(String message) { 35 | super(message); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/Transaction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.mnemonic; 18 | 19 | public interface Transaction { 20 | 21 | /** 22 | * start a transaction 23 | * @param readOnly 24 | * specify if the transaction is readonly 25 | */ 26 | void begin(boolean readOnly); 27 | 28 | /** 29 | * commit current transaction. 30 | * 31 | */ 32 | void commit(); 33 | 34 | /** 35 | * abort current transaction 36 | */ 37 | void abort(); 38 | 39 | /** 40 | * determine if in a transaction 41 | * @return the true if it is in a transaction 42 | */ 43 | boolean isInTransaction(); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /mnemonic-sessions/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | 19 | description = 'mnemonic-sessions' 20 | 21 | compileJava { 22 | options.compilerArgs = [ 23 | "-processor", "org.apache.mnemonic.DurableEntityProcessor" 24 | ] 25 | } 26 | 27 | compileTestJava { 28 | options.compilerArgs = [ 29 | "-processor", "org.apache.mnemonic.DurableEntityProcessor" 30 | ] 31 | } 32 | 33 | dependencies { 34 | annotationProcessor project(':mnemonic-core') 35 | api project(':mnemonic-collections') 36 | api 'org.apache.commons:commons-lang3' 37 | api 'org.apache.logging.log4j:log4j-slf4j-impl' 38 | testCompileOnly 'org.testng:testng' 39 | } 40 | 41 | test.useTestNG() 42 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/DurableGetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | /** 21 | * this class defines an annotation for getter methods of non-volatile entity 22 | * 23 | */ 24 | 25 | import java.lang.annotation.ElementType; 26 | import java.lang.annotation.Retention; 27 | import java.lang.annotation.RetentionPolicy; 28 | import java.lang.annotation.Target; 29 | 30 | @Target(ElementType.METHOD) 31 | @Retention(RetentionPolicy.CLASS) 32 | public @interface DurableGetter { 33 | String EntityFactoryProxies() default "null"; 34 | 35 | String GenericFieldTypes() default "null"; 36 | 37 | long Id() default -1L; 38 | } 39 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/query/memory/ResultSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.mnemonic.query.memory; 18 | 19 | import java.io.Closeable; 20 | import java.io.IOException; 21 | import java.util.Iterator; 22 | 23 | public class ResultSet implements Iterable, Closeable { 24 | 25 | private Queryable m_queryable; 26 | 27 | private long m_qid; 28 | 29 | public ResultSet(Queryable queryable, long qid) { 30 | m_queryable = queryable; 31 | m_qid = qid; 32 | } 33 | 34 | @Override 35 | public Iterator iterator() { 36 | return null; 37 | } 38 | 39 | @Override 40 | public void close() throws IOException { 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/pmkeys.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "pminternal.h" 19 | 20 | int pmalloc_setkey(void *md, int keyidx, void *key) { 21 | struct mdesc *mdp = (struct mdesc *) md; 22 | int result = 0; 23 | 24 | if ((mdp != NULL) && (keyidx >= 0) && (keyidx < PMALLOC_KEYS)) { 25 | mdp->persistkeys[keyidx] = key; 26 | result++; 27 | } 28 | return (result); 29 | } 30 | 31 | void * pmalloc_getkey(void *md, int keyidx) { 32 | struct mdesc *mdp = (struct mdesc *) md; 33 | void * keyval = NULL; 34 | 35 | if ((mdp != NULL) && (keyidx >= 0) && (keyidx < PMALLOC_KEYS)) { 36 | keyval = mdp->persistkeys[keyidx]; 37 | } 38 | return (keyval); 39 | } 40 | -------------------------------------------------------------------------------- /mnemonic-benches/mnemonic-sort-bench/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | description = 'mnemonic-sort-bench' 19 | 20 | compileJava { 21 | options.compilerArgs = [ 22 | "-processor", "org.apache.mnemonic.DurableEntityProcessor" 23 | ] 24 | } 25 | 26 | dependencies { 27 | annotationProcessor project(':mnemonic-core') 28 | api project(':mnemonic-collections') 29 | api project(':mnemonic-computing-services:mnemonic-utilities-service') 30 | api project(':mnemonic-memory-services:mnemonic-sys-vmem-service') 31 | api 'commons-cli:commons-cli' 32 | api 'org.apache.commons:commons-lang3' 33 | api 'org.apache.logging.log4j:log4j-slf4j-impl' 34 | testCompileOnly 'org.testng:testng' 35 | } 36 | 37 | test.useTestNG() 38 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/AnnotationProcessingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | import javax.lang.model.element.Element; 21 | 22 | /** 23 | * this exception is used for non-volatile annotation processing 24 | * 25 | */ 26 | public class AnnotationProcessingException extends Exception { 27 | 28 | private static final long serialVersionUID = 6911141027622831646L; 29 | 30 | private Element element; 31 | 32 | public AnnotationProcessingException(Element element, String msg, Object... args) { 33 | super(String.format(msg, args)); 34 | this.element = element; 35 | } 36 | 37 | public Element getElement() { 38 | return element; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /mnemonic-benches/mnemonic-spark-kmeans-bench/bin/benchcommon.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one or more 5 | # contributor license agreements. See the NOTICE file distributed with 6 | # this work for additional information regarding copyright ownership. 7 | # The ASF licenses this file to You under the Apache License, Version 2.0 8 | # (the "License"); you may not use this file except in compliance with 9 | # the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | import os 21 | import inspect 22 | import sys 23 | 24 | def findHomeDir(): 25 | homedir = os.environ.get("MNEMONIC_HOME") 26 | if not homedir: 27 | filename = inspect.getframeinfo(inspect.currentframe()).filename 28 | path = os.path.dirname(os.path.abspath(filename)) 29 | while 1: 30 | pathdeco = os.path.split(path) 31 | if not pathdeco[1]: 32 | print "Not found mnemonic home directory, please check \$MNEMONIC_HOME" 33 | sys.exit(1) 34 | if pathdeco[1] == 'mnemonic': 35 | break 36 | else: 37 | path = pathdeco[0] 38 | homedir = path 39 | return homedir 40 | 41 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/Reclaim.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | /** 21 | * an interface to reclaim its memory resource. 22 | * 23 | */ 24 | public interface Reclaim { 25 | 26 | /** 27 | * reclaim specified resources. 28 | * 29 | * @param mres 30 | * a resource to be reclaimed 31 | * 32 | * @param size 33 | * the size of resource, it will be set as null if unknown 34 | * 35 | * @return true if this resource has been reclaimed by this callback. 36 | * false if this resource needs to be claimed by default 37 | * reclaimer 38 | */ 39 | boolean reclaim(MRES mres, Long size); 40 | } 41 | -------------------------------------------------------------------------------- /mnemonic-common/src/main/java/org/apache/mnemonic/resgc/ResReclaimContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic.resgc; 19 | 20 | public class ResReclaimContext implements ReclaimContext { 21 | 22 | protected int m_modeid; 23 | 24 | public ResReclaimContext() { 25 | m_modeid = 0; 26 | } 27 | 28 | public ResReclaimContext(int modeid) { 29 | m_modeid = modeid; 30 | } 31 | 32 | @Override 33 | public ResReclaimContext clone() { 34 | return new ResReclaimContext(m_modeid); 35 | } 36 | 37 | public int getModeId() { 38 | return m_modeid; 39 | } 40 | 41 | public void setModeId(int modeid) { 42 | this.m_modeid = modeid; 43 | } 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /mnemonic-collections/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | 19 | description = 'mnemonic-collections' 20 | 21 | compileJava { 22 | options.compilerArgs = [ 23 | "-processor", "org.apache.mnemonic.DurableEntityProcessor" 24 | ] 25 | } 26 | 27 | compileTestJava { 28 | options.compilerArgs = [ 29 | "-processor", "org.apache.mnemonic.DurableEntityProcessor" 30 | ] 31 | } 32 | 33 | dependencies { 34 | annotationProcessor project(':mnemonic-core') 35 | api project(':mnemonic-core') 36 | api project(':mnemonic-memory-services:mnemonic-pmalloc-service') 37 | api 'org.apache.commons:commons-lang3' 38 | api 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.0' 39 | testCompileOnly 'org.testng:testng' 40 | } 41 | 42 | test.useTestNG() 43 | -------------------------------------------------------------------------------- /mnemonic-common/src/main/java/org/apache/mnemonic/service/computing/ValueInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic.service.computing; 19 | 20 | import org.apache.mnemonic.DurableType; 21 | 22 | public class ValueInfo { 23 | 24 | /** 25 | * a handler to a object graph 26 | */ 27 | public long handler; 28 | 29 | /** 30 | * a table for native address mapping 31 | */ 32 | public long[][] transtable; 33 | 34 | /** 35 | * an array of memory service functions 36 | */ 37 | public long[] memfuncs; 38 | 39 | /** 40 | * a list of frame of native parameter 41 | */ 42 | public long[][] frames; 43 | 44 | /** 45 | * a type of this specified value 46 | */ 47 | public DurableType dtype; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /mnemonic-core/src/test/java/org/apache/mnemonic/Payload.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | /** 21 | * a dummy object that is used for other test cases. 22 | * 23 | * 24 | * 25 | */ 26 | public class Payload implements java.io.Serializable, Comparable { 27 | 28 | private static final long serialVersionUID = 187397440699436500L; 29 | 30 | public Payload(int iv, String strv, double dv) { 31 | ival = iv; 32 | strval = strv; 33 | dval = dv; 34 | } 35 | 36 | public int ival; 37 | public String strval; 38 | public double dval; 39 | 40 | @Override 41 | public int compareTo(Payload pl) { 42 | return ival == pl.ival && strval.equals(pl.strval) && dval == pl.dval ? 0 : 1; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /mnemonic-sessions/src/main/java/org/apache/mnemonic/sessions/DurableComputable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.mnemonic.sessions; 20 | 21 | import org.apache.mnemonic.RestorableAllocator; 22 | 23 | /** 24 | * Represents a durable computable entity. 25 | * 26 | * @param the type of the allocator 27 | */ 28 | public interface DurableComputable> { 29 | 30 | /** 31 | * Retrieves the allocator associated with this computable entity. 32 | * 33 | * @return the allocator 34 | */ 35 | A getAllocator(); 36 | 37 | /** 38 | * Retrieves the handler associated with this computable entity. 39 | * 40 | * @return the handler 41 | */ 42 | long getHandler(); 43 | } 44 | 45 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/EvictFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | /** 21 | * A listener callback to validate its accepted key-value pair for evacuation. 22 | * 23 | */ 24 | public interface EvictFilter { 25 | /** 26 | * A call-back validator when an entry will be evicted. 27 | * 28 | * @param pool 29 | * the pool which an entry has been evicted from 30 | * 31 | * @param k 32 | * the entry's key 33 | * 34 | * @param v 35 | * the entry's value 36 | * 37 | * @return true if the entry is allowed to be dropped from its cache 38 | * pool. 39 | */ 40 | boolean validate(CachePool pool, KeyT k, ValueT v); 41 | } 42 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one or more 2 | // contributor license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright ownership. 4 | // The ASF licenses this file to You under the Apache License, Version 2.0 5 | // (the "License"); you may not use this file except in compliance with 6 | // the License. You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: 17 | // https://github.com/microsoft/vscode-dev-containers/tree/v0.234.0/containers/ubuntu 18 | { 19 | "name": "apache mnemonic", // The name of the project or service 20 | "dockerComposeFile": "docker-compose.devcontainer.yml", // The Docker Compose file to use for setting up the development environment 21 | "service": "mnemonic", // The specific service in the Docker Compose file to focus on 22 | "workspaceFolder": "/ws/mnemonic", // The folder in the container that will be used as the workspace 23 | "shutdownAction": "stopCompose" // The action to take when shutting down the container (stopping the Docker Compose setup) 24 | } 25 | 26 | -------------------------------------------------------------------------------- /mnemonic-collections/src/test/java/org/apache/mnemonic/collections/Payload.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic.collections; 19 | 20 | /** 21 | * a dummy object that is used for other test cases. 22 | * 23 | * 24 | * 25 | */ 26 | public class Payload implements java.io.Serializable, Comparable { 27 | 28 | private static final long serialVersionUID = 187397440699436500L; 29 | 30 | public Payload(int iv, String strv, double dv) { 31 | ival = iv; 32 | strval = strv; 33 | dval = dv; 34 | } 35 | 36 | public int ival; 37 | public String strval; 38 | public double dval; 39 | 40 | @Override 41 | public int compareTo(Payload pl) { 42 | return ival == pl.ival && strval.equals(pl.strval) && dval == pl.dval ? 0 : 1; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /mnemonic-sessions/src/test/resources/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 38 | -------------------------------------------------------------------------------- /mnemonic-collections/src/test/resources/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 38 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/pmalloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "pmfunction.h" 19 | #include "pminternal.h" 20 | 21 | void * pmalloc(void *md, size_t size) { 22 | assert(NULL != md); 23 | struct mdesc *mdp = (struct mdesc *) md; 24 | void *result = NULL; 25 | 26 | if (size == 0) { 27 | return (NULL); 28 | } 29 | 30 | if (!(mdp->flags & PMALLOC_INITIALIZED)) { 31 | if (!initialize(mdp)) { 32 | return (NULL); 33 | } 34 | } 35 | 36 | if (size < sizeof(struct list)) { 37 | size = sizeof(struct list); 38 | } 39 | 40 | if ( 0 ) { // (BLOCKSIZE / 2) { 41 | result = allocate_blockfrag(mdp, size); 42 | } else { 43 | size_t blocks = BLOCKIFY(size); 44 | result = allocate_blocks(mdp, blocks); 45 | } 46 | 47 | return (result); 48 | } 49 | -------------------------------------------------------------------------------- /mnemonic-examples/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | 19 | description = 'mnemonic-examples' 20 | 21 | compileJava { 22 | options.compilerArgs = [ 23 | "-processor", "org.apache.mnemonic.DurableEntityProcessor" 24 | ] 25 | } 26 | 27 | compileTestJava { 28 | options.compilerArgs = [ 29 | "-processor", "org.apache.mnemonic.DurableEntityProcessor" 30 | ] 31 | } 32 | 33 | dependencies { 34 | annotationProcessor project(':mnemonic-core') 35 | api project(':mnemonic-collections') 36 | api project(':mnemonic-memory-services:mnemonic-nvml-vmem-service') 37 | api project(':mnemonic-memory-services:mnemonic-nvml-pmem-service') 38 | api 'org.apache.commons:commons-lang3' 39 | api 'org.apache.logging.log4j:log4j-slf4j-impl' 40 | testCompileOnly 'org.testng:testng' 41 | } 42 | 43 | test.useTestNG() 44 | -------------------------------------------------------------------------------- /mnemonic-collections/proguard.conf: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | -keepattributes Signature 19 | -renamesourcefileattribute SourceFile 20 | -keepattributes Exceptions,InnerClasses,Signature,Deprecated, 21 | SourceFile,LineNumberTable,*Annotation*,EnclosingMethod 22 | 23 | -keep class com.intel.bigdatamem.* { 24 | *; 25 | } 26 | 27 | -keep class com.intel.bigdatamem.collections.* { 28 | public ; 29 | } 30 | 31 | -keepclassmembers,allowoptimization enum * { 32 | public static **[] values(); 33 | public static ** valueOf(java.lang.String); 34 | } 35 | 36 | -keepclassmembernames class * { 37 | java.lang.Class class$(java.lang.String); 38 | java.lang.Class class$(java.lang.String, boolean); 39 | } 40 | 41 | -keep public interface ** { 42 | public ; 43 | } 44 | 45 | -keep public enum ** { 46 | *; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /.asf.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | --- 19 | notifications: 20 | commits: commits@mnemonic.apache.org 21 | issues: dev@mnemonic.apache.org 22 | pullrequests: dev@mnemonic.apache.org 23 | pullrequests_status: dev@mnemonic.apache.org 24 | pullrequests_comment: dev@mnemonic.apache.org 25 | jira_options: link label worklog 26 | jobs: dev@mnemonic.apache.org 27 | 28 | 29 | github: 30 | description: "Apache Mnemonic - A non-volatile hybrid memory storage oriented library" 31 | homepage: "https://mnemonic.apache.org" 32 | labels: 33 | - non-volatile 34 | - apache 35 | - apache-mnemonic 36 | - java 37 | - memory 38 | - bigdata 39 | features: 40 | issues: true 41 | projects: true 42 | 43 | enabled_merge_buttons: 44 | squash: true 45 | merge: true 46 | rebase: true 47 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/DropEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | /** 21 | * A event listener to monitor and post-process an entry's evacuation. 22 | * 23 | * 24 | */ 25 | public interface DropEvent { 26 | /** 27 | * A call-back actor when an entry has been evicted. a customized drop action 28 | * can be implemented on this interface's method e.g. spill this entry to disk 29 | * or release associated resources etc. 30 | * 31 | * @param pool 32 | * the pool which an entry has been evicted from 33 | * 34 | * @param k 35 | * the key of an entry that has been evicted 36 | * 37 | * @param v 38 | * the value of an entry that has been evicted 39 | */ 40 | void drop(CachePool pool, KeyT k, ValueT v); 41 | } 42 | -------------------------------------------------------------------------------- /mnemonic-core/src/test/resources/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 40 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/query/memory/EntityInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.mnemonic.query.memory; 18 | 19 | public class EntityInfo { 20 | 21 | private String className; 22 | 23 | private String entityName; 24 | 25 | private AttributeInfo[] attributeInfo; 26 | 27 | public String getClassName() { 28 | return className; 29 | } 30 | 31 | public void setClassName(String className) { 32 | this.className = className; 33 | } 34 | 35 | public String getEntityName() { 36 | return entityName; 37 | } 38 | 39 | public void setEntityName(String entityName) { 40 | this.entityName = entityName; 41 | } 42 | 43 | public AttributeInfo[] getAttributeInfo() { 44 | return attributeInfo; 45 | } 46 | 47 | public void setAttributeInfo(AttributeInfo[] attributeInfo) { 48 | this.attributeInfo = attributeInfo; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/native/layout.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef _LAYOUT_H 20 | #define _LAYOUT_H 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #define MAX_HANDLER_STORE_LEN 256 26 | 27 | struct pmem_root { 28 | long hdl_buf[MAX_HANDLER_STORE_LEN]; 29 | size_t capacity; 30 | }; 31 | 32 | POBJ_LAYOUT_BEGIN(memory_service); 33 | POBJ_LAYOUT_ROOT(memory_service, struct pmem_root); 34 | POBJ_LAYOUT_TOID(memory_service, uint8_t); 35 | POBJ_LAYOUT_TOID(memory_service, size_t); 36 | POBJ_LAYOUT_END(memory_service); 37 | 38 | typedef struct { 39 | //size_t size; 40 | jlong size; 41 | } PMBHeader; 42 | 43 | typedef struct { 44 | PMEMobjpool *pop; 45 | uint64_t uuid_lo; 46 | void *base; 47 | size_t capacity; 48 | } PMPool; 49 | 50 | #define PMBHSZ (sizeof(PMBHeader)) 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | #endif 56 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmdk-pmem-service/src/main/native/layout.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef _LAYOUT_H 20 | #define _LAYOUT_H 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #define MAX_HANDLER_STORE_LEN 256 26 | 27 | struct pmem_root { 28 | long hdl_buf[MAX_HANDLER_STORE_LEN]; 29 | size_t capacity; 30 | }; 31 | 32 | POBJ_LAYOUT_BEGIN(memory_service); 33 | POBJ_LAYOUT_ROOT(memory_service, struct pmem_root); 34 | POBJ_LAYOUT_TOID(memory_service, uint8_t); 35 | POBJ_LAYOUT_TOID(memory_service, size_t); 36 | POBJ_LAYOUT_END(memory_service); 37 | 38 | typedef struct { 39 | //size_t size; 40 | jlong size; 41 | } PMBHeader; 42 | 43 | typedef struct { 44 | PMEMobjpool *pop; 45 | uint64_t uuid_lo; 46 | void *base; 47 | size_t capacity; 48 | } PMPool; 49 | 50 | #define PMBHSZ (sizeof(PMBHeader)) 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | #endif 56 | -------------------------------------------------------------------------------- /mnemonic-protocol/protocol/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | // Define a function named `add` that takes two `usize` parameters and returns a `usize` result 19 | pub fn add(left: usize, right: usize) -> usize { 20 | // Add the left and right parameters together and return the result 21 | left + right 22 | } 23 | 24 | // Define a module named `tests` that contains unit tests for the `add` function 25 | #[cfg(test)] 26 | mod tests { 27 | // Import items from the outer scope (including the `add` function) 28 | use super::*; 29 | 30 | // Define a unit test named `it_works` that checks if the `add` function produces the expected result 31 | #[test] 32 | fn it_works() { 33 | // Call the `add` function with parameters 2 and 2 34 | let result = add(2, 2); 35 | 36 | // Assert that the result is equal to 4 37 | assert_eq!(result, 4); 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /docker/docker-Fedora/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | FROM fedora:34 19 | LABEL maintainer="Xiaojin Jiao (xjiao@apache.org)" 20 | 21 | # update container 22 | RUN dnf -y update && dnf clean all 23 | # install required package 24 | RUN dnf -y install cmake check git \ 25 | maven man \ 26 | gcc g++ \ 27 | java-latest-openjdk-devel.x86_64 28 | 29 | RUN dnf -y install ndctl-devel libpmem-devel libvmem-devel libpmemobj-devel libmemkind-devel &&\ 30 | dnf clean all 31 | 32 | ENV JAVA_HOME /usr/lib/jvm/java-16-openjdk 33 | ENV PATH $JAVA_HOME/bin:$PATH 34 | 35 | WORKDIR /ws 36 | 37 | RUN git clone https://github.com/redis/hiredis.git && \ 38 | cd hiredis && make && make install 39 | 40 | RUN cd /ws 41 | 42 | RUN git clone https://github.com/apache/mnemonic.git && \ 43 | cd mnemonic && mvn clean package install 44 | 45 | ENV MNEMONIC_HOME /ws/mnemonic 46 | 47 | CMD ["bash"] 48 | -------------------------------------------------------------------------------- /mnemonic-core/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | description = 'mnemonic-core' 19 | 20 | compileTestJava { 21 | options.compilerArgs = [ 22 | "-processor", "org.apache.mnemonic.DurableEntityProcessor" 23 | ] 24 | } 25 | 26 | dependencies { 27 | api project(':mnemonic-common') 28 | api project(':mnemonic-memory-services:mnemonic-pmalloc-service') 29 | api project(':mnemonic-memory-services:mnemonic-pmdk-pmem-service') 30 | api project(':mnemonic-memory-services:mnemonic-pmdk-vmem-service') 31 | api project(':mnemonic-memory-services:mnemonic-nvml-vmem-service') 32 | api 'org.apache.commons:commons-lang3' 33 | api 'com.squareup:javapoet' 34 | api 'org.apache.logging.log4j:log4j-slf4j-impl' 35 | testAnnotationProcessor project(':mnemonic-core') 36 | testCompileOnly project(':mnemonic-core') 37 | testCompileOnly 'org.testng:testng' 38 | } 39 | test.useTestNG() 40 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/native/common.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef _COMMON_H 20 | #define _COMMON_H 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include "layout.h" 40 | 41 | void throw(JNIEnv* env, const char* msg); 42 | 43 | void* addr_from_java(jlong addr); 44 | 45 | jlong addr_to_java(void* p); 46 | 47 | PMEMoid pmemobj_undirect(PMPool *pool, void *p); 48 | 49 | void *prealloc(PMPool *pool, void *p, size_t size, int initzero); 50 | 51 | void pfree(PMPool *pool, void *p); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | #endif 57 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmdk-pmem-service/src/main/native/common.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef _COMMON_H 20 | #define _COMMON_H 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include "layout.h" 40 | 41 | void throw(JNIEnv* env, const char* msg); 42 | 43 | void* addr_from_java(jlong addr); 44 | 45 | jlong addr_to_java(void* p); 46 | 47 | PMEMoid pmemobj_undirect(PMPool *pool, void *p); 48 | 49 | void *prealloc(PMPool *pool, void *p, size_t size, int initzero); 50 | 51 | void pfree(PMPool *pool, void *p); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | #endif 57 | -------------------------------------------------------------------------------- /mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapred/MneMapredRecordWriter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.mnemonic.hadoop.mapred; 20 | 21 | import java.io.IOException; 22 | 23 | import org.apache.hadoop.io.NullWritable; 24 | import org.apache.hadoop.mapred.RecordWriter; 25 | import org.apache.hadoop.mapred.Reporter; 26 | import org.apache.mnemonic.hadoop.MneDurableOutputValue; 27 | 28 | /** 29 | * This record writer implements the org.apache.hadoop.mapred API. 30 | * 31 | * @param the type of the item of value 32 | */ 33 | public class MneMapredRecordWriter> 34 | implements RecordWriter { 35 | 36 | @Override 37 | public void write(NullWritable key, MV value) throws IOException { 38 | value.post(); 39 | } 40 | 41 | @Override 42 | public void close(Reporter reporter) throws IOException { 43 | } 44 | } 45 | 46 | 47 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/pmfree.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "pmfunction.h" 19 | #include "pminternal.h" 20 | 21 | void __pmalloc_free(struct mdesc *mdp, void *addr) { 22 | size_t block = BLOCK(addr); 23 | 24 | int fragtype = mdp->mblkinfo[block].inuse.fragtype; 25 | switch (fragtype) { 26 | case 0: 27 | free_blocks(mdp, block); 28 | break; 29 | 30 | default: 31 | free_blockfrag(mdp, block, fragtype, addr); 32 | break; 33 | } 34 | } 35 | 36 | void pmfree(void *md, void *addr) { 37 | struct mdesc *mdp = (struct mdesc *) md; 38 | register struct alignlist *l; 39 | 40 | if (addr != NULL) { 41 | for (l = mdp->aligned_blocks; l != NULL; l = l->next) { 42 | if (l->alignedaddr == addr) { 43 | l->alignedaddr = NULL; 44 | addr = l->unalignedaddr; 45 | break; 46 | } 47 | } 48 | __pmalloc_free(mdp, addr); 49 | // if (check_heap_free_info(mdp) < 0) exit(1); 50 | } 51 | 52 | } 53 | 54 | -------------------------------------------------------------------------------- /mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapreduce/MneOutputFormat.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.mnemonic.hadoop.mapreduce; 20 | 21 | import java.io.IOException; 22 | 23 | import org.apache.hadoop.io.NullWritable; 24 | import org.apache.hadoop.mapreduce.RecordWriter; 25 | import org.apache.hadoop.mapreduce.TaskAttemptContext; 26 | import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; 27 | import org.apache.mnemonic.hadoop.MneDurableOutputValue; 28 | 29 | /** 30 | * A Mnemonic output format that satisfies the org.apache.hadoop.mapreduce API. 31 | */ 32 | public class MneOutputFormat> 33 | extends FileOutputFormat { 34 | 35 | @Override 36 | public RecordWriter getRecordWriter(TaskAttemptContext taskAttemptContext) throws IOException { 37 | return new MneMapreduceRecordWriter(); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-redis-service/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | plugins { 19 | id 'com.github.johnrengelman.shadow' 20 | id 'com.google.osdetector' 21 | } 22 | 23 | description = 'mnemonic-redis-service' 24 | 25 | dependencies { 26 | implementation project(':mnemonic-common') 27 | 28 | } 29 | 30 | def nativeDir = "$projectDir/src/main/native" 31 | 32 | cmake { 33 | sourceFolder = file("$nativeDir") 34 | workingFolder = file("$nativeDir/build") 35 | buildSharedLibs = true 36 | buildConfig = 'Release' 37 | buildTarget = 'install' 38 | } 39 | 40 | task copyResources(type: Copy) { 41 | from "$nativeDir/dist/native" 42 | into "${buildDir}/classes/java/main/native" 43 | } 44 | 45 | 46 | task cleanDist(type: Delete) { 47 | delete "$nativeDir/dist" 48 | } 49 | 50 | compileJava.dependsOn cmakeBuild 51 | processResources.dependsOn copyResources 52 | clean.dependsOn cmakeClean 53 | clean.dependsOn cleanDist 54 | 55 | test.useTestNG() 56 | -------------------------------------------------------------------------------- /mnemonic-core/src/main/java/org/apache/mnemonic/MemoryDurableEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic; 19 | 20 | import org.apache.mnemonic.resgc.ReclaimContext; 21 | 22 | /** 23 | * 24 | * 25 | */ 26 | 27 | public interface MemoryDurableEntity> { 28 | 29 | void initializeDurableEntity(ALLOC_PMem3C93D24F59 allocator, EntityFactoryProxy[] efproxys, 30 | DurableType[] gfields, boolean autoreclaim, ReclaimContext rctx); 31 | 32 | void createDurableEntity(ALLOC_PMem3C93D24F59 allocator, EntityFactoryProxy[] efproxys, 33 | DurableType[] gfields, boolean autoreclaim, ReclaimContext rctx) throws OutOfHybridMemory; 34 | 35 | void restoreDurableEntity(ALLOC_PMem3C93D24F59 allocator, EntityFactoryProxy[] efproxys, 36 | DurableType[] gfields, long phandler, boolean autoreclaim, ReclaimContext rctx) 37 | throws RestoreDurableEntityError; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /mnemonic-common/src/main/java/org/apache/mnemonic/resgc/ResContextWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic.resgc; 19 | 20 | public class ResContextWrapper implements ContextWrapper { 21 | 22 | protected MRES m_res = null; 23 | protected ReclaimContext m_context = null; 24 | 25 | public ResContextWrapper() { 26 | m_res = null; 27 | m_context = null; 28 | } 29 | 30 | public ResContextWrapper(MRES res, ReclaimContext context) { 31 | m_res = res; 32 | m_context = context; 33 | } 34 | 35 | @Override 36 | public MRES getRes() { 37 | return m_res; 38 | } 39 | 40 | @Override 41 | public void setRes(MRES res) { 42 | m_res = res; 43 | } 44 | 45 | @Override 46 | public ReclaimContext getContext() { 47 | return m_context; 48 | } 49 | 50 | @Override 51 | public void setContext(ReclaimContext rctx) { 52 | m_context = rctx; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /mnemonic-sessions/src/main/java/org/apache/mnemonic/sessions/TransformFunction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.mnemonic.sessions; 20 | 21 | import org.apache.mnemonic.RestorableAllocator; 22 | 23 | /** 24 | * Represents a transformation function that transforms a value of type T into a value of type V. 25 | * 26 | * @param the type of the transformed value 27 | * @param the type of the allocator used for object creation 28 | * @param the type of the input value to be transformed 29 | */ 30 | public interface TransformFunction, T> { 31 | 32 | /** 33 | * Transforms the input value into a value of type V. 34 | * 35 | * @param value the input value to be transformed 36 | * @param objcreator an object creator for creating instances of V using the allocator 37 | * @return the transformed value of type V 38 | */ 39 | V transform(T value, ObjectCreator objcreator); 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapreduce/MneMapreduceRecordWriter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.mnemonic.hadoop.mapreduce; 20 | 21 | import java.io.IOException; 22 | 23 | import org.apache.hadoop.io.NullWritable; 24 | import org.apache.hadoop.mapreduce.RecordWriter; 25 | import org.apache.hadoop.mapreduce.TaskAttemptContext; 26 | import org.apache.mnemonic.hadoop.MneDurableOutputValue; 27 | 28 | /** 29 | * This record writer implements the org.apache.hadoop.mapreduce API. 30 | * 31 | * @param the type of the item of value 32 | */ 33 | public class MneMapreduceRecordWriter> 34 | extends RecordWriter { 35 | 36 | @Override 37 | public void write(NullWritable nullWritable, MV mdvalue) throws IOException { 38 | mdvalue.post(); 39 | } 40 | 41 | @Override 42 | public void close(TaskAttemptContext taskAttemptContext) throws IOException { 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/DurableSparkFunctions.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.mnemonic.spark 19 | 20 | import org.apache.spark._ 21 | import scala.reflect.ClassTag 22 | import scala.language.implicitConversions 23 | import org.apache.mnemonic.DurableType 24 | import org.apache.mnemonic.EntityFactoryProxy 25 | import org.apache.mnemonic.spark.rdd.DurableRDD 26 | 27 | class DurableSparkFunctions(sc: SparkContext) extends Serializable { 28 | 29 | def mnemonic[D: ClassTag] (path: String, 30 | serviceName: String, 31 | durableTypes: Array[DurableType], 32 | entityFactoryProxies: Array[EntityFactoryProxy], 33 | slotKeyId: Long) = { 34 | DurableRDD[D](sc, path: String, 35 | serviceName, durableTypes, entityFactoryProxies, slotKeyId) 36 | } 37 | } 38 | 39 | object DurableSparkFunctions { 40 | implicit def addDurableSparkFunctions(sc: SparkContext) = new DurableSparkFunctions(sc) 41 | } 42 | -------------------------------------------------------------------------------- /mnemonic-hadoop/mnemonic-hadoop-mapreduce/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | description = 'mnemonic-hadoop-mapreduce' 19 | 20 | compileJava { 21 | options.compilerArgs = [ 22 | "-processor", "org.apache.mnemonic.DurableEntityProcessor" 23 | ] 24 | } 25 | 26 | compileTestJava { 27 | options.compilerArgs = [ 28 | "-processor", "org.apache.mnemonic.DurableEntityProcessor" 29 | ] 30 | } 31 | 32 | dependencies { 33 | def hadoop_version = '2.10.2' 34 | 35 | annotationProcessor project(':mnemonic-core') 36 | api project(':mnemonic-collections') 37 | api project(':mnemonic-sessions') 38 | api project(':mnemonic-memory-services:mnemonic-pmalloc-service') 39 | api 'org.apache.commons:commons-lang3' 40 | implementation "org.apache.hadoop:hadoop-common:${hadoop_version}" 41 | implementation "org.apache.hadoop:hadoop-hdfs:${hadoop_version}" 42 | implementation "org.apache.hadoop:hadoop-mapreduce-client-core:${hadoop_version}" 43 | api 'org.apache.logging.log4j:log4j-slf4j-impl' 44 | testCompileOnly 'org.testng:testng' 45 | } 46 | 47 | test.useTestNG() 48 | -------------------------------------------------------------------------------- /mnemonic-computing-services/mnemonic-utilities-service/src/main/native/org_apache_mnemonic_service_computing_internal_SortServiceImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | /* Header for class SortServiceImpl */ 21 | 22 | #include "common.h" 23 | 24 | #ifndef _Included_org_apache_mnemonic_service_computing_internal_SortServiceImpl 25 | #define _Included_org_apache_mnemonic_service_computing_internal_SortServiceImpl 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | /* 30 | * Class: org_apache_mnemonic_service_computing_internal_SortServiceImpl 31 | * Method: jniInit 32 | * Signature: (II)V 33 | */ 34 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_computing_internal_SortServiceImpl_jniInit 35 | (JNIEnv *, jobject, jint, jint); 36 | 37 | /* 38 | * Class: org_apache_mnemonic_service_computing_internal_SortServiceImpl 39 | * Method: jniTerm 40 | * Signature: ()V 41 | */ 42 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_memory_internal_SortServiceImpl_jniTerm 43 | (JNIEnv *, jobject); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | #endif 49 | -------------------------------------------------------------------------------- /mnemonic-hadoop/mnemonic-hadoop-mapreduce/src/main/java/org/apache/mnemonic/hadoop/mapred/MneOutputFormat.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.mnemonic.hadoop.mapred; 20 | 21 | import java.io.IOException; 22 | 23 | import org.apache.hadoop.fs.FileSystem; 24 | import org.apache.hadoop.io.NullWritable; 25 | import org.apache.hadoop.mapred.RecordWriter; 26 | import org.apache.hadoop.util.Progressable; 27 | import org.apache.hadoop.mapred.FileOutputFormat; 28 | import org.apache.hadoop.mapred.JobConf; 29 | import org.apache.mnemonic.hadoop.MneDurableOutputValue; 30 | 31 | /** 32 | * A Mnemonic output format that satisfies the org.apache.hadoop.mapred API. 33 | * 34 | */ 35 | public class MneOutputFormat> 36 | extends FileOutputFormat { 37 | 38 | @Override 39 | public RecordWriter getRecordWriter(FileSystem ignored, JobConf job, String name, 40 | Progressable progress) throws IOException { 41 | return new MneMapredRecordWriter(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memory_internal_PMallocServiceImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | /* Header for class PMallocServiceImpl */ 21 | 22 | #include "common.h" 23 | 24 | #ifndef _Included_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl 25 | #define _Included_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | /* 30 | * Class: org_apache_mnemonic_service_memory_internal_PMallocServiceImpl 31 | * Method: jniInit 32 | * Signature: (II)V 33 | */ 34 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_jniInit 35 | (JNIEnv *, jobject, jint, jint); 36 | 37 | /* 38 | * Class: org_apache_mnemonic_service_memory_internal_PMallocServiceImpl 39 | * Method: jniTerm 40 | * Signature: ()V 41 | */ 42 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_jniTerm 43 | (JNIEnv *, jobject); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | #endif 49 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/pmalign.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "pmfunction.h" 19 | #include "pminternal.h" 20 | 21 | void *pmalign(void *md, size_t alignment, size_t size) { 22 | void * result; 23 | unsigned long int adj; 24 | struct alignlist *ablist; 25 | struct mdesc *mdp = (struct mdesc *) md; 26 | 27 | if ((result = pmalloc(md, size + alignment - 1)) != NULL) { 28 | adj = RESIDUAL(result, alignment); 29 | if (adj != 0) { 30 | for (ablist = mdp->aligned_blocks; ablist != NULL; 31 | ablist = ablist->next) { 32 | if (ablist->alignedaddr == NULL) { 33 | break; 34 | } 35 | } 36 | if (ablist == NULL) { 37 | ablist = (struct alignlist *) pmalloc(md, 38 | sizeof(struct alignlist)); 39 | if (ablist == NULL) { 40 | pmfree(md, result); 41 | return (NULL); 42 | } 43 | ablist->next = mdp->aligned_blocks; 44 | mdp->aligned_blocks = ablist; 45 | } 46 | ablist->unalignedaddr = result; 47 | result = ablist->alignedaddr = (char *) result + alignment - adj; 48 | } 49 | } 50 | return (result); 51 | } 52 | -------------------------------------------------------------------------------- /mnemonic-sessions/src/main/java/org/apache/mnemonic/sessions/OutputSession.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.mnemonic.sessions; 20 | 21 | import java.io.Closeable; 22 | 23 | import org.apache.mnemonic.RestorableAllocator; 24 | 25 | /** 26 | * Interface representing an output session for storing data in Mnemonic. 27 | * 28 | * @param the type of data to be stored 29 | * @param the type of allocator used for memory allocation 30 | */ 31 | public interface OutputSession> 32 | extends ObjectCreator, DurableComputable, Closeable { 33 | 34 | /** 35 | * Posts a value to the output session for storage. 36 | * 37 | * @param v the value to be stored 38 | */ 39 | void post(V v); 40 | 41 | /** 42 | * Destroys a pending record with the specified key. 43 | * 44 | * @param k the key of the pending record to be destroyed 45 | */ 46 | void destroyPendingRecord(V k); 47 | 48 | /** 49 | * Destroys all pending records in the output session. 50 | */ 51 | void destroyAllPendingRecords(); 52 | 53 | } 54 | 55 | -------------------------------------------------------------------------------- /mnemonic-computing-services/mnemonic-utilities-service/src/main/native/org_apache_mnemonic_service_computing_internal_PrintServiceImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | /* Header for class PrintServiceImpl */ 21 | 22 | #include "common.h" 23 | 24 | #ifndef _Included_org_apache_mnemonic_service_computing_internal_PrintServiceImpl 25 | #define _Included_org_apache_mnemonic_service_computing_internal_PrintServiceImpl 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | /* 30 | * Class: org_apache_mnemonic_service_computing_internal_PrintServiceImpl 31 | * Method: jniInit 32 | * Signature: (II)V 33 | */ 34 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_computing_internal_PrintServiceImpl_jniInit 35 | (JNIEnv *, jobject, jint, jint); 36 | 37 | /* 38 | * Class: org_apache_mnemonic_service_computing_internal_PrintServiceImpl 39 | * Method: jniTerm 40 | * Signature: ()V 41 | */ 42 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_memory_internal_PrintServiceImpl_jniTerm 43 | (JNIEnv *, jobject); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | #endif 49 | -------------------------------------------------------------------------------- /mnemonic-protocol/client/src/main.rs: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | // Import necessary libraries 19 | use reqwest; 20 | 21 | // Main asynchronous function 22 | #[tokio::main] 23 | async fn main() -> Result<(), reqwest::Error> { 24 | // The URL of the server you want to visit 25 | let url = "https://example.com"; 26 | 27 | // Make a GET request to the server 28 | let response = reqwest::get(url).await?; 29 | 30 | // Check if the request was successful (status code 200) 31 | if response.status().is_success() { 32 | // Print the response body as text 33 | let body = response.text().await?; 34 | println!("Response body:\n{}", body); 35 | } else { 36 | // Print the status code and reason phrase for unsuccessful requests 37 | println!( 38 | "Request failed with status: {} - {}", 39 | response.status(), 40 | response 41 | .status() 42 | .canonical_reason() 43 | .unwrap_or("Unknown") 44 | ); 45 | } 46 | 47 | // Return Ok to indicate success 48 | Ok(()) 49 | } 50 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-redis-service/src/main/native/org_apache_mnemonic_service_memory_internal_RedisServiceImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | /* Header for class RedisServiceImpl */ 21 | 22 | #include 23 | #include 24 | 25 | #ifndef _Included_org_apache_mnemonic_service_memory_internal_RedisServiceImpl 26 | #define _Included_org_apache_mnemonic_service_memory_internal_RedisServiceImpl 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | /* 31 | * Class: org_apache_mnemonic_service_memory_internal_RedisServiceImpl 32 | * Method: jniInit 33 | * Signature: (II)V 34 | */ 35 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_memory_internal_RedisServiceImpl_jniInit 36 | (JNIEnv *, jobject, jint, jint); 37 | 38 | /* 39 | * Class: org_apache_mnemonic_service_memory_internal_RedisServiceImpl 40 | * Method: jniTerm 41 | * Signature: ()V 42 | */ 43 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_memory_internal_RedisServiceImpl_jniTerm 44 | (JNIEnv *, jobject); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | #endif 50 | -------------------------------------------------------------------------------- /mnemonic-sessions/src/main/java/org/apache/mnemonic/sessions/ObjectCreator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.mnemonic.sessions; 20 | 21 | import org.apache.mnemonic.RestorableAllocator; 22 | 23 | /** 24 | * Interface for creating durable objects. 25 | * 26 | * @param Type of the durable object 27 | * @param Type of the allocator used for allocation 28 | */ 29 | public interface ObjectCreator> { 30 | 31 | /** 32 | * Creates a new durable object record. 33 | * 34 | * @return the newly created durable object record 35 | */ 36 | V newDurableObjectRecord(); 37 | 38 | /** 39 | * Creates a new durable object record with the specified size. 40 | * 41 | * @param size the size of the durable object record 42 | * @return the newly created durable object record 43 | */ 44 | V newDurableObjectRecord(long size); 45 | 46 | /** 47 | * Retrieves the allocator used for allocation. 48 | * 49 | * @return the allocator used for allocation 50 | */ 51 | A getAllocator(); 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/native/org_apache_mnemonic_service_memory_internal_PMemServiceImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | /* Header for class org_apache_mnemonic_service_memory_internal_PMemServiceImpl */ 21 | 22 | #include "common.h" 23 | 24 | #ifndef _Included_org_apache_mnemonic_service_memory_internal_PMemServiceImpl 25 | #define _Included_org_apache_mnemonic_service_memory_internal_PMemServiceImpl 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | /* 30 | * Class: org_apache_mnemonic_service_memory_internal_PMemServiceImpl 31 | * Method: jniInit 32 | * Signature: (II)V 33 | */ 34 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_memory_internal_PMemServiceImpl_jniInit 35 | (JNIEnv *, jobject, jint, jint); 36 | 37 | /* 38 | * Class: org_apache_mnemonic_service_memory_internal_PMemServiceImpl 39 | * Method: jniTerm 40 | * Signature: ()V 41 | */ 42 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_memory_internal_PMemServiceImpl_jniTerm 43 | (JNIEnv *, jobject); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | #endif 49 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memory_internal_VMemServiceImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | /* Header for class org_apache_mnemonic_service_memory_internal_VMemServiceImpl */ 21 | 22 | #include "common.h" 23 | 24 | #ifndef _Included_org_apache_mnemonic_service_memory_internal_VMemServiceImpl 25 | #define _Included_org_apache_mnemonic_service_memory_internal_VMemServiceImpl 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | /* 30 | * Class: org_apache_mnemonic_service_memory_internal_VMemServiceImpl 31 | * Method: jniInit 32 | * Signature: (II)V 33 | */ 34 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_jniInit 35 | (JNIEnv *, jobject, jint, jint); 36 | 37 | /* 38 | * Class: org_apache_mnemonic_service_memory_internal_VMemServiceImpl 39 | * Method: jniTerm 40 | * Signature: ()V 41 | */ 42 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_jniTerm 43 | (JNIEnv *, jobject); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | #endif 49 | -------------------------------------------------------------------------------- /mnemonic-common/src/main/java/org/apache/mnemonic/query/memory/SortOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.mnemonic.query.memory; 18 | 19 | /** 20 | * Enum representing different sort orders that can be applied to a query. 21 | */ 22 | public enum SortOrder { 23 | 24 | // Enum constants representing the sort order types 25 | NONE(1), // No sorting 26 | ASCENDING(2), // Ascending order sorting 27 | DESCENDING(3); // Descending order sorting 28 | 29 | // Private field to store the integer value associated with each sort order 30 | private int value; 31 | 32 | /** 33 | * Constructor to initialize the enum constant with a specific integer value. 34 | * 35 | * @param val The integer value representing the sort order. 36 | */ 37 | SortOrder(int val) { 38 | this.value = val; 39 | } 40 | 41 | /** 42 | * Getter method to retrieve the integer value associated with the sort order. 43 | * 44 | * @return The integer value representing the sort order. 45 | */ 46 | public int getValue() { 47 | return value; 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-sys-vmem-service/src/main/native/org_apache_mnemonic_service_memory_internal_SysVMemServiceImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | /* Header for class org_apache_mnemonic_service_memory_internal_SysVMemServiceImpl */ 21 | 22 | #include "common.h" 23 | 24 | #ifndef _Included_org_apache_mnemonic_service_memory_internal_SysVMemServiceImpl 25 | #define _Included_org_apache_mnemonic_service_memory_internal_SysVMemServiceImpl 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | /* 30 | * Class: org_apache_mnemonic_service_memory_internal_SysVMemServiceImpl 31 | * Method: jniInit 32 | * Signature: (II)V 33 | */ 34 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_memory_internal_SysVMemServiceImpl_jniInit 35 | (JNIEnv *, jobject, jint, jint); 36 | 37 | /* 38 | * Class: org_apache_mnemonic_service_memory_internal_SysVMemServiceImpl 39 | * Method: jniTerm 40 | * Signature: ()V 41 | */ 42 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_memory_internal_SysVMemServiceImpl_jniTerm 43 | (JNIEnv *, jobject); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | #endif 49 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/common.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef _COMMON_H 20 | #define _COMMON_H 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | void throw(JNIEnv* env, const char* msg); 41 | 42 | void* addr_from_java(jlong addr); 43 | 44 | jlong addr_to_java(void* p); 45 | 46 | typedef struct { 47 | //size_t size; 48 | jlong size; 49 | } PMBHeader; 50 | 51 | #define PMBHSZ (sizeof(PMBHeader)) 52 | 53 | typedef struct { 54 | VMEM *vmp; 55 | size_t capacity; 56 | pthread_mutex_t mutex; 57 | } VMPool; 58 | 59 | void *vrealloc(VMPool *pool, void *p, size_t size, int initzero); 60 | 61 | void vfree(VMPool *pool, void *p); 62 | 63 | size_t vsize(VMPool *pool, void *p); 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | #endif 69 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmdk-vmem-service/src/main/native/common.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef _COMMON_H 20 | #define _COMMON_H 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | void throw(JNIEnv* env, const char* msg); 41 | 42 | void* addr_from_java(jlong addr); 43 | 44 | jlong addr_to_java(void* p); 45 | 46 | typedef struct { 47 | //size_t size; 48 | jlong size; 49 | } PMBHeader; 50 | 51 | #define PMBHSZ (sizeof(PMBHeader)) 52 | 53 | typedef struct { 54 | VMEM *vmp; 55 | size_t capacity; 56 | pthread_mutex_t mutex; 57 | } VMPool; 58 | 59 | void *vrealloc(VMPool *pool, void *p, size_t size, int initzero); 60 | 61 | void vfree(VMPool *pool, void *p); 62 | 63 | size_t vsize(VMPool *pool, void *p); 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | #endif 69 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-pmdk-vmem-service/src/main/native/org_apache_mnemonic_service_memory_internal_PMDKVMemServiceImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | /* Header for class org_apache_mnemonic_service_memory_internal_VMemServiceImpl */ 21 | 22 | #include "common.h" 23 | 24 | #ifndef _Included_org_apache_mnemonic_service_memory_internal_PMDKVMemServiceImpl 25 | #define _Included_org_apache_mnemonic_service_memory_internal_PMDKVMemServiceImpl 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | /* 30 | * Class: org_apache_mnemonic_service_memory_internal_PMDKVMemServiceImpl 31 | * Method: jniInit 32 | * Signature: (II)V 33 | */ 34 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_memory_internal_PMDKVMemServiceImpl_jniInit 35 | (JNIEnv *, jobject, jint, jint); 36 | 37 | /* 38 | * Class: org_apache_mnemonic_service_memory_internal_PMDKVMemServiceImpl 39 | * Method: jniTerm 40 | * Signature: ()V 41 | */ 42 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_memory_internal_PMDKVMemServiceImpl_jniTerm 43 | (JNIEnv *, jobject); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | #endif 49 | -------------------------------------------------------------------------------- /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | FROM ubuntu:22.04 19 | LABEL maintainer="Yanhui Zhao (yanhui.zhao@outlook.com)" 20 | 21 | RUN apt-get update && apt-get install -y software-properties-common && add-apt-repository ppa:openjdk-r/ppa && apt-get -y update && \ 22 | apt-get install -y openjdk-17-jdk cmake check git pkg-config autoconf man build-essential gcc g++ uuid-dev pandoc devscripts flex doxygen maven tree 23 | 24 | RUN apt-get install -y libndctl-dev libpmem-dev libpmemobj-dev libmemkind-dev 25 | 26 | RUN apt-get clean 27 | 28 | WORKDIR /ws 29 | 30 | RUN git clone https://github.com/pmem/vmem && \ 31 | cd vmem && make && make install 32 | 33 | RUN cd /ws 34 | 35 | RUN git clone https://github.com/redis/hiredis.git && \ 36 | cd hiredis && make && make install 37 | 38 | RUN curl https://sh.rustup.rs -sSf | sh -s -- -y 39 | 40 | RUN cd /ws 41 | 42 | ENV MNEMONIC_HOME /ws/mnemonic 43 | 44 | #RUN cd /ws/mnemonic && tools/runall.sh -y 45 | 46 | SHELL ["/bin/bash", "-c"] 47 | RUN fp=$(readlink -e $(which javac)); echo "export JAVA_HOME=${fp/%\/bin\/javac/}" >> ~/.bashrc 48 | RUN echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> ~/.bashrc 49 | 50 | CMD ["bash"] 51 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-memkind-pmem-service/src/main/native/common.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef _COMMON_H 20 | #define _COMMON_H 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | void throw(JNIEnv* env, const char* msg); 41 | 42 | void* addr_from_java(jlong addr); 43 | 44 | jlong addr_to_java(void* p); 45 | 46 | typedef struct { 47 | //size_t size; 48 | jlong size; 49 | } PMBHeader; 50 | 51 | #define PMBHSZ (sizeof(PMBHeader)) 52 | 53 | typedef struct { 54 | memkind_t kind; 55 | size_t capacity; 56 | pthread_mutex_t mutex; 57 | } VMPool; 58 | 59 | void *vrealloc(VMPool *pool, void *p, size_t size, int initzero); 60 | 61 | void vfree(VMPool *pool, void *p); 62 | 63 | size_t vsize(VMPool *pool, void *p); 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | #endif 69 | -------------------------------------------------------------------------------- /mnemonic-memory-services/mnemonic-memkind-pmem-service/src/main/native/org_apache_mnemonic_service_memory_internal_VMemKindServiceImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | /* Header for class org_apache_mnemonic_service_memory_internal_VMemKindServiceImpl */ 21 | 22 | #include "common.h" 23 | 24 | #ifndef _Included_org_apache_mnemonic_service_memory_internal_VMemKindServiceImpl 25 | #define _Included_org_apache_mnemonic_service_memory_internal_VMemKindServiceImpl 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | /* 30 | * Class: org_apache_mnemonic_service_memory_internal_VMemKindServiceImpl 31 | * Method: jniInit 32 | * Signature: (II)V 33 | */ 34 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_memory_internal_VMemKindServiceImpl_jniInit 35 | (JNIEnv *, jobject, jint, jint); 36 | 37 | /* 38 | * Class: org_apache_mnemonic_service_memory_internal_VMemKindServiceImpl 39 | * Method: jniTerm 40 | * Signature: ()V 41 | */ 42 | JNIEXPORT void JNICALL Java_org_apache_mnemonic_service_memory_internal_VMemKindServiceImpl_jniTerm 43 | (JNIEnv *, jobject); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | #endif 49 | --------------------------------------------------------------------------------