diff --git a/.travis.yml b/.travis.yml index 39a6205..b909635 100755 --- a/.travis.yml +++ b/.travis.yml @@ -9,12 +9,12 @@ services: env: matrix: - - TYPE=pmemkv-master OS=ubuntu OS_VER=19.10 PUSH_IMAGE=1 - - TYPE=pmemkv-stable-1.0 OS=ubuntu OS_VER=19.10 - - TYPE=pmemkv-stable-1.1 OS=ubuntu OS_VER=19.10 - - TYPE=pmemkv-master OS=fedora OS_VER=31 PUSH_IMAGE=1 - - TYPE=pmemkv-stable-1.0 OS=fedora OS_VER=31 - - TYPE=pmemkv-stable-1.1 OS=fedora OS_VER=31 + - TYPE=pmemkv-master OS=ubuntu OS_VER=20.04 PUSH_IMAGE=1 + - TYPE=pmemkv-stable-1.0 OS=ubuntu OS_VER=20.04 + - TYPE=pmemkv-stable-1.1 OS=ubuntu OS_VER=20.04 + - TYPE=pmemkv-master OS=fedora OS_VER=33 PUSH_IMAGE=1 + - TYPE=pmemkv-stable-1.0 OS=fedora OS_VER=33 + - TYPE=pmemkv-stable-1.1 OS=fedora OS_VER=33 before_install: - echo $TRAVIS_COMMIT_RANGE diff --git a/examples/interactive_example.py b/examples/interactive_example.py new file mode 100644 index 0000000..2b8439e --- /dev/null +++ b/examples/interactive_example.py @@ -0,0 +1,75 @@ +# Copyright 2021, Intel Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# * Neither the name of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Usage: +# insert element: 'interactive_example.py --path path_to_db --insert key value' +# lookup element: 'interactive_example.py --path path_to_db --lookup key' +# print all elements: 'interactive_example.py --path path_to_db --iterate' + +import pmemkv +import argparse + +def callback_kv(key, value): + print("key: ", memoryview(key).tobytes().decode(), " value: ", memoryview(value).tobytes().decode()) + +def callback_v(value): + print(memoryview(value).tobytes().decode()) + +parser = argparse.ArgumentParser() +parser.add_argument('--path', help='Path to the database') + +group = parser.add_mutually_exclusive_group(required=True) +group.add_argument('--lookup', nargs=1, metavar=('key'), + help='Print element with specified key') +group.add_argument('--insert', nargs=2, metavar=('key', 'value'), + help='Insert element with specified key and value') +group.add_argument('--iterate', action='store_true', + help='Print all elements') + +args = parser.parse_args() + +print("Configuring engine") +config = {} +config["path"] = args.path +config["size"] = 10485760 +config["create_if_missing"] = 1 + +print(f"Starting engine with config: {config}") +db = pmemkv.Database("cmap", config) + +if args.lookup: + db.get(args.lookup[0], callback_v) +elif args.insert: + db.put(args.insert[0], args.insert[1]) +elif args.iterate: + db.get_all(callback_kv) + +print("Stopping engine") +db.stop() diff --git a/utils/docker/images/Dockerfile.fedora-31 b/utils/docker/images/Dockerfile.fedora-33 similarity index 97% rename from utils/docker/images/Dockerfile.fedora-31 rename to utils/docker/images/Dockerfile.fedora-33 index 38f7cb9..b93265b 100755 --- a/utils/docker/images/Dockerfile.fedora-31 +++ b/utils/docker/images/Dockerfile.fedora-33 @@ -1,5 +1,5 @@ # -# Copyright 2016-2020, Intel Corporation +# Copyright 2016-2021, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,12 +35,12 @@ # # Pull base image -FROM fedora:31 +FROM fedora:33 MAINTAINER szymon.romik@intel.com # Set required environment variables ENV OS fedora -ENV OS_VER 31 +ENV OS_VER 33 ENV PACKAGE_MANAGER rpm ENV NOTTY 1 @@ -74,6 +74,7 @@ RUN dnf update -y \ wget \ which \ python3-pip \ + libatomic \ && dnf clean all RUN pip3 install pytest setuptools wheel diff --git a/utils/docker/images/Dockerfile.ubuntu-19.10 b/utils/docker/images/Dockerfile.ubuntu-20.04 similarity index 98% rename from utils/docker/images/Dockerfile.ubuntu-19.10 rename to utils/docker/images/Dockerfile.ubuntu-20.04 index e306f5e..7fbabb2 100755 --- a/utils/docker/images/Dockerfile.ubuntu-19.10 +++ b/utils/docker/images/Dockerfile.ubuntu-20.04 @@ -35,12 +35,12 @@ # # Pull base image -FROM ubuntu:19.10 +FROM ubuntu:20.04 MAINTAINER szymon.romik@intel.com # Set required environment variables ENV OS ubuntu -ENV OS_VER 19.10 +ENV OS_VER 20.04 ENV PACKAGE_MANAGER deb ENV NOTTY 1 diff --git a/utils/docker/images/install-libpmemobj-cpp.sh b/utils/docker/images/install-libpmemobj-cpp.sh index c91f997..89cc712 100755 --- a/utils/docker/images/install-libpmemobj-cpp.sh +++ b/utils/docker/images/install-libpmemobj-cpp.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Copyright 2019, Intel Corporation +# Copyright 2019-2021, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -40,8 +40,8 @@ set -e PREFIX=/usr PACKAGE_TYPE=$1 -# master: Merge pull request #652 from ldorau/Create-separate-Docker-images-for-v1.10-branch -LIBPMEMOBJ_CPP_VERSION="006137044243981f4760ae220101a43cf97bcf2d" +# master: Merge pull request #1062 from igchor/fix_parallel_xexec +LIBPMEMOBJ_CPP_VERSION='485353b9c2fdbaf57607dcd83551664cbc3cd963' git clone https://github.com/pmem/libpmemobj-cpp --shallow-since=2019-10-02 cd libpmemobj-cpp @@ -50,7 +50,7 @@ git checkout $LIBPMEMOBJ_CPP_VERSION mkdir build cd build -cmake .. -DCPACK_GENERATOR="$PACKAGE_TYPE" -DCMAKE_INSTALL_PREFIX=$PREFIX +cmake .. -DCPACK_GENERATOR="$PACKAGE_TYPE" -DCMAKE_INSTALL_PREFIX=$PREFIX -DTESTS_USE_VALGRIND=0 if [ "$PACKAGE_TYPE" = "" ]; then make -j$(nproc) install diff --git a/utils/docker/images/install-pmdk.sh b/utils/docker/images/install-pmdk.sh index af551bc..dbe2ec9 100755 --- a/utils/docker/images/install-pmdk.sh +++ b/utils/docker/images/install-pmdk.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Copyright 2019, Intel Corporation +# Copyright 2019-2021, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -39,8 +39,8 @@ set -e PREFIX=/usr PACKAGE_TYPE=$1 -# stable-1.8: common: fix build on GitHub Actions -PMDK_VERSION="eeb8fd86c6c72f4607a22a1e9d9f7da31be8af2a" +# 1.10 +PMDK_VERSION="b661e50ac7b2a6c6b153f1a52309a0e4149eb2a2" git clone https://github.com/pmem/pmdk --shallow-since=2019-09-26 cd pmdk diff --git a/utils/docker/images/prepare-pmemkv.sh b/utils/docker/images/prepare-pmemkv.sh index c1bf8c9..e96ba51 100755 --- a/utils/docker/images/prepare-pmemkv.sh +++ b/utils/docker/images/prepare-pmemkv.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Copyright 2019, Intel Corporation +# Copyright 2019-2021, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -39,8 +39,8 @@ set -e PREFIX=/usr PACKAGE_TYPE=$1 -# master: Merge pull request #602 from ldorau/Fix-setting-compilers--do-not-mix-gcc-with-clang -current_pmemkv_version="5aff9f197e2e3eaae7f419c04ab9e2fc98309eed" +# master: Merge pull request #985 from JanDorniak99/add_test_case_with_zero_filled_string +current_pmemkv_version="e57429f4640278b7eead80f89832ba1136356c81" # stable-1.0: Merge pull request #528 from ldorau/Do-not-add-pmemkv_config...; 14.11.2019 stable_1_pmemkv_version="a3735b5393f0d5411ef8a2468b36d2a1ed00c0a1" # stable-1.1: Version 1.1