You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@resilientdb.apache.org by ap...@apache.org on 2024/09/27 08:21:23 UTC
(incubator-resilientdb) branch gopuman-docker updated: Sync with master (#156)
This is an automated email from the ASF dual-hosted git repository.
apratim pushed a commit to branch gopuman-docker
in repository https://gitbox.apache.org/repos/asf/incubator-resilientdb.git
The following commit(s) were added to refs/heads/gopuman-docker by this push:
new 4dae1ad2 Sync with master (#156)
4dae1ad2 is described below
commit 4dae1ad2f846111b5df633b9352be0b5d9acedc9
Author: Apratim Shukla <ap...@gmail.com>
AuthorDate: Fri Sep 27 01:21:18 2024 -0700
Sync with master (#156)
* Change getvalues cmd type to getallvalues
* support transfer to multi address
* end
* Update README.md
* Update README.md
* Add files via upload
* Update README.md
* Update README.md
* Updated logo
* Add files via upload
* Delete img/resilientdb_logo_light-text-modern-v3-1.png
* Add files via upload
* Update README.md
* Update README.md
* Updated loqo quality
* Fixed light logo bug | removed nexres refs
* add mvcc for mem-kv
* add history
* add mvcc
* add mvcc for kv
* add mvcc for kv
* rm unused code
* remove log
* remove unused log
* rm unused log
* add glog init
* format code
* Update README.md
* Update README.md
* Update kv_client.h
* Update CHANGELOG.md
* Update CHANGELOG.md
* support old api command line
* change license
* format code
* change to apache license
* del file
* change apache license
* add notice file
* change apache license
* Fix the failure memory order argument to atomic_compare_exchange_strong_explicit
The failure memory order cannot be release or acq_rel. Clang since llvm/llvm-project@fed5644 diagnoses an invalid argument.
* Update README.md
* Update copyright date in NOTICE (#129)
* Use .asf.yaml to manage GitHub settings
.asf.yaml is a configuration file that a project may use to control various features such as notification schemes, website staging, GitHub settings, and Pelican builds.
how to use: this:https://cwiki.apache.org/confluence/display/INFRA/git+-+.asf.yaml+features↳
Set the code merge method to squash
Set GitHub notifications to: commits@apache.o.g
Set protected_branches
* add bazel version (#132)
Co-authored-by: Ubuntu <ub...@ip-172-31-45-3.ec2.internal>
* Change the deploy logging type
Change a log from Info to Error which is used by the deployment scripts.
* update state client to obtain the replica state
* add get block numbers
* fix get txn bug
* add GetRequestFromReplica interface (#133)
* add GetRequestFromReplica interface
* fix test case failed
---------
Co-authored-by: JunchaoChen <cj...@github.com>
* change the script path in start_contract_service.sh
* Fix incorrect comment intervals in Prometheus config (#135)
Co-authored-by: ic4y <ic...@apache.org>
* kv-service python api (#136)
* kv-service python api
* update
* update kv_operation.py route to bazel-out and update readme (#137)
* update kv_operation.py route to bazel-out and update readme
* update readme
* Update README.md
* Update README.md
---------
Co-authored-by: cjcchen <ic...@gmail.com>
* ResView Branch (#138)
* "Added basic data collection, pointed out spots for web socket"
* "Added data gathering points and prints for testing"
* "Fixed bugs with compiling stats"
* "Changed message collection to be per message rather than queried periodically"
* "Added conversion of stats values to JSON, need to fix replica id setting"
* "Added more precision to timestamps in JSON"
* "Added new data to the summary view"
* "Got transaction detail collection working"
* "Changed to GETALLVALUES based on main repo"
* Changed Produced JSON to include txn_number
* "Added websocket to send to front end, slightly inconsistent"
* Add files via upload
* "Added ability to receive messages from front end"
* "Viewchange Update"
* "Removed possible infinite loop in sending summary"
* "Fixing file inclusion issue"
* "Added 2 new apis in same thread to save resources"
* "Adjusted make faulty endpoint"
* "Removed vestigial variables, turned off faulty switch for PR"
* "Fixed failing response manager test"
* "Fixed issue with data carryover between instances" (#139)
* add poe (#140)
* Update CHANGELOG.md
* Update CHANGELOG.md (#141)
* add disclaimer
* Fix Bug (#142)
* fix viewchange bug
* format code
* rm unused log
* rm unused log
* fix ut
* fix apache header
* format
* add apache license check workflow
* add npm in workflow
* Fix Apache License (#143)
* add npm in workflow
* test
* add workflow
* add path
* add path
* add path
* add path
* add path
* add path
* add path
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add license
* add loc
* add loc
* add loc
* fix build
* add url in notice
* add thirdparty license
* rm rocksdb
* fix name error
* mv DISCLAIMER-WIP
* fix typo
* add version
* add license in wip
* Update DISCLAIMER-WIP
* Update DISCLAIMER-WIP
* Update README.md
* civetweb
* civetweb
* add civetweb build
* Install (#145)
* add non-root install
* rm unused file
* add
* Update README.md
* Update README.md
* Update README.md
* Update README.md
* update install
* Update README.md
* Update README.md
* add non-root install
* Update README.md
* Update README.md
* Update README.md
* Update DISCLAIMER-WIP
* Update DISCLAIMER-WIP
* Update LICENSE
* Update LICENSE
* add license
---------
Co-authored-by: Ubuntu <ub...@ip-172-31-86-179.ec2.internal>
Co-authored-by: Ubuntu <ub...@ip-172-31-95-188.ec2.internal>
* Update DISCLAIMER-WIP
* Add missing ASF headers (#150)
Provide dev/check-license script to perform RAT checks
* Update .licenserc.yaml (#151)
* Update .licenserc.yaml
* add license header
* add config
* add config
* add config
* add config
* add config
* add config
* Update README.md
* Update README.md
* Update README.md (#152)
* Update CHANGELOG.md (#153)
* Update index.js
* [License]Add the missing license file (#154)
* Update LICENSE
---------
Co-authored-by: Gopal Nambiar <go...@gmail.com>
Co-authored-by: Glenn Chen <gl...@gmail.com>
Co-authored-by: cjcchen <ic...@gmail.com>
Co-authored-by: ResilientDB <57...@users.noreply.github.com>
Co-authored-by: Ubuntu <ub...@ip-172-31-16-70.ec2.internal>
Co-authored-by: JunchaoChen <cj...@github.com>
Co-authored-by: AtariDreams <83...@users.noreply.github.com>
Co-authored-by: Haoran Yu <75...@users.noreply.github.com>
Co-authored-by: Calvin Kirs <ki...@apache.org>
Co-authored-by: Ubuntu <ub...@ip-172-31-45-3.ec2.internal>
Co-authored-by: ic4y <83...@users.noreply.github.com>
Co-authored-by: ic4y <ic...@apache.org>
Co-authored-by: Jiazhi Sun <12...@users.noreply.github.com>
Co-authored-by: Saipranav-Kotamreddy <44...@users.noreply.github.com>
Co-authored-by: Ubuntu <ub...@ip-172-31-73-155.ec2.internal>
Co-authored-by: Ubuntu <ub...@ip-172-31-86-179.ec2.internal>
Co-authored-by: Ubuntu <ub...@ip-172-31-95-188.ec2.internal>
Co-authored-by: JB Onofré <jb...@apache.org>
---
.asf.yaml | 40 +
.bazelversion | 1 +
.github/workflows/build-push.yml | 23 +-
.github/workflows/build.yml | 19 +
.github/workflows/license.yml | 37 +
.github/workflows/loc.yml | 33 +-
.github/workflows/main.yml | 19 +
.github/workflows/ut.yml | 19 +
.gitignore | 2 +
.licenserc.yaml | 31 +
BUILD.bazel | 19 +
CHANGELOG.md | 39 +
CODE_OF_CONDUCT.md | 19 +
DISCLAIMER-WIP | 22 +
Docker/Dockerfile | 21 +-
Docker/Dockerfile_mac | 19 +
INSTALL.sh | 21 +-
INSTALL/README.md | 62 +
INSTALL/bazel/install_bazel.sh | 27 +
INSTALL/protobuf/install_protobuf.sh | 20 +
INSTALL_MAC.sh | 21 -
LICENSE | 34 +
NOTICE | 6 +
README.md | 269 ++++-
WORKSPACE | 47 +-
api/BUILD | 38 +
api/README.md | 66 ++
api/ip_address.config | 1 +
api/kv_operation.py | 46 +
api/pybind_kv_service.cpp | 66 ++
benchmark/protocols/pbft/BUILD | 19 +
benchmark/protocols/pbft/kv_server_performance.cpp | 39 +-
benchmark/protocols/pbft/kv_service_tools.cpp | 34 +-
benchmark/protocols/poe/BUILD | 33 +
benchmark/protocols/poe/kv_server_performance.cpp | 83 ++
chain/state/BUILD | 20 +-
chain/state/chain_state.cpp | 98 +-
chain/state/chain_state.h | 54 +-
chain/state/chain_state_test.cpp | 75 +-
chain/storage/BUILD | 65 +-
chain/storage/README.md | 13 -
chain/storage/kv_storage_test.cpp | 226 ++++
chain/storage/leveldb.cpp | 290 +++++
chain/storage/leveldb.h | 81 ++
chain/storage/memory_db.cpp | 170 +++
chain/storage/memory_db.h | 88 ++
chain/storage/mock_storage.h | 52 +-
chain/storage/proto/BUILD | 44 +
chain/storage/proto/kv.proto | 32 +
chain/storage/proto/leveldb_config.proto | 28 +
chain/storage/res_leveldb.cpp | 169 ---
chain/storage/res_leveldb.h | 65 --
chain/storage/res_leveldb_test.cpp | 111 --
chain/storage/res_rocksdb.cpp | 171 ---
chain/storage/res_rocksdb.h | 61 -
chain/storage/res_rocksdb_test.cpp | 109 --
chain/storage/setting/BUILD | 35 +
chain/storage/storage.h | 65 +-
chain/storage/txn_memory_db.cpp | 50 -
chain/storage/txn_memory_db.h | 48 -
chain/storage/txn_memory_db_test.cpp | 71 --
common/BUILD | 25 +
common/crypto/BUILD | 19 +
common/crypto/hash.cpp | 34 +-
common/crypto/hash.h | 34 +-
common/crypto/hash_test.cpp | 34 +-
common/crypto/key_generator.cpp | 34 +-
common/crypto/key_generator.h | 34 +-
common/crypto/mock_signature_verifier.h | 34 +-
common/crypto/signature_utils.cpp | 34 +-
common/crypto/signature_utils.h | 34 +-
common/crypto/signature_verifier.cpp | 34 +-
common/crypto/signature_verifier.h | 34 +-
common/crypto/signature_verifier_interface.cpp | 34 +-
common/crypto/signature_verifier_interface.h | 34 +-
common/crypto/signature_verifier_test.cpp | 34 +-
common/proto/BUILD | 18 +
common/proto/signature_info.proto | 19 +
common/test/BUILD | 19 +
common/test/json_test.cpp | 34 +-
common/test/test.proto | 19 +
common/test/test_macros.h | 34 +-
common/utils/BUILD | 18 +
common/utils/utils.cpp | 34 +-
common/utils/utils.h | 34 +-
dev/.rat-excludes | 19 +
dev/check-license | 86 ++
documents/doxygen/Doxyfile | 8 +-
documents/doxygen/DoxygenLayout.xml | 16 +
documents/doxygen/doxygen_html_style.css | 20 +
documents/doxygen/header | 60 +
documents/doxygen/logo.png | Bin 803 -> 71672 bytes
documents/file/prometheus.yml | 23 +-
entrypoint.sh | 21 +-
executor/common/BUILD | 18 +
executor/common/custom_query.h | 34 +-
executor/common/mock_transaction_manager.h | 34 +-
executor/common/transaction_manager.cpp | 34 +-
executor/common/transaction_manager.h | 34 +-
executor/contract/executor/BUILD | 18 +
executor/contract/executor/contract_executor.cpp | 34 +-
executor/contract/executor/contract_executor.h | 34 +-
.../contract/executor/contract_executor_test.cpp | 34 +-
executor/contract/executor/test_data/BUILD | 18 +
executor/contract/manager/BUILD | 18 +
executor/contract/manager/address_manager.cpp | 34 +-
executor/contract/manager/address_manager.h | 34 +-
executor/contract/manager/address_manager_test.cpp | 34 +-
executor/contract/manager/contract_manager.cpp | 34 +-
executor/contract/manager/contract_manager.h | 34 +-
.../contract/manager/contract_manager_test.cpp | 36 +-
executor/contract/manager/test_data/BUILD | 18 +
executor/contract/manager/utils.h | 34 +-
executor/kv/BUILD | 50 +-
executor/kv/kv_executor.cpp | 128 ++-
executor/kv/kv_executor.h | 54 +-
executor/kv/kv_executor_test.cpp | 276 ++++-
executor/utxo/executor/BUILD | 18 +
executor/utxo/executor/utxo_executor.cpp | 34 +-
executor/utxo/executor/utxo_executor.h | 34 +-
executor/utxo/executor/utxo_executor_test.cpp | 34 +-
executor/utxo/manager/BUILD | 18 +
executor/utxo/manager/transaction.cpp | 34 +-
executor/utxo/manager/transaction.h | 34 +-
executor/utxo/manager/transaction_test.cpp | 34 +-
executor/utxo/manager/tx_mempool.cpp | 34 +-
executor/utxo/manager/tx_mempool.h | 34 +-
executor/utxo/manager/tx_mempool_test.cpp | 34 +-
executor/utxo/manager/wallet.cpp | 34 +-
executor/utxo/manager/wallet.h | 34 +-
executor/utxo/manager/wallet_test.cpp | 34 +-
img/apache-incubator.png | Bin 0 -> 30207 bytes
img/apache-resdb.png | Bin 0 -> 98785 bytes
img/resdb-v2.png | Bin 0 -> 41784 bytes
img/resdb.png | Bin 0 -> 36015 bytes
interface/common/BUILD | 19 +
interface/common/mock_resdb_txn_accessor.h | 34 +-
interface/common/resdb_state_accessor.cpp | 55 +-
interface/common/resdb_state_accessor.h | 36 +-
interface/common/resdb_state_accessor_test.cpp | 48 +-
interface/common/resdb_txn_accessor.cpp | 75 +-
interface/common/resdb_txn_accessor.h | 35 +-
interface/common/resdb_txn_accessor_test.cpp | 41 +-
interface/contract/BUILD | 18 +
interface/contract/contract_client.cpp | 34 +-
interface/contract/contract_client.h | 34 +-
interface/kv/BUILD | 18 +
interface/kv/kv_client.cpp | 111 +-
interface/kv/kv_client.h | 64 +-
interface/rdbc/BUILD | 18 +
interface/rdbc/mock_net_channel.h | 34 +-
interface/rdbc/mock_resdb_txn_accessor.h | 34 +-
interface/rdbc/net_channel.cpp | 34 +-
interface/rdbc/net_channel.h | 34 +-
interface/rdbc/net_channel_test.cpp | 34 +-
interface/rdbc/transaction_constructor.cpp | 34 +-
interface/rdbc/transaction_constructor.h | 34 +-
interface/rdbc/transaction_constructor_test.cpp | 34 +-
interface/utxo/BUILD | 18 +
interface/utxo/utxo_client.cpp | 34 +-
interface/utxo/utxo_client.h | 34 +-
monitoring/README.md | 19 +
monitoring/prometheus/prometheus.yml | 29 +-
node_modules/@actions/core/README.md | 146 ---
node_modules/@actions/core/lib/command.d.ts | 16 -
node_modules/@actions/core/lib/command.js | 78 --
node_modules/@actions/core/lib/command.js.map | 1 -
node_modules/@actions/core/lib/core.d.ts | 116 --
node_modules/@actions/core/lib/core.js | 209 ----
node_modules/@actions/core/lib/core.js.map | 1 -
node_modules/@actions/core/package.json | 67 --
node_modules/badgen/LICENSE.md | 5 -
node_modules/badgen/README.md | 83 --
node_modules/badgen/dist/calc-text-width.d.ts | 1 -
node_modules/badgen/dist/color-presets.d.ts | 14 -
node_modules/badgen/dist/index.d.ts | 19 -
node_modules/badgen/dist/index.js | 2 -
node_modules/badgen/dist/index.js.map | 1 -
node_modules/badgen/package.json | 65 --
node_modules/badgen/tsconfig.json | 18 -
node_modules/balanced-match/.npmignore | 5 -
node_modules/balanced-match/LICENSE.md | 21 -
node_modules/balanced-match/README.md | 91 --
node_modules/balanced-match/index.js | 59 -
node_modules/balanced-match/package.json | 77 --
node_modules/brace-expansion/LICENSE | 21 -
node_modules/brace-expansion/README.md | 129 ---
node_modules/brace-expansion/index.js | 201 ----
node_modules/brace-expansion/package.json | 75 --
node_modules/concat-map/.travis.yml | 4 -
node_modules/concat-map/LICENSE | 18 -
node_modules/concat-map/README.markdown | 62 -
node_modules/concat-map/example/map.js | 6 -
node_modules/concat-map/index.js | 13 -
node_modules/concat-map/package.json | 88 --
node_modules/concat-map/test/map.js | 39 -
node_modules/fs.realpath/LICENSE | 43 -
node_modules/fs.realpath/README.md | 33 -
node_modules/fs.realpath/index.js | 66 --
node_modules/fs.realpath/old.js | 303 -----
node_modules/fs.realpath/package.json | 59 -
node_modules/glob-gitignore/HISTORY.md | 1 -
node_modules/glob-gitignore/LICENSE | 21 -
node_modules/glob-gitignore/README.md | 121 --
node_modules/glob-gitignore/package.json | 85 --
node_modules/glob-gitignore/src/glob.js | 68 --
node_modules/glob-gitignore/src/index.js | 15 -
node_modules/glob-gitignore/src/sync.js | 50 -
node_modules/glob-gitignore/src/util.js | 137 ---
node_modules/glob/LICENSE | 21 -
node_modules/glob/README.md | 375 -------
node_modules/glob/changelog.md | 67 --
node_modules/glob/common.js | 240 ----
node_modules/glob/glob.js | 790 -------------
node_modules/glob/package.json | 80 --
node_modules/glob/sync.js | 486 --------
node_modules/ignore/CHANGELOG.md | 32 -
node_modules/ignore/LICENSE-MIT | 21 -
node_modules/ignore/README.md | 386 -------
node_modules/ignore/index.d.ts | 63 --
node_modules/ignore/index.js | 568 ----------
node_modules/ignore/legacy.js | 476 --------
node_modules/ignore/package.json | 98 --
node_modules/inflight/LICENSE | 15 -
node_modules/inflight/README.md | 37 -
node_modules/inflight/inflight.js | 54 -
node_modules/inflight/package.json | 58 -
node_modules/inherits/LICENSE | 16 -
node_modules/inherits/README.md | 42 -
node_modules/inherits/inherits.js | 9 -
node_modules/inherits/inherits_browser.js | 27 -
node_modules/inherits/package.json | 61 -
node_modules/lodash.difference/LICENSE | 47 -
node_modules/lodash.difference/README.md | 18 -
node_modules/lodash.difference/index.js | 1170 -------------------
node_modules/lodash.difference/package.json | 69 --
node_modules/lodash.union/LICENSE | 47 -
node_modules/lodash.union/README.md | 18 -
node_modules/lodash.union/index.js | 1181 --------------------
node_modules/lodash.union/package.json | 69 --
node_modules/make-array/README.md | 61 -
node_modules/make-array/index.js | 71 --
node_modules/make-array/package.json | 69 --
node_modules/minimatch/LICENSE | 15 -
node_modules/minimatch/README.md | 209 ----
node_modules/minimatch/minimatch.js | 923 ---------------
node_modules/minimatch/package.json | 63 --
node_modules/once/LICENSE | 15 -
node_modules/once/README.md | 79 --
node_modules/once/once.js | 42 -
node_modules/once/package.json | 67 --
node_modules/path-is-absolute/index.js | 20 -
node_modules/path-is-absolute/license | 21 -
node_modules/path-is-absolute/package.json | 75 --
node_modules/path-is-absolute/readme.md | 59 -
node_modules/util.inherits/HISTORY.md | 1 -
node_modules/util.inherits/README.md | 45 -
node_modules/util.inherits/index.js | 47 -
node_modules/util.inherits/package.json | 81 --
node_modules/wrappy/LICENSE | 15 -
node_modules/wrappy/README.md | 36 -
node_modules/wrappy/package.json | 59 -
node_modules/wrappy/wrappy.js | 33 -
platform/common/data_comm/BUILD | 18 +
platform/common/data_comm/data_comm.h | 34 +-
platform/common/data_comm/network_comm.h | 34 +-
platform/common/network/BUILD | 18 +
platform/common/network/mock_socket.h | 34 +-
platform/common/network/network_utils.cpp | 34 +-
platform/common/network/network_utils.h | 34 +-
platform/common/network/network_utils_test.cpp | 34 +-
platform/common/network/socket.h | 34 +-
platform/common/network/tcp_socket.cpp | 34 +-
platform/common/network/tcp_socket.h | 34 +-
platform/common/network/tcp_socket_test.cpp | 34 +-
platform/common/queue/BUILD | 18 +
platform/common/queue/batch_queue.h | 34 +-
platform/common/queue/batch_queue_test.cpp | 34 +-
platform/common/queue/blocking_queue.h | 34 +-
platform/common/queue/lock_free_queue.h | 36 +-
platform/common/queue/lock_free_queue_test.cpp | 34 +-
platform/config/BUILD | 18 +
platform/config/resdb_config.cpp | 34 +-
platform/config/resdb_config.h | 34 +-
platform/config/resdb_config_test.cpp | 34 +-
platform/config/resdb_config_utils.cpp | 34 +-
platform/config/resdb_config_utils.h | 34 +-
platform/config/resdb_poc_config.cpp | 34 +-
platform/config/resdb_poc_config.h | 34 +-
platform/consensus/checkpoint/BUILD | 18 +
platform/consensus/checkpoint/checkpoint.h | 34 +-
platform/consensus/checkpoint/mock_checkpoint.h | 34 +-
platform/consensus/execution/BUILD | 18 +
platform/consensus/execution/duplicate_manager.cpp | 34 +-
platform/consensus/execution/duplicate_manager.h | 34 +-
.../consensus/execution/geo_global_executor.cpp | 34 +-
platform/consensus/execution/geo_global_executor.h | 34 +-
.../execution/geo_global_executor_test.cpp | 34 +-
.../execution/geo_transaction_executor.cpp | 34 +-
.../consensus/execution/geo_transaction_executor.h | 34 +-
.../execution/geo_transaction_executor_test.cpp | 34 +-
.../consensus/execution/mock_geo_global_executor.h | 34 +-
platform/consensus/execution/system_info.cpp | 34 +-
platform/consensus/execution/system_info.h | 34 +-
platform/consensus/execution/system_info_test.cpp | 34 +-
.../consensus/execution/transaction_executor.cpp | 38 +-
.../consensus/execution/transaction_executor.h | 34 +-
.../execution/transaction_executor_test.cpp | 34 +-
platform/consensus/ordering/common/BUILD | 18 +
platform/consensus/ordering/common/algorithm/BUILD | 29 +
.../ordering/common/algorithm/protocol_base.cpp | 65 ++
.../ordering/common/algorithm/protocol_base.h | 87 ++
platform/consensus/ordering/common/framework/BUILD | 66 ++
.../ordering/common/framework/consensus.cpp | 168 +++
.../ordering/common/framework/consensus.h | 78 ++
.../common/framework/performance_manager.cpp | 276 +++++
.../common/framework/performance_manager.h | 97 ++
.../framework}/response_manager.cpp | 157 +--
.../ordering/common/framework/response_manager.h | 79 ++
.../common/framework/transaction_utils.cpp | 43 +
.../ordering/common/framework/transaction_utils.h | 39 +
.../ordering/common/transaction_utils.cpp | 34 +-
.../consensus/ordering/common/transaction_utils.h | 34 +-
platform/consensus/ordering/geo_pbft/BUILD | 18 +
platform/consensus/ordering/geo_pbft/README.md | 21 +-
.../geo_pbft/consensus_manager_geo_pbft.cpp | 34 +-
.../ordering/geo_pbft/consensus_manager_geo_pbft.h | 34 +-
.../ordering/geo_pbft/geo_pbft_commitment.cpp | 34 +-
.../ordering/geo_pbft/geo_pbft_commitment.h | 34 +-
.../ordering/geo_pbft/geo_pbft_commitment_test.cpp | 34 +-
platform/consensus/ordering/geo_pbft/hash_set.h | 34 +-
platform/consensus/ordering/pbft/BUILD | 24 +-
platform/consensus/ordering/pbft/README.md | 21 +-
.../consensus/ordering/pbft/checkpoint_manager.cpp | 47 +-
.../consensus/ordering/pbft/checkpoint_manager.h | 40 +-
.../ordering/pbft/checkpoint_manager_test.cpp | 34 +-
platform/consensus/ordering/pbft/commitment.cpp | 65 +-
platform/consensus/ordering/pbft/commitment.h | 34 +-
.../consensus/ordering/pbft/commitment_test.cpp | 34 +-
.../ordering/pbft/consensus_manager_pbft.cpp | 35 +-
.../ordering/pbft/consensus_manager_pbft.h | 34 +-
.../ordering/pbft/lock_free_collector_pool.cpp | 34 +-
.../ordering/pbft/lock_free_collector_pool.h | 34 +-
.../pbft/lock_free_collector_pool_test.cpp | 34 +-
.../consensus/ordering/pbft/message_manager.cpp | 39 +-
platform/consensus/ordering/pbft/message_manager.h | 38 +-
.../ordering/pbft/mock_checkpoint_manager.h | 34 +-
.../ordering/pbft/performance_manager.cpp | 45 +-
.../consensus/ordering/pbft/performance_manager.h | 34 +-
.../pbft/pre_very_consensus_service_pbft.h | 34 +-
platform/consensus/ordering/pbft/query.cpp | 95 +-
platform/consensus/ordering/pbft/query.h | 34 +-
platform/consensus/ordering/pbft/query_test.cpp | 44 +-
.../consensus/ordering/pbft/response_manager.cpp | 149 ++-
.../consensus/ordering/pbft/response_manager.h | 61 +-
.../ordering/pbft/response_manager_test.cpp | 34 +-
.../ordering/pbft/transaction_collector.cpp | 34 +-
.../ordering/pbft/transaction_collector.h | 34 +-
.../ordering/pbft/transaction_collector_test.cpp | 34 +-
.../consensus/ordering/pbft/transaction_utils.cpp | 34 +-
.../consensus/ordering/pbft/transaction_utils.h | 34 +-
.../consensus/ordering/pbft/viewchange_manager.cpp | 40 +-
.../consensus/ordering/pbft/viewchange_manager.h | 36 +-
.../ordering/pbft/viewchange_manager_test.cpp | 34 +-
platform/consensus/ordering/poe/algorithm/BUILD | 33 +
platform/consensus/ordering/poe/algorithm/poe.cpp | 91 ++
platform/consensus/ordering/poe/algorithm/poe.h | 59 +
platform/consensus/ordering/poe/framework/BUILD | 33 +
.../consensus/ordering/poe/framework/consensus.cpp | 98 ++
.../consensus/ordering/poe/framework/consensus.h | 53 +
platform/consensus/ordering/poe/proto/BUILD | 34 +
.../consensus/ordering/poe/proto/proposal.proto | 46 +
platform/consensus/recovery/BUILD | 18 +
platform/consensus/recovery/recovery.cpp | 39 +-
platform/consensus/recovery/recovery.h | 34 +-
platform/consensus/recovery/recovery_test.cpp | 48 +-
platform/networkstrate/BUILD | 18 +
platform/networkstrate/README.md | 19 +
platform/networkstrate/async_acceptor.cpp | 36 +-
platform/networkstrate/async_acceptor.h | 34 +-
platform/networkstrate/async_acceptor_test.cpp | 34 +-
platform/networkstrate/async_replica_client.cpp | 34 +-
platform/networkstrate/async_replica_client.h | 34 +-
.../networkstrate/async_replica_client_test.cpp | 34 +-
platform/networkstrate/consensus_manager.cpp | 177 +--
platform/networkstrate/consensus_manager.h | 38 +-
platform/networkstrate/consensus_manager_test.cpp | 34 +-
platform/networkstrate/mock_async_replica_client.h | 34 +-
platform/networkstrate/mock_replica_communicator.h | 34 +-
platform/networkstrate/mock_service_interface.h | 34 +-
platform/networkstrate/replica_communicator.cpp | 36 +-
platform/networkstrate/replica_communicator.h | 34 +-
.../networkstrate/replica_communicator_test.cpp | 34 +-
platform/networkstrate/server_comm.h | 34 +-
platform/networkstrate/service_interface.cpp | 34 +-
platform/networkstrate/service_interface.h | 34 +-
platform/networkstrate/service_network.cpp | 34 +-
platform/networkstrate/service_network.h | 34 +-
platform/networkstrate/service_network_test.cpp | 34 +-
platform/proto/BUILD | 34 +-
platform/proto/broadcast.proto | 19 +
platform/proto/checkpoint_info.proto | 19 +
platform/proto/client_test.proto | 19 +
platform/proto/durable.proto | 18 -
platform/proto/logging.proto | 19 +
platform/proto/network_type.proto | 19 +
platform/proto/replica_info.proto | 26 +-
platform/proto/resdb.proto | 34 +-
platform/proto/system_info_data.proto | 19 +
platform/proto/viewchange_message.proto | 19 +
platform/rdbc/BUILD | 18 +
platform/rdbc/acceptor.cpp | 34 +-
platform/rdbc/acceptor.h | 34 +-
platform/statistic/BUILD | 25 +
platform/statistic/README.md | 19 +
platform/statistic/prometheus_handler.cpp | 34 +-
platform/statistic/prometheus_handler.h | 34 +-
platform/statistic/set_random_data.cpp | 34 +-
platform/statistic/stats.cpp | 262 ++++-
platform/statistic/stats.h | 91 +-
platform/statistic/test_server.sh | 8 -
platform/test/BUILD | 19 +
platform/test/proto/BUILD | 19 +
platform/test/proto/resdb_test.proto | 19 +
platform/test/resdb_test.cpp | 36 +-
platform/test/test_data/BUILD | 19 +
proto/contract/BUILD | 19 +
proto/contract/account.proto | 19 +
proto/contract/contract.proto | 19 +
proto/contract/func_params.proto | 19 +
proto/contract/rpc.proto | 19 +
proto/kv/BUILD | 18 +
proto/kv/kv.proto | 52 +-
proto/utxo/BUILD | 19 +
proto/utxo/config.proto | 19 +
proto/utxo/rpc.proto | 19 +
proto/utxo/utxo.proto | 19 +
script.js | 123 ++
scripts/deploy/README.md | 19 +
scripts/deploy/config/kv_performance_server.conf | 10 +-
scripts/deploy/config/kv_server.conf | 8 +-
scripts/deploy/config/poe.config | 10 +
scripts/deploy/config/template.config | 2 +-
scripts/deploy/performance/calculate_result.py | 18 +-
scripts/deploy/performance/pbft_performance.sh | 21 +
scripts/deploy/performance/poe_performance.sh | 23 +
scripts/deploy/performance/run_performance.sh | 19 +-
scripts/deploy/script/deploy.sh | 42 +-
scripts/deploy/script/env.sh | 19 +-
scripts/deploy/script/generate_config.sh | 18 +
scripts/deploy/script/generate_key.sh | 19 +-
scripts/deploy/script/load_config.sh | 18 +
scripts/format.sh | 20 +
service/contract/BUILD | 18 +
service/contract/contract_service.cpp | 34 +-
service/kv/BUILD | 27 +-
service/kv/kv_service.cpp | 68 +-
service/tools/config/server/server.config | 12 +-
service/tools/contract/README.md | 19 +
service/tools/contract/api_tools/BUILD | 19 +
.../tools/contract/api_tools/contract_tools.cpp | 34 +-
.../contract/api_tools/example_contract/compile.sh | 18 +
.../service_tools/start_contract_service.sh | 24 +-
service/tools/kv/api_tools/BUILD | 19 +
service/tools/kv/api_tools/kv_client_txn_tools.cpp | 36 +-
service/tools/kv/api_tools/kv_service_tools.cpp | 239 +++-
service/tools/kv/server_tools/start_kv_service.sh | 18 +
.../kv/server_tools/start_kv_service_monitoring.sh | 18 +
service/tools/utxo/README.md | 18 +
.../tools/utxo/service_tools/start_utxo_service.sh | 20 +-
service/tools/utxo/wallet_tool/cpp/BUILD | 19 +
service/tools/utxo/wallet_tool/cpp/addr_utils.cpp | 33 +-
service/tools/utxo/wallet_tool/cpp/addr_utils.h | 33 +-
service/tools/utxo/wallet_tool/cpp/key_utils.cpp | 33 +-
service/tools/utxo/wallet_tool/cpp/key_utils.h | 33 +-
.../utxo/wallet_tool/cpp/utxo_client_tools.cpp | 97 +-
service/tools/utxo/wallet_tool/py/BUILD | 19 +
service/tools/utxo/wallet_tool/py/addr.py | 37 +-
service/tools/utxo/wallet_tool/py/keys.py | 38 +-
service/tools/utxo/wallet_tool/pybind/BUILD | 19 +
.../utxo/wallet_tool/pybind/wallet_tools_py.cpp | 33 +-
service/tools/utxo/wallet_tool/test/BUILD | 19 +
service/tools/utxo/wallet_tool/test/key_tester.py | 37 +-
.../utxo/wallet_tool/test/key_tester_utils.cpp | 34 +-
service/utils/BUILD | 19 +
service/utils/server_factory.cpp | 34 +-
service/utils/server_factory.h | 34 +-
service/utxo/BUILD | 19 +
service/utxo/start_contract_server.sh | 18 +
service/utxo/utxo_service.cpp | 34 +-
third_party/BUILD | 40 +-
third_party/asio.BUILD | 23 +-
third_party/civetweb.BUILD | 22 +
third_party/crow.BUILD | 23 +-
third_party/date.BUILD | 25 +-
third_party/eEVM.BUILD | 25 +-
third_party/json.BUILD | 23 +-
third_party/leveldb.BUILD | 25 +-
action.yml => third_party/loc_script/action.yml | 19 +
{src => third_party/loc_script/src}/index.js | 3 +-
third_party/prometheus.BUILD | 22 +
third_party/rapidjson.BUILD | 22 +
third_party/rocksdb.BUILD | 98 --
third_party/snappy.BUILD | 25 +-
third_party/z.BUILD | 26 +-
third_party/zlib.BUILD | 25 +-
third_party/zstd.BUILD | 5 -
tools/BUILD | 19 +
tools/certificate_tools.cpp | 34 +-
tools/certificate_tools_test.cpp | 34 +-
tools/generate_certificate.sh | 18 +
tools/generate_client.sh | 18 +
tools/generate_cluster.sh | 19 +-
tools/generate_key.sh | 18 +
tools/generate_mulregion_config.py | 17 +
tools/generate_region_config.py | 17 +
tools/key_generator_tools.cpp | 34 +-
tools/resdb_state_accessor_tools.cpp | 40 +-
tools/resdb_txn_accessor_tools.cpp | 34 +-
519 files changed, 10739 insertions(+), 17329 deletions(-)
diff --git a/.asf.yaml b/.asf.yaml
new file mode 100644
index 00000000..cfb2ed0e
--- /dev/null
+++ b/.asf.yaml
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+github:
+ description: Global-Scale Sustainable Blockchain Fabric
+ #homepage: resilientdb.apache.org
+ labels:
+ - crypto
+ - smart-contracts
+ - blockchain
+ - solidity
+ - distributed-database
+ - key-value-database
+ - distributed-ledger
+ - blockchain-platform
+ - utxo
+ enabled_merge_buttons:
+ squash: true
+ merge: false
+ rebase: false
+ protected_branches:
+ master:
+
+notifications:
+ commits: commits@resilientdb.apache.org
+ issues: commits@resilientdb.apache.org
+ pullrequests: commits@resilientdb.apache.org
diff --git a/.bazelversion b/.bazelversion
new file mode 100644
index 00000000..09b254e9
--- /dev/null
+++ b/.bazelversion
@@ -0,0 +1 @@
+6.0.0
diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml
index 02701aae..e8e1460e 100644
--- a/.github/workflows/build-push.yml
+++ b/.github/workflows/build-push.yml
@@ -1,3 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
name: ci
on:
@@ -30,6 +49,7 @@ jobs:
with:
file: ./Docker/Dockerfile
context: .
+ platforms: linux/amd64
push: true
tags: expolab/resdb:amd64
@@ -39,5 +59,6 @@ jobs:
with:
file: ./Docker/Dockerfile_mac
context: .
+ platforms: linux/arm64
push: true
- tags: expolab/resdb:arm64
\ No newline at end of file
+ tags: expolab/resdb:arm64
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 618e908f..c1d27b4c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,3 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
name: bazel-build CI
on:
diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml
new file mode 100644
index 00000000..9468e396
--- /dev/null
+++ b/.github/workflows/license.yml
@@ -0,0 +1,37 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name: Check Apache License
+
+on:
+ push
+
+jobs:
+ ubuntu-build:
+ name: check license
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ repository: ${{github.repository}}
+ ref: ${{ env.BRANCH_NAME }}
+
+ - name: Check License Header
+ uses: apache/skywalking-eyes/header@main
diff --git a/.github/workflows/loc.yml b/.github/workflows/loc.yml
index 32f33140..dc418b1e 100644
--- a/.github/workflows/loc.yml
+++ b/.github/workflows/loc.yml
@@ -1,10 +1,29 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
name: LOC
on:
- push:
- branches:
+ push:
+ branches:
- master
-
+
jobs:
build:
runs-on: ubuntu-latest
@@ -16,9 +35,15 @@ jobs:
repository: ${{github.repository}}
ref: ${{ env.BRANCH_NAME }}
+ - name: NPM Init
+ run: npm init -y
+
+ - name: NPM Install
+ run: npm install badgen @actions/core glob-gitignore
+
- name: Launch the local action
- uses: ./ # Uses an action in the root directory
id: badge
+ uses: ./third_party/loc_script/ # Uses an action in the root directory
with:
debug: true
directory: ./
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 6688d39d..3034255f 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,3 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
name: Doxygen Action
on:
diff --git a/.github/workflows/ut.yml b/.github/workflows/ut.yml
index 86aa8573..376bc7f8 100644
--- a/.github/workflows/ut.yml
+++ b/.github/workflows/ut.yml
@@ -1,3 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
name: Unite Test
on:
diff --git a/.gitignore b/.gitignore
index 45e1493c..2595903f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,5 @@ bazel-*
venv
sdk_validator/venv
__pycache__
+MODULE.*
+apache_release
diff --git a/.licenserc.yaml b/.licenserc.yaml
new file mode 100644
index 00000000..6357ff88
--- /dev/null
+++ b/.licenserc.yaml
@@ -0,0 +1,31 @@
+header:
+ license:
+ spdx-id: Apache-2.0
+ copyright-owner: Apache Software Foundation
+
+ paths-ignore:
+ - '.*'
+ - '.**/**'
+ - 'repositories.bzl'
+ - 'CNAME'
+ - 'WORKSPACE'
+ - '**/*.conf'
+ - '**/*.config'
+ - '**/*.json'
+ - '**/*.sol'
+ - '**/*.pri'
+ - '**/*.pub'
+ - 'Doxyfile'
+ - 'header'
+ - 'dev/.rat-excludes'
+ - '**/*.md'
+ - 'DISCLAIMER-WIP'
+ - 'NOTICE'
+ - 'LICENSE'
+ - 'documents/doxygen/.gitignore'
+ - 'third_party/loc_script/src/index.js'
+
+
+
+ comment: on-failure
+
diff --git a/BUILD.bazel b/BUILD.bazel
index ef108781..a2966540 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -1,3 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
load("@rules_foreign_cc//foreign_cc:defs.bzl", "make")
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 01100cbd..b7d0c1fd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,44 @@
+<!--
+ - Licensed to the Apache Software Foundation (ASF) under one
+ - or more contributor license agreements. See the NOTICE file
+ - distributed with this work for additional information
+ - regarding copyright ownership. The ASF licenses this file
+ - to you under the Apache License, Version 2.0 (the
+ - "License"); you may not use this file except in compliance
+ - with the License. You may obtain a copy of the License at
+ -
+ - http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing,
+ - software distributed under the License is distributed on an
+ - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ - KIND, either express or implied. See the License for the
+ - specific language governing permissions and limitations
+ - under the License.
+ -->
+
# Change Log
+### Apache ResilientDB v1.10.0 ([2024-4-16](https://github.com/resilientdb/resilientdb/releases/tag/v1.10.0-rc01))
+
+Add the prototype of PoE. ([Junchao Chen](https://github.com/cjcchen))
+
+* Implement the base version of the Proof-of-Execution (PoE) Consensus Protocol [EDBT 2011].
+
+Add ResView Data Collection and APIs ([Saipranav-Kotamreddy](https://github.com/Saipranav-Kotamreddy))
+
+* Consensus data such as PBFT messages and states is now collected and stored
+* Added APIs to query consensus data and progress of replicas
+* Added APIs to trigger faultiness and test view change
+
+### NexRes v1.9.0 ([2023-11-29](https://github.com/resilientdb/resilientdb/releases/tag/nexres-v1.9.0))
+
+Support Multi-version Key-Value Interface. ([Junchao Chen](https://github.com/cjcchen))
+
+* Get and Set need to provide a version number to fetch the correct version of the data (if exists) or write to the correct version of data (if not overwritten already), respectively.
+* Provide interfaces to obtain historical data with a specific version or a range of versions.
+
+
### NexRes v1.8.0 ([2023-08-21](https://github.com/resilientdb/resilientdb/releases/tag/nexres-v1.8.0))
**Implemented Enhancements:** The view-change recovery protocol was extensively expanded to support the following Byzantine failures through primary/leader replacement and replica recovery. ([Dakai Kang](https://github.com/DakaiKang))
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index 3c938500..f53ce4f0 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -1,3 +1,22 @@
+<!--
+ - Licensed to the Apache Software Foundation (ASF) under one
+ - or more contributor license agreements. See the NOTICE file
+ - distributed with this work for additional information
+ - regarding copyright ownership. The ASF licenses this file
+ - to you under the Apache License, Version 2.0 (the
+ - "License"); you may not use this file except in compliance
+ - with the License. You may obtain a copy of the License at
+ -
+ - http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing,
+ - software distributed under the License is distributed on an
+ - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ - KIND, either express or implied. See the License for the
+ - specific language governing permissions and limitations
+ - under the License.
+ -->
+
# Contributor Covenant Code of Conduct
## Our Pledge
diff --git a/DISCLAIMER-WIP b/DISCLAIMER-WIP
new file mode 100644
index 00000000..d94e089d
--- /dev/null
+++ b/DISCLAIMER-WIP
@@ -0,0 +1,22 @@
+Apache ResilientDB is an effort undergoing incubation at the Apache Software
+Foundation (ASF), sponsored by the Apache Incubator PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness
+or stability of the code, it does indicate that the project has yet to be
+fully endorsed by the ASF.
+
+Some of the incubating project’s releases may not be fully compliant with ASF policy.
+For example, releases may have incomplete or un-reviewed licensing conditions.
+What follows is a list of known issues the project is currently aware of
+(note that this list, by definition, is likely to be incomplete):
+
+If you are planning to incorporate this work into your product/project, please
+be aware that you will need to conduct a thorough licensing review to determine
+the overall implications of including this work. For the current status of this
+project through the Apache Incubator visit:
+https://incubator.apache.org/projects/resilientdb.html
+
diff --git a/Docker/Dockerfile b/Docker/Dockerfile
index 31571586..c5f82544 100644
--- a/Docker/Dockerfile
+++ b/Docker/Dockerfile
@@ -1,3 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
@@ -34,4 +53,4 @@ RUN bazel --version
RUN bazel build @com_github_bazelbuild_buildtools//buildifier:buildifier
RUN bazel build service/tools/kv/api_tools/kv_service_tools
-ENTRYPOINT ["./entrypoint.sh"]
\ No newline at end of file
+ENTRYPOINT ["./entrypoint.sh"]
diff --git a/Docker/Dockerfile_mac b/Docker/Dockerfile_mac
index 211976d8..fb629b39 100644
--- a/Docker/Dockerfile_mac
+++ b/Docker/Dockerfile_mac
@@ -1,3 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
# Use a base image for ARM64 architecture
FROM arm64v8/ubuntu:20.04
diff --git a/INSTALL.sh b/INSTALL.sh
index c64fb0e3..c4fdcff3 100755
--- a/INSTALL.sh
+++ b/INSTALL.sh
@@ -1,3 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
sudo apt update
sudo apt install apt-transport-https curl gnupg -y
sudo apt-get install protobuf-compiler -y
@@ -7,7 +26,7 @@ curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg
sudo mv bazel.gpg /etc/apt/trusted.gpg.d/
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
-sudo apt update && sudo apt install bazel=5.0.0 -y
+sudo apt update && sudo apt install bazel=6.0.0 -y
sudo apt install clang-format -y
rm $PWD/.git/hooks/pre-push
ln -s $PWD/hooks/pre-push $PWD/.git/hooks/pre-push
diff --git a/INSTALL/README.md b/INSTALL/README.md
new file mode 100755
index 00000000..969142a2
--- /dev/null
+++ b/INSTALL/README.md
@@ -0,0 +1,62 @@
+<!--
+ - Licensed to the Apache Software Foundation (ASF) under one
+ - or more contributor license agreements. See the NOTICE file
+ - distributed with this work for additional information
+ - regarding copyright ownership. The ASF licenses this file
+ - to you under the Apache License, Version 2.0 (the
+ - "License"); you may not use this file except in compliance
+ - with the License. You may obtain a copy of the License at
+ -
+ - http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing,
+ - software distributed under the License is distributed on an
+ - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ - KIND, either express or implied. See the License for the
+ - specific language governing permissions and limitations
+ - under the License.
+ -->
+
+# Prerequire
+python3.10
+
+pip
+
+```
+sudo apt update
+sudo apt-get install python3.10-dev -y
+sudo apt-get install python3-dev -y
+sudo apt-get install python3-pip -y
+```
+
+# Install Protobuf
+```
+cd protobuf
+./install_protobuf.sh
+```
+
+# Install Bazel
+```
+cd bazel
+wget https://github.com/bazelbuild/bazelisk/releases/download/v1.8.1/bazelisk-darwin-amd64
+chmod +x bazelisk-darwin-amd64
+mkdir -p bin
+mv bazelisk-darwin-amd64 bin/bazel
+
+bin/bazel --version
+echo "export PATH="$PATH:$PWD/bin"" >> ~/.bashrc
+. ~/.bashrc
+```
+or
+```
+cd bazel
+./install_bazel.sh
+echo "export PATH="$PATH:$PWD/bin"" >> ~/.bashrc
+. ~/.bashrc
+```
+
+
+test bazel
+```
+bazel --version
+```
diff --git a/INSTALL/bazel/install_bazel.sh b/INSTALL/bazel/install_bazel.sh
new file mode 100755
index 00000000..499de820
--- /dev/null
+++ b/INSTALL/bazel/install_bazel.sh
@@ -0,0 +1,27 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+wget wget https://github.com/bazelbuild/bazelisk/releases/download/v1.8.1/bazelisk-linux-amd64
+chmod +x bazelisk-linux-amd64
+mkdir -p bin
+mv bazelisk-linux-amd64 bin/bazel
+
+bin/bazel --version
+echo "export PATH="$PATH:$PWD/bin"" >> ~/.bashrc
+. ~/.bashrc
diff --git a/INSTALL/protobuf/install_protobuf.sh b/INSTALL/protobuf/install_protobuf.sh
new file mode 100755
index 00000000..66edc5ac
--- /dev/null
+++ b/INSTALL/protobuf/install_protobuf.sh
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+pip install protobuf
diff --git a/INSTALL_MAC.sh b/INSTALL_MAC.sh
deleted file mode 100644
index b6d8b76d..00000000
--- a/INSTALL_MAC.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-!/bin/sh
-
-sudo apt update
-sudo apt install g++ -y
-sudo apt install apt-transport-https curl gnupg -y
-sudo apt install protobuf-compiler -y
-
-wget https://github.com/bazelbuild/bazelisk/releases/download/v1.8.1/bazelisk-linux-arm64
-chmod +x bazelisk-linux-arm64
-sudo mv bazelisk-linux-arm64 /usr/local/bin/bazel
-
-sudo apt install clang-format -y
-rm -rf $PWD/.git/hooks/pre-push
-ln -s $PWD/hooks/pre-push $PWD/.git/hooks/pre-push
-
-bazel build @com_github_bazelbuild_buildtools//buildifier:buildifier
-
-# for jemalloc
-sudo apt-get install autoconf automake libtool -y
-
-sudo apt install rapidjson-dev -y
diff --git a/LICENSE b/LICENSE
index 261eeb9e..ad9b5c8b 100644
--- a/LICENSE
+++ b/LICENSE
@@ -199,3 +199,37 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+
+================================================================
+
+This product includes a number of dependencies with separate copyright notices
+and license terms. Your use of these submodules is subject to the terms and
+conditions of the following licenses.
+
+================================================================
+MIT licenses
+================================================================
+
+third_party/loc_script/src/index.js files from https://github.com/shadowmoose/GHA-LoC-Badge/blob/1.0.0/src/index.js
+
+MIT License
+
+Copyright (c) 2020 Mike
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 00000000..2acdbb2a
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,6 @@
+Apache ResilientDB
+Copyright 2023-2024 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/README.md b/README.md
index d20ddf7c..e46106b7 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,22 @@
+<!--
+ - Licensed to the Apache Software Foundation (ASF) under one
+ - or more contributor license agreements. See the NOTICE file
+ - distributed with this work for additional information
+ - regarding copyright ownership. The ASF licenses this file
+ - to you under the Apache License, Version 2.0 (the
+ - "License"); you may not use this file except in compliance
+ - with the License. You may obtain a copy of the License at
+ -
+ - http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing,
+ - software distributed under the License is distributed on an
+ - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ - KIND, either express or implied. See the License for the
+ - specific language governing permissions and limitations
+ - under the License.
+ -->
+



@@ -12,14 +31,23 @@
**[ResilientDB](https://resilientdb.com/)** is a **High Throughput Yielding Permissioned Blockchain Fabric** founded by **[ExpoLab](https://expolab.org/)** at **[UC Davis](https://www.ucdavis.edu/)** in 2018. ResilientDB advocates a **system-centric** design by adopting a **multi-threaded architecture** that encompasses **deep pipelines**. Further, ResilientDB **separates** the ordering of client transactions from their execution, which allows it to **process messages out-of-order**.
+# Downloads:
+Download address for run-directly software package: https://downloads.apache.org/incubator/resilientdb/
+
### Quick Facts on ResilientDB
1. ResilientDB orders client transactions through a highly optimized implementation of the **[PBFT](https://pmg.csail.mit.edu/papers/osdi99.pdf)** [Castro and Liskov, 1998] protocol, which helps to achieve consensus among its replicas. ResilientDB also supports deploying other state-of-the-art consensus protocols *[release are planned]* such as **[GeoBFT](http://www.vldb.org/pvldb/vol13/p868-gupta.pdf)** [**[blog](https://blog.resilientdb.com/2023/03/07/GeoBFT.html), [released](https:// [...]
2. ResilientDB requires deploying at least **3f+1** replicas, where **f (f > 0)** is the maximum number of arbitrary (or malicious) replicas.
3. ResilientDB supports primary-backup architecture, which designates one of the replicas as the **primary** (replica with identifier **0**). The primary replica initiates consensus on a client transaction, while backups agree to follow a non-malicious primary.
4. ResilientDB exposes a wide range of interfaces such as a **Key-Value** store, **Smart Contracts**, **UTXO**, and **Python SDK**. Following are some of the decentralized applications (DApps) built on top of ResilientDB: **[NFT Marketplace](https://nft.resilientdb.com/)** and **[Debitable](https://debitable.resilientdb.com/)**.
-5. To persist blockchain, chain state, and metadata, ResilientDB provides durability through **LevelDB** and **RocksDB**.
+5. To persist blockchain, chain state, and metadata, ResilientDB provides durability through **LevelDB**.
6. ResilientDB provides access to a seamless **GUI display** for deployment and maintenance, and supports **Grafana** for plotting monitoring data.
-7. **[Historial Facts]** The ResilientDB project was founded by **[Mohammad Sadoghi](https://expolab.org/)** along with his students ([Suyash Gupta](https://gupta-suyash.github.io/index.html) as the lead Architect, [Sajjad Rahnama](https://sajjadrahnama.com/), [Jelle Hellings](https://www.jhellings.nl/)) at **[UC Davis](https://www.ucdavis.edu/)** in 2018 and was open-sourced in late 2019. On September 30, 2021, we released ResilientDB v-3.0. In 2022, ResilientDB was completely re-writte [...]
+7. **[Historial Facts]** The ResilientDB project was founded by **[Mohammad Sadoghi](https://expolab.org/)** along with his students ([Suyash Gupta](https://gupta-suyash.github.io/index.html) as the lead Architect, [Sajjad Rahnama](https://sajjadrahnama.com/) as the lead System Designer, and [Jelle Hellings](https://www.jhellings.nl/)) at **[UC Davis](https://www.ucdavis.edu/)** in 2018 and was open-sourced in late 2019. On September 30, 2021, we released ResilientDB v-3.0. In 2022, Resi [...]
+
+<div align = "center">
+<img src="./img/resdb-v2.png" width="220">
+<img src="./img/apache-resdb.png" width="80">
+<img src="./img/apache-incubator.png" width="250">
+</div>
---
@@ -44,10 +72,12 @@ The latest ResilientDB documentation, including a programming guide, is availabl
- System Parameters & Configuration
- Continuous Integration & Testing
-
+<div align = "center">
+<img src="./img/nexres.png" width="600">
+</div>
## OS Requirements
-Ubuntu 20.*
+Ubuntu 20+
---
@@ -59,6 +89,7 @@ Install dependencies:
./INSTALL.sh
+For non-root users, see [INSTALL/README.md](https://github.com/apache/incubator-resilientdb/blob/master/INSTALL/README.md)
Run ResilientDB (Providing a Key-Value Service):
@@ -70,29 +101,219 @@ Build Interactive Tools:
bazel build service/tools/kv/api_tools/kv_service_tools
-Run tools to set a value by a key (for example, set the value with key "test" and value "test_value"):
+## Functions ##
+ResilientDB supports two types of functions: version-based and non-version-based.
+Version-based functions will leverage versions to protect each update, versions must be obtained before updating a key.
- bazel-bin/service/tools/kv/api_tools/kv_service_tools service/tools/config/interface/service.config set test test_value
-
-You will see the following result if successful:
+***Note***: Version-based functions are not compatible with non-version-based functions. Do not use both in your applications.
- client set ret = 0
+We show the functions below and show how to use [kv_service_tools](service/tools/kv/api_tools/kv_service_tools.cpp) to test the function.
-Run tools to get value by a key (for example, get the value with key "test"):
+### Version-Based Functions ###
+#### Get ####
+Obtain the value of `key` with a specific version `v`.
- bazel-bin/service/tools/kv/api_tools/kv_service_tools service/tools/config/interface/service.config get test
-
-You will see the following result if successful:
+ kv_service_tools --config config_file --cmd get_with_version --key key --version v
+
+| parameters | descriptions |
+| ---- | ---- |
+| config | the path of the client config which points to the db entrance |
+| cmd | get_with_version |
+| key | the key you want to obtain |
+| version | the version you want to obtain. (If the `v` is 0, it will return the latest version |
+
+
+Example:
+
+ bazel-bin/service/tools/kv/api_tools/kv_service_tools --config service/tools/config/interface/service.config --cmd get_with_version --key key1 --version 0
+
+Results:
+> get key = key1, value = value: "v2"
+> version: 2
+
+#### Set ####
+Set `value` to the key `key` based on version `v`.
+
+ kv_service_tools --config config_file --cmd set_with_version --key key --version v --value value
+
+| parameters | descriptions |
+| ---- | ---- |
+| config | the path of the client config which points to the db entrance |
+| cmd | set_with_version |
+| key | the key you want to set |
+| version | the version you have obtained. (If the version has been changed during the update, the transaction will be ignored) |
+| value | the new value |
+
+Example:
+
+ bazel-bin/service/tools/kv/api_tools/kv_service_tools --config service/tools/config/interface/service.config --cmd set_with_version --key key1 --version 0 --value v1
+
+Results:
+> set key = key1, value = v3, version = 2 done, ret = 0
+>
+> current value = value: "v3"
+> version: 3
+
+#### Get Key History ####
+Obtain the update history of key `key` within the versions [`v1`, `v2`].
+
+ kv_service_tools --config config_file --cmd get_history --key key --min_version v1 --max_version v2
+
+
+| parameters | descriptions |
+| ---- | ---- |
+| config | the path of the client config which points to the db entrance |
+| cmd | get_history |
+| key | the key you want to obtain |
+| min_version | the minimum version you want to obtain |
+| max_version | the maximum version you want to obtain |
+
+Example:
+
+ bazel-bin/service/tools/kv/api_tools/kv_service_tools --config service/tools/config/interface/service.config --cmd get_history --key key1 --min_version 1 --max_version 2
+
+Results:
+
+> get history key = key1, min version = 1, max version = 2 <br>
+> value = <br>
+> item { <br>
+>   key: "key1" <br>
+>   value_info { <br>
+>    value: "v1" <br>
+>    version: 2 <br>
+>  } <br>
+> } <br>
+> item { <br>
+>   key: "key1" <br>
+>   value_info { <br>
+>    value: "v0" <br>
+>    version: 1 <br>
+>  } <br>
+> }
+
+#### Get Top ####
+Obtain the recent `top_number` history of the key `key`.
+
+ kv_service_tools --config config_path --cmd get_top --key key --top top_number
+
+| parameters | descriptions |
+| ---- | ---- |
+| config | the path of the client config which points to the db entrance |
+| cmd | get_top |
+| key | the key you want to obtain |
+| top | the number of the recent updates |
+
+Example:
+
+ bazel-bin/service/tools/kv/api_tools/kv_service_tools --config service/tools/config/interface/service.config --cmd get_top --key key1 --top 1
+
+Results:
- client get value = test_value
+>key = key1, top 1 <br>
+> value = <br>
+> item { <br>
+> key: "key1" <br>
+>  value_info { <br>
+>    value: "v2" <br>
+>    version: 3 <br>
+>  } <br>
+>}
-Run tools to get all values that have been set:
+#### Get Key Range ####
+Obtain the values of the keys in the ranges [`key1`, `key2`]. Do not use this function in your practice code
- bazel-bin/service/tools/kv/api_tools/kv_service_tools service/tools/config/interface/service.config getvalues
+ kv_service_tools --config config_file --cmd get_key_range_with_version --min_key key1 --max_key key2
-You will see the following result if successful:
+| parameters | descriptions |
+| ---- | ---- |
+| config | the path of the client config which points to the db entrance |
+| cmd | get_key_range_with_version |
+| min_key | the minimum key |
+| max_key | the maximum key |
+
+Example:
+
+ bazel-bin/service/tools/kv/api_tools/kv_service_tools --config service/tools/config/interface/service.config --cmd get_key_range_with_version --min_key key1 --max_key key3
+
+Results:
+
+>min key = key1 max key = key2 <br>
+> getrange value = <br>
+> item { <br>
+>   key: "key1" <br>
+>   value_info { <br>
+>    value: "v0" <br>
+>    version: 1 <br>
+>   } <br>
+> } <br>
+> item { <br>
+>   key: "key2" <br>
+>   value_info { <br>
+>    value: "v1" <br>
+>    version: 1 <br>
+>   } <br>
+>}
+
+
+### Non-Version-Based Function ###
+#### Set #####
+Set `value` to the key `key`.
+
+ kv_service_tools --config config_file --cmd set --key key --value value
+
+| parameters | descriptions |
+| ---- | ---- |
+| config | the path of the client config which points to the db entrance |
+| cmd | set |
+| key | the key you want to set |
+| value | the new value |
+
+Example:
+
+ bazel-bin/service/tools/kv/api_tools/kv_service_tools --config service/tools/config/interface/service.config --cmd set --key key1 --value value1
+
+Results:
+> set key = key1, value = v1, done, ret = 0
+
+#### Get ####
+Obtain the value of `key`.
+
+ kv_service_tools --config config_file --cmd get --key key
+
+| parameters | descriptions |
+| ---- | ---- |
+| config | the path of the client config which points to the db entrance |
+| cmd | get |
+| key | the key you want to obtain |
+
+Example:
+
+ bazel-bin/service/tools/kv/api_tools/kv_service_tools --config service/tools/config/interface/service.config --cmd get --key key1
+
+Results:
+> get key = key1, value = "v2"
+
+
+#### Get Key Range ####
+Obtain the values of the keys in the ranges [`key1`, `key2`]. Do not use this function in your practice code
+
+ kv_service_tools --config config_path --cmd get_key_range --min_key key1 --max_key key2
+
+| parameters | descriptions |
+| ---- | ---- |
+| config | the path of the client config which points to the db entrance |
+| cmd | get_key_range |
+| min_key | the minimum key |
+| max_key | the maximum key |
+
+Example:
+
+ bazel-bin/service/tools/kv/api_tools/kv_service_tools --config service/tools/config/interface/service.config --cmd get_key_range --min_key key1 --max_key key3
+
+Results:
+> getrange min key = key1, max key = key3 <br>
+> value = [v3,v2,v1]
- client getvalues value = [test_value]
## Deployment Script
@@ -135,14 +356,4 @@ We also provide access to a [deployment script](https://github.com/resilientdb/r
docker exec -it myserver bash
```
- Verify the functionality of the service by performing set and get operations:
-
- - Set a test value:
- ```shell
- bazel-bin/service/tools/kv/api_tools/kv_service_tools service/tools/config/interface/service.config set test test_value
- ```
-
- - Retrieve the test value:
- ```
- bazel-bin/service/tools/kv/api_tools/kv_service_tools service/tools/config/interface/service.config get test
- ```
\ No newline at end of file
+ Verify the functionality of the service by performing set and get operations provided above [functions](README.md#functions).
diff --git a/WORKSPACE b/WORKSPACE
index 317fefbf..93a66164 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -140,8 +140,6 @@ http_archive(
],
)
-#prometheus cpp client library
-
http_archive(
name = "com_google_leveldb",
build_file = "@com_resdb_nexres//third_party:leveldb.BUILD",
@@ -176,30 +174,10 @@ http_archive(
url = "https://github.com/madler/zlib/archive/v1.2.11.tar.gz",
)
-bind(
- name = "zstd",
- actual = "//third_party:zstd",
-)
-
-http_archive(
- name = "com_facebook_zstd",
- build_file_content = all_content,
- strip_prefix = "zstd-1.5.2",
- url = "https://github.com/facebook/zstd/archive/refs/tags/v1.5.2.zip",
-)
-
-http_archive(
- name = "com_github_facebook_rocksdb",
- build_file = "@com_resdb_nexres//third_party:rocksdb.BUILD",
- sha256 = "928cbd416c0531e9b2e7fa74864ce0d7097dca3f5a8c31f31459772a28dbfcba",
- strip_prefix = "rocksdb-7.2.2",
- url = "https://github.com/facebook/rocksdb/archive/refs/tags/v7.2.2.zip",
-)
-
http_archive(
name = "pybind11_bazel",
- strip_prefix = "pybind11_bazel-master",
- urls = ["https://github.com/pybind/pybind11_bazel/archive/master.zip"],
+ strip_prefix = "pybind11_bazel-2.11.1.bzl.1",
+ urls = ["https://github.com/pybind/pybind11_bazel/archive/refs/tags/v2.11.1.bzl.1.zip"],
)
http_archive(
@@ -224,3 +202,24 @@ http_archive(
strip_prefix = "json-3.9.1",
urls = ["https://github.com/nlohmann/json/archive/v3.9.1.tar.gz"],
)
+
+http_archive(
+ name = "com_crowcpp_crow",
+ build_file = "//third_party:crow.BUILD",
+ sha256 = "f95128a8976fae6f2922823e07da59edae277a460776572a556a4b663ff5ee4b",
+ strip_prefix = "Crow-1.0-5",
+ url = "https://github.com/CrowCpp/Crow/archive/refs/tags/v1.0+5.zip",
+)
+
+bind(
+ name = "asio",
+ actual = "@com_chriskohlhoff_asio//:asio",
+)
+
+http_archive(
+ name = "com_chriskohlhoff_asio",
+ build_file = "//third_party:asio.BUILD",
+ sha256 = "babcdfd2c744905a73d20de211b51367bda0d5200f11d654c4314b909d8c963c",
+ strip_prefix = "asio-asio-1-26-0",
+ url = "https://github.com/chriskohlhoff/asio/archive/refs/tags/asio-1-26-0.zip",
+)
diff --git a/api/BUILD b/api/BUILD
new file mode 100644
index 00000000..5bad893b
--- /dev/null
+++ b/api/BUILD
@@ -0,0 +1,38 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+package(default_visibility = ["//visibility:public"])
+
+cc_binary(
+ name = "pybind_kv.so",
+ srcs = ["pybind_kv_service.cpp"],
+ linkshared = 1,
+ linkstatic = 1,
+ deps = [
+ "@//common/proto:signature_info_cc_proto",
+ "@//interface/kv:kv_client",
+ "@//platform/config:resdb_config_utils",
+ "@pybind11",
+ ],
+)
+
+py_library(
+ name = "pybind_kv_so",
+ data = [":pybind_kv.so"],
+ imports = ["."],
+)
diff --git a/api/README.md b/api/README.md
new file mode 100644
index 00000000..d25474f3
--- /dev/null
+++ b/api/README.md
@@ -0,0 +1,66 @@
+<!--
+ - Licensed to the Apache Software Foundation (ASF) under one
+ - or more contributor license agreements. See the NOTICE file
+ - distributed with this work for additional information
+ - regarding copyright ownership. The ASF licenses this file
+ - to you under the Apache License, Version 2.0 (the
+ - "License"); you may not use this file except in compliance
+ - with the License. You may obtain a copy of the License at
+ -
+ - http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing,
+ - software distributed under the License is distributed on an
+ - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ - KIND, either express or implied. See the License for the
+ - specific language governing permissions and limitations
+ - under the License.
+ -->
+
+# ResilientDB kv-Service Python API(Get and Set Command)
+
+## Description
+This API allows users to use kv-service of the ResilientDB in Python directly.
+
+## How to Run
+1. Make sure to run `./INSTALL.sh` in advance.
+1. cd to `incubator-resilientdb/api` folder.
+2. Run command `bazel build :pybind_kv_so`.
+3. From `kv_operation.py`, import `get_value` and `set_value` functions into your Python file to use it (Make sure to use the same Python version when running `bazel build` command and calling the functions).
+
+## Parameters
+### `set_value`:
+1. `key`: The key user wants to store in a key-value pair. Acceptable types are `str`, `int`, `float`.
+2. `value`: The corresponding value to `key` in the key-value pair. Acceptable types are `str`, `int`, `float`.
+3. config_path (optional): The path to the user's blockchain config file (IP addresses). If the user does not specify this parameter, the system will default to the address located in "ip.address.config." The acceptable type is `str`.
+4. `return`: `True` if `value` has been set successfully; otherwise, `value` has not been set successfully.
+### `get_value`:
+1. `key`: The key user wants to get in a key-value pair. Acceptable types are `str`, `int`, `float`.
+2. `return`: `\n` if the corresponding value of `key` is empty, otherwise is the corresponding value of `key`.
+
+
+## Example
+```angular2html
+import sys
+# Your path to ResilientDB api folder
+sys.path.append("/home/ubuntu/Desktop/incubator-resilientdb/api")
+from kv_operation import set_value, get_value
+
+set_value("test", "111222")
+get_value("test")
+```
+
+If having set up the environment parameter, "sys.path" can be ignorred.
+```
+export PYTHON_PATH="/home/ubuntu/Desktop/incubator-resilientdb/api":PYTHON_PATH
+```
+```angular2html
+from kv_operation import set_value, get_value
+
+set_value("test", "111222")
+get_value("test")
+```
+
+
+
+
diff --git a/api/ip_address.config b/api/ip_address.config
new file mode 100644
index 00000000..e119673e
--- /dev/null
+++ b/api/ip_address.config
@@ -0,0 +1 @@
+5 44.193.63.142 17005
\ No newline at end of file
diff --git a/api/kv_operation.py b/api/kv_operation.py
new file mode 100644
index 00000000..f18c8460
--- /dev/null
+++ b/api/kv_operation.py
@@ -0,0 +1,46 @@
+#
+ # Licensed to the Apache Software Foundation (ASF) under one
+ # or more contributor license agreements. See the NOTICE file
+ # distributed with this work for additional information
+ # regarding copyright ownership. The ASF licenses this file
+ # to you under the Apache License, Version 2.0 (the
+ # "License"); you may not use this file except in compliance
+ # with the License. You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing,
+ # software distributed under the License is distributed on an
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ # KIND, either express or implied. See the License for the
+ # specific language governing permissions and limitations
+ # under the License.
+ #
+
+import os
+import sys
+current_file_path = os.path.abspath(__file__)
+current_dir = os.path.dirname(current_file_path)
+parent_dir = os.path.dirname(current_dir)
+new_path_dir = os.path.join(parent_dir, "bazel-out", "k8-fastbuild", "bin", "api")
+sys.path.insert(0, new_path_dir)
+import pybind_kv
+
+
+def set_value(key: str or int or float, value: str or int or float, config_path: str = current_dir + "/ip_address.config") -> bool:
+ """
+ :param key: The key you want to set your value to.
+ :param value: The key's corresponding value in key value pair.
+ :param config_path: Default is connect to the main chain, users can specify the path to connect to their local blockchain.
+ :return: True if value has been set successfully.
+ """
+ return pybind_kv.set(str(key), str(value), os.path.abspath(config_path))
+
+
+def get_value(key: str or int or float, config_path: str = current_dir + "/ip_address.config") -> str:
+ """
+ :param key: The key of the value you want to get in key value pair.
+ :param config_path: Default is connect to the main chain, users can specify the path to connect to their local blockchain.
+ :return: A string of the key's corresponding value.
+ """
+ return pybind_kv.get(str(key), os.path.abspath(config_path))
diff --git a/api/pybind_kv_service.cpp b/api/pybind_kv_service.cpp
new file mode 100644
index 00000000..013683fb
--- /dev/null
+++ b/api/pybind_kv_service.cpp
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <fcntl.h>
+#include <getopt.h>
+#include <pybind11/pybind11.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <fstream>
+
+#include "common/proto/signature_info.pb.h"
+#include "interface/kv/kv_client.h"
+#include "platform/config/resdb_config_utils.h"
+
+using resdb::GenerateReplicaInfo;
+using resdb::GenerateResDBConfig;
+using resdb::KVClient;
+using resdb::ReplicaInfo;
+using resdb::ResDBConfig;
+
+std::string get(std::string key, std::string config_path) {
+ ResDBConfig config = GenerateResDBConfig(config_path);
+ config.SetClientTimeoutMs(100000);
+ KVClient client(config);
+ auto result_ptr = client.Get(key);
+ if (result_ptr) {
+ return *result_ptr;
+ } else {
+ return "";
+ }
+}
+
+bool set(std::string key, std::string value, std::string config_path) {
+ ResDBConfig config = GenerateResDBConfig(config_path);
+ config.SetClientTimeoutMs(100000);
+ KVClient client(config);
+ int result = client.Set(key, value);
+ if (result == 0) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+PYBIND11_MODULE(pybind_kv, m) {
+ m.def("get", &get, "A function that gets a value from the key-value store");
+ m.def("set", &set, "A function that sets a value in the key-value store");
+}
diff --git a/benchmark/protocols/pbft/BUILD b/benchmark/protocols/pbft/BUILD
index 456d6d4c..f99e8206 100644
--- a/benchmark/protocols/pbft/BUILD
+++ b/benchmark/protocols/pbft/BUILD
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:private"])
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
@@ -6,6 +24,7 @@ cc_binary(
name = "kv_server_performance",
srcs = ["kv_server_performance.cpp"],
deps = [
+ "//chain/storage:memory_db",
"//executor/kv:kv_executor",
"//platform/config:resdb_config_utils",
"//platform/consensus/ordering/pbft:consensus_manager_pbft",
diff --git a/benchmark/protocols/pbft/kv_server_performance.cpp b/benchmark/protocols/pbft/kv_server_performance.cpp
index 8efd5b93..7a81f27c 100644
--- a/benchmark/protocols/pbft/kv_server_performance.cpp
+++ b/benchmark/protocols/pbft/kv_server_performance.cpp
@@ -1,31 +1,25 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include <glog/logging.h>
-#include "chain/state/chain_state.h"
+#include "chain/storage/memory_db.h"
#include "executor/kv/kv_executor.h"
#include "platform/config/resdb_config_utils.h"
#include "platform/consensus/ordering/pbft/consensus_manager_pbft.h"
@@ -34,6 +28,7 @@
#include "proto/kv/kv.pb.h"
using namespace resdb;
+using namespace resdb::storage;
void ShowUsage() {
printf("<config> <private_key> <cert_file> [logging_dir]\n");
@@ -69,7 +64,7 @@ int main(int argc, char** argv) {
config->RunningPerformance(true);
auto performance_consens = std::make_unique<ConsensusManagerPBFT>(
- *config, std::make_unique<KVExecutor>(std::make_unique<ChainState>()));
+ *config, std::make_unique<KVExecutor>(std::make_unique<MemoryDB>()));
performance_consens->SetupPerformanceDataFunc([]() {
KVRequest request;
request.set_cmd(KVRequest::SET);
diff --git a/benchmark/protocols/pbft/kv_service_tools.cpp b/benchmark/protocols/pbft/kv_service_tools.cpp
index 17858ef2..43627b34 100644
--- a/benchmark/protocols/pbft/kv_service_tools.cpp
+++ b/benchmark/protocols/pbft/kv_service_tools.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include <fcntl.h>
diff --git a/benchmark/protocols/poe/BUILD b/benchmark/protocols/poe/BUILD
new file mode 100644
index 00000000..7f1cc05e
--- /dev/null
+++ b/benchmark/protocols/poe/BUILD
@@ -0,0 +1,33 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+package(default_visibility = ["//visibility:private"])
+
+load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
+
+cc_binary(
+ name = "kv_server_performance",
+ srcs = ["kv_server_performance.cpp"],
+ deps = [
+ "//chain/storage:memory_db",
+ "//executor/kv:kv_executor",
+ "//platform/config:resdb_config_utils",
+ "//platform/consensus/ordering/poe/framework:consensus",
+ "//service/utils:server_factory",
+ ],
+)
diff --git a/benchmark/protocols/poe/kv_server_performance.cpp b/benchmark/protocols/poe/kv_server_performance.cpp
new file mode 100644
index 00000000..90a220a1
--- /dev/null
+++ b/benchmark/protocols/poe/kv_server_performance.cpp
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <glog/logging.h>
+
+#include "chain/storage/memory_db.h"
+#include "executor/kv/kv_executor.h"
+#include "platform/config/resdb_config_utils.h"
+#include "platform/consensus/ordering/poe/framework/consensus.h"
+#include "platform/networkstrate/service_network.h"
+#include "platform/statistic/stats.h"
+#include "proto/kv/kv.pb.h"
+
+using namespace resdb;
+using namespace resdb::poe;
+using namespace resdb::storage;
+
+void ShowUsage() {
+ printf("<config> <private_key> <cert_file> [logging_dir]\n");
+}
+
+std::string GetRandomKey() {
+ int num1 = rand() % 10;
+ int num2 = rand() % 10;
+ return std::to_string(num1) + std::to_string(num2);
+}
+
+int main(int argc, char** argv) {
+ if (argc < 3) {
+ ShowUsage();
+ exit(0);
+ }
+
+ // google::InitGoogleLogging(argv[0]);
+ // FLAGS_minloglevel = google::GLOG_WARNING;
+
+ char* config_file = argv[1];
+ char* private_key_file = argv[2];
+ char* cert_file = argv[3];
+
+ if (argc >= 5) {
+ auto monitor_port = Stats::GetGlobalStats(5);
+ monitor_port->SetPrometheus(argv[4]);
+ }
+
+ std::unique_ptr<ResDBConfig> config =
+ GenerateResDBConfig(config_file, private_key_file, cert_file);
+
+ config->RunningPerformance(true);
+ ResConfigData config_data = config->GetConfigData();
+
+ auto performance_consens = std::make_unique<Consensus>(
+ *config, std::make_unique<KVExecutor>(std::make_unique<MemoryDB>()));
+ performance_consens->SetupPerformanceDataFunc([]() {
+ KVRequest request;
+ request.set_cmd(KVRequest::SET);
+ request.set_key(GetRandomKey());
+ request.set_value("helloword");
+ std::string request_data;
+ request.SerializeToString(&request_data);
+ return request_data;
+ });
+
+ auto server =
+ std::make_unique<ServiceNetwork>(*config, std::move(performance_consens));
+ server->Run();
+}
diff --git a/chain/state/BUILD b/chain/state/BUILD
index 900212dd..f4bcde57 100644
--- a/chain/state/BUILD
+++ b/chain/state/BUILD
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
cc_library(
@@ -5,8 +23,8 @@ cc_library(
srcs = ["chain_state.cpp"],
hdrs = ["chain_state.h"],
deps = [
- "//chain/storage",
"//common:comm",
+ "//platform/proto:resdb_cc_proto",
],
)
diff --git a/chain/state/chain_state.cpp b/chain/state/chain_state.cpp
index 98a82e6b..18eaed71 100644
--- a/chain/state/chain_state.cpp
+++ b/chain/state/chain_state.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "chain/state/chain_state.h"
@@ -29,64 +23,22 @@
namespace resdb {
-ChainState::ChainState(std::unique_ptr<Storage> storage)
- : storage_(std::move(storage)) {}
-
-Storage* ChainState::GetStorage() {
- return storage_ ? storage_.get() : nullptr;
-}
+ChainState::ChainState() : max_seq_(0) {}
-int ChainState::SetValue(const std::string& key, const std::string& value) {
- if (storage_) {
- return storage_->SetValue(key, value);
+Request* ChainState::Get(uint64_t seq) {
+ std::unique_lock<std::mutex> lk(mutex_);
+ if (data_.find(seq) == data_.end()) {
+ return nullptr;
}
- kv_map_[key] = value;
- return 0;
+ return data_[seq].get();
}
-std::string ChainState::GetValue(const std::string& key) {
- if (storage_) {
- return storage_->GetValue(key);
- }
- auto search = kv_map_.find(key);
- if (search != kv_map_.end())
- return search->second;
- else {
- return "";
- }
+void ChainState::Put(std::unique_ptr<Request> request) {
+ std::unique_lock<std::mutex> lk(mutex_);
+ max_seq_ = request->seq();
+ data_[max_seq_] = std::move(request);
}
-std::string ChainState::GetAllValues(void) {
- if (storage_) {
- return storage_->GetAllValues();
- }
- std::string values = "[";
- bool first_iteration = true;
- for (auto kv : kv_map_) {
- if (!first_iteration) values.append(",");
- first_iteration = false;
- values.append(kv.second);
- }
- values.append("]");
- return values;
-}
-
-std::string ChainState::GetRange(const std::string& min_key,
- const std::string& max_key) {
- if (storage_) {
- return storage_->GetRange(min_key, max_key);
- }
- std::string values = "[";
- bool first_iteration = true;
- for (auto kv : kv_map_) {
- if (kv.first >= min_key && kv.first <= max_key) {
- if (!first_iteration) values.append(",");
- first_iteration = false;
- values.append(kv.second);
- }
- }
- values.append("]");
- return values;
-}
+uint64_t ChainState::GetMaxSeq() { return max_seq_; }
} // namespace resdb
diff --git a/chain/state/chain_state.h b/chain/state/chain_state.h
index e2671ab5..697b1afc 100644
--- a/chain/state/chain_state.h
+++ b/chain/state/chain_state.h
@@ -1,50 +1,42 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
-#include <memory>
+#include <map>
#include <unordered_map>
-#include "chain/storage/storage.h"
+#include "platform/proto/resdb.pb.h"
namespace resdb {
class ChainState {
public:
- ChainState(std::unique_ptr<Storage> storage = nullptr);
- int SetValue(const std::string& key, const std::string& value);
- std::string GetValue(const std::string& key);
- std::string GetAllValues(void);
- std::string GetRange(const std::string& min_key, const std::string& max_key);
-
- Storage* GetStorage();
+ ChainState();
+ Request* Get(uint64_t seq);
+ void Put(std::unique_ptr<Request> request);
+ uint64_t GetMaxSeq();
private:
- std::unique_ptr<Storage> storage_ = nullptr;
- std::unordered_map<std::string, std::string> kv_map_;
+ std::mutex mutex_;
+ std::unordered_map<uint64_t, std::unique_ptr<Request> > data_;
+ std::atomic<uint64_t> max_seq_;
};
} // namespace resdb
diff --git a/chain/state/chain_state_test.cpp b/chain/state/chain_state_test.cpp
index 0d0fda1e..7fd3fbe1 100644
--- a/chain/state/chain_state_test.cpp
+++ b/chain/state/chain_state_test.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "chain/state/chain_state.h"
@@ -28,25 +22,42 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
+#include "common/test/test_macros.h"
+
namespace resdb {
namespace {
-TEST(KVServerExecutorTest, SetValue) {
- ChainState state;
+using ::resdb::testing::EqualsProto;
+using ::testing::Pointee;
+
+TEST(ChainStateTest, GetEmptyValue) {
+ ChainState db;
+ EXPECT_EQ(db.Get(1), nullptr);
+}
- EXPECT_EQ(state.GetAllValues(), "[]");
- EXPECT_EQ(state.SetValue("test_key", "test_value"), 0);
- EXPECT_EQ(state.GetValue("test_key"), "test_value");
+TEST(ChainStateTest, GetValue) {
+ Request request;
+ request.set_seq(1);
+ request.set_data("test");
- // GetValues and GetRange may be out of order for in-memory, so we test up to
- // 1 key-value pair
- EXPECT_EQ(state.GetAllValues(), "[test_value]");
- EXPECT_EQ(state.GetRange("a", "z"), "[test_value]");
+ ChainState db;
+ db.Put(std::make_unique<Request>(request));
+ EXPECT_THAT(db.Get(1), Pointee(EqualsProto(request)));
}
-TEST(KVServerExecutorTest, GetValue) {
- ChainState state;
- EXPECT_EQ(state.GetValue("test_key"), "");
+TEST(ChainStateTest, GetSecondValue) {
+ Request request;
+ request.set_seq(1);
+ request.set_data("test");
+
+ ChainState db;
+ db.Put(std::make_unique<Request>(request));
+
+ request.set_seq(1);
+ request.set_data("test_1");
+ db.Put(std::make_unique<Request>(request));
+
+ EXPECT_THAT(db.Get(1), Pointee(EqualsProto(request)));
}
} // namespace
diff --git a/chain/storage/BUILD b/chain/storage/BUILD
index 0a0c8e7f..19108fa9 100644
--- a/chain/storage/BUILD
+++ b/chain/storage/BUILD
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
cc_library(
@@ -16,55 +34,34 @@ cc_library(
)
cc_library(
- name = "res_leveldb",
- srcs = ["res_leveldb.cpp"],
- hdrs = ["res_leveldb.h"],
+ name = "memory_db",
+ srcs = ["memory_db.cpp"],
+ hdrs = ["memory_db.h"],
deps = [
":storage",
"//common:comm",
- "//platform/proto:replica_info_cc_proto",
- "//third_party:leveldb",
- ],
-)
-
-cc_test(
- name = "res_leveldb_test",
- srcs = ["res_leveldb_test.cpp"],
- deps = [
- ":res_leveldb",
- "//common/test:test_main",
],
)
cc_library(
- name = "res_rocksdb",
- srcs = ["res_rocksdb.cpp"],
- hdrs = ["res_rocksdb.h"],
- tags = ["manual"],
+ name = "leveldb",
+ srcs = ["leveldb.cpp"],
+ hdrs = ["leveldb.h"],
deps = [
":storage",
+ "//chain/storage/proto:kv_cc_proto",
+ "//chain/storage/proto:leveldb_config_cc_proto",
"//common:comm",
- "//platform/proto:replica_info_cc_proto",
- "//third_party:rocksdb",
+ "//third_party:leveldb",
],
)
cc_test(
- name = "res_rocksdb_test",
- srcs = ["res_rocksdb_test.cpp"],
- tags = ["manual"],
+ name = "kv_storage_test",
+ srcs = ["kv_storage_test.cpp"],
deps = [
- ":res_rocksdb",
+ ":leveldb",
+ ":memory_db",
"//common/test:test_main",
],
)
-
-cc_library(
- name = "txn_memory_db",
- srcs = ["txn_memory_db.cpp"],
- hdrs = ["txn_memory_db.h"],
- deps = [
- "//common:comm",
- "//platform/proto:resdb_cc_proto",
- ],
-)
diff --git a/chain/storage/README.md b/chain/storage/README.md
deleted file mode 100644
index 033b0517..00000000
--- a/chain/storage/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Durable layer
-## How to use
-Look at [proto/durable.proto](https://github.com/msadoghi/nexres/blob/master/proto/durable.proto) and [proto/replica_info.proto](https://github.com/msadoghi/nexres/blob/master/proto/replica_info.proto) for how to format the durability settings.
-
-A config file for 4 replicas on localhost can be found at [config/example/kv_config.config](https://github.com/msadoghi/nexres/blob/master/example/kv_config.config).
-
-## Warning
-
-If "path" is not set in the durability settings for RocksDB or LevelDB then default paths will be generated in the /tmp/ folder, which is cleared whenever the machine is shut down.
-
-If you are testing Nexres on your local machine using localhost ip, then make sure to set generate_unique_pathnames to true, because multiple processes are not allowed to open up the same RocksDB/LevelDB directory at the same time. When generate_unique_pathnames is set to true, the durable layer uses the cert file names to generate separate directories for each port of the localhost ip.
-
-For example, the process hosting a server with cert_1.cert will append "1" to its directory path. If the cert file name does not contain a number and generate_unique_pathnames is set, "0" will be appended to the path.
diff --git a/chain/storage/kv_storage_test.cpp b/chain/storage/kv_storage_test.cpp
new file mode 100644
index 00000000..fd8c4bfd
--- /dev/null
+++ b/chain/storage/kv_storage_test.cpp
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <glog/logging.h>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include <filesystem>
+
+#include "chain/storage/leveldb.h"
+#include "chain/storage/memory_db.h"
+
+namespace resdb {
+namespace storage {
+namespace {
+
+enum StorageType {
+ MEM = 0,
+ LEVELDB = 1,
+};
+
+class KVStorageTest : public ::testing::TestWithParam<StorageType> {
+ protected:
+ KVStorageTest() {
+ StorageType t = GetParam();
+ switch (t) {
+ case MEM:
+ storage = NewMemoryDB();
+ break;
+ case LEVELDB:
+ Reset();
+ storage = NewResLevelDB(path_);
+ break;
+ }
+ }
+
+ private:
+ void Reset() { std::filesystem::remove_all(path_.c_str()); }
+
+ protected:
+ std::unique_ptr<Storage> storage;
+ std::string path_ = "/tmp/leveldb_test";
+};
+
+TEST_P(KVStorageTest, SetValue) {
+ EXPECT_EQ(storage->SetValue("test_key", "test_value"), 0);
+ EXPECT_EQ(storage->GetValue("test_key"), "test_value");
+}
+
+TEST_P(KVStorageTest, GetValue) {
+ EXPECT_EQ(storage->GetValue("test_key"), "");
+}
+
+TEST_P(KVStorageTest, GetEmptyValueWithVersion) {
+ EXPECT_EQ(storage->GetValueWithVersion("test_key", 0),
+ std::make_pair(std::string(""), 0));
+}
+
+TEST_P(KVStorageTest, SetValueWithVersion) {
+ EXPECT_EQ(storage->SetValueWithVersion("test_key", "test_value", 1), -2);
+
+ EXPECT_EQ(storage->SetValueWithVersion("test_key", "test_value", 0), 0);
+
+ EXPECT_EQ(storage->GetValueWithVersion("test_key", 0),
+ std::make_pair(std::string("test_value"), 1));
+ EXPECT_EQ(storage->GetValueWithVersion("test_key", 1),
+ std::make_pair(std::string("test_value"), 1));
+
+ EXPECT_EQ(storage->SetValueWithVersion("test_key", "test_value_v2", 2), -2);
+ EXPECT_EQ(storage->SetValueWithVersion("test_key", "test_value_v2", 1), 0);
+
+ EXPECT_EQ(storage->GetValueWithVersion("test_key", 0),
+ std::make_pair(std::string("test_value_v2"), 2));
+
+ EXPECT_EQ(storage->GetValueWithVersion("test_key", 1),
+ std::make_pair(std::string("test_value"), 1));
+
+ EXPECT_EQ(storage->GetValueWithVersion("test_key", 2),
+ std::make_pair(std::string("test_value_v2"), 2));
+
+ EXPECT_EQ(storage->GetValueWithVersion("test_key", 3),
+ std::make_pair(std::string("test_value_v2"), 2));
+}
+
+TEST_P(KVStorageTest, GetAllValueWithVersion) {
+ {
+ std::map<std::string, std::pair<std::string, int> > expected_list{
+ std::make_pair("test_key", std::make_pair("test_value", 1))};
+
+ EXPECT_EQ(storage->SetValueWithVersion("test_key", "test_value", 0), 0);
+ EXPECT_EQ(storage->GetAllItems(), expected_list);
+ }
+
+ {
+ std::map<std::string, std::pair<std::string, int> > expected_list{
+ std::make_pair("test_key", std::make_pair("test_value_v2", 2))};
+ EXPECT_EQ(storage->SetValueWithVersion("test_key", "test_value_v2", 1), 0);
+ EXPECT_EQ(storage->GetAllItems(), expected_list);
+ }
+
+ {
+ std::map<std::string, std::pair<std::string, int> > expected_list{
+ std::make_pair("test_key_v1", std::make_pair("test_value1", 1)),
+ std::make_pair("test_key", std::make_pair("test_value_v2", 2))};
+ EXPECT_EQ(storage->SetValueWithVersion("test_key_v1", "test_value1", 0), 0);
+ EXPECT_EQ(storage->GetAllItems(), expected_list);
+ }
+}
+
+TEST_P(KVStorageTest, GetKeyRange) {
+ EXPECT_EQ(storage->SetValueWithVersion("1", "value1", 0), 0);
+ EXPECT_EQ(storage->SetValueWithVersion("2", "value2", 0), 0);
+ EXPECT_EQ(storage->SetValueWithVersion("3", "value3", 0), 0);
+ EXPECT_EQ(storage->SetValueWithVersion("4", "value4", 0), 0);
+
+ {
+ std::map<std::string, std::pair<std::string, int> > expected_list{
+ std::make_pair("1", std::make_pair("value1", 1)),
+ std::make_pair("2", std::make_pair("value2", 1)),
+ std::make_pair("3", std::make_pair("value3", 1)),
+ std::make_pair("4", std::make_pair("value4", 1))};
+ EXPECT_EQ(storage->GetKeyRange("1", "4"), expected_list);
+ }
+
+ EXPECT_EQ(storage->SetValueWithVersion("3", "value3_1", 1), 0);
+ {
+ std::map<std::string, std::pair<std::string, int> > expected_list{
+ std::make_pair("1", std::make_pair("value1", 1)),
+ std::make_pair("2", std::make_pair("value2", 1)),
+ std::make_pair("3", std::make_pair("value3_1", 2)),
+ std::make_pair("4", std::make_pair("value4", 1))};
+ EXPECT_EQ(storage->GetKeyRange("1", "4"), expected_list);
+ }
+ {
+ std::map<std::string, std::pair<std::string, int> > expected_list{
+ std::make_pair("1", std::make_pair("value1", 1)),
+ std::make_pair("2", std::make_pair("value2", 1)),
+ std::make_pair("3", std::make_pair("value3_1", 2)),
+ };
+ EXPECT_EQ(storage->GetKeyRange("1", "3"), expected_list);
+ }
+ {
+ std::map<std::string, std::pair<std::string, int> > expected_list{
+ std::make_pair("2", std::make_pair("value2", 1)),
+ std::make_pair("3", std::make_pair("value3_1", 2)),
+ std::make_pair("4", std::make_pair("value4", 1))};
+ EXPECT_EQ(storage->GetKeyRange("2", "4"), expected_list);
+ }
+ {
+ std::map<std::string, std::pair<std::string, int> > expected_list{
+ std::make_pair("1", std::make_pair("value1", 1)),
+ std::make_pair("2", std::make_pair("value2", 1)),
+ std::make_pair("3", std::make_pair("value3_1", 2)),
+ std::make_pair("4", std::make_pair("value4", 1))};
+ EXPECT_EQ(storage->GetKeyRange("0", "5"), expected_list);
+ }
+ {
+ std::map<std::string, std::pair<std::string, int> > expected_list{
+ std::make_pair("2", std::make_pair("value2", 1)),
+ std::make_pair("3", std::make_pair("value3_1", 2)),
+ };
+ EXPECT_EQ(storage->GetKeyRange("2", "3"), expected_list);
+ }
+}
+
+TEST_P(KVStorageTest, GetHistory) {
+ {
+ std::vector<std::pair<std::string, int> > expected_list{};
+ EXPECT_EQ(storage->GetHistory("1", 1, 5), expected_list);
+ }
+ {
+ std::vector<std::pair<std::string, int> > expected_list{
+ std::make_pair("value3", 3), std::make_pair("value2", 2),
+ std::make_pair("value1", 1)};
+
+ EXPECT_EQ(storage->SetValueWithVersion("1", "value1", 0), 0);
+ EXPECT_EQ(storage->SetValueWithVersion("1", "value2", 1), 0);
+ EXPECT_EQ(storage->SetValueWithVersion("1", "value3", 2), 0);
+
+ EXPECT_EQ(storage->GetHistory("1", 1, 5), expected_list);
+ }
+
+ {
+ std::vector<std::pair<std::string, int> > expected_list{
+ std::make_pair("value5", 5), std::make_pair("value4", 4),
+ std::make_pair("value3", 3), std::make_pair("value2", 2),
+ std::make_pair("value1", 1)};
+
+ EXPECT_EQ(storage->SetValueWithVersion("1", "value4", 3), 0);
+ EXPECT_EQ(storage->SetValueWithVersion("1", "value5", 4), 0);
+ EXPECT_EQ(storage->SetValueWithVersion("1", "value6", 5), 0);
+ EXPECT_EQ(storage->SetValueWithVersion("1", "value7", 6), 0);
+
+ EXPECT_EQ(storage->GetHistory("1", 1, 5), expected_list);
+ }
+
+ {
+ std::vector<std::pair<std::string, int> > expected_list{
+ std::make_pair("value7", 7), std::make_pair("value6", 6)};
+
+ EXPECT_EQ(storage->GetTopHistory("1", 2), expected_list);
+ }
+}
+
+INSTANTIATE_TEST_CASE_P(KVStorageTest, KVStorageTest,
+ ::testing::Values(MEM, LEVELDB));
+
+} // namespace
+} // namespace storage
+} // namespace resdb
diff --git a/chain/storage/leveldb.cpp b/chain/storage/leveldb.cpp
new file mode 100644
index 00000000..2cc96fb5
--- /dev/null
+++ b/chain/storage/leveldb.cpp
@@ -0,0 +1,290 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "chain/storage/leveldb.h"
+
+#include <glog/logging.h>
+
+#include "chain/storage/proto/kv.pb.h"
+
+namespace resdb {
+namespace storage {
+
+std::unique_ptr<Storage> NewResLevelDB(const std::string& path,
+ std::optional<LevelDBInfo> config) {
+ if (config == std::nullopt) {
+ config = LevelDBInfo();
+ }
+ (*config).set_path(path);
+ return std::make_unique<ResLevelDB>(config);
+}
+
+std::unique_ptr<Storage> NewResLevelDB(std::optional<LevelDBInfo> config) {
+ return std::make_unique<ResLevelDB>(config);
+}
+
+ResLevelDB::ResLevelDB(std::optional<LevelDBInfo> config) {
+ std::string path = "/tmp/nexres-leveldb";
+ if (config.has_value()) {
+ write_buffer_size_ = (*config).write_buffer_size_mb() << 20;
+ write_batch_size_ = (*config).write_batch_size();
+ if (!(*config).path().empty()) {
+ LOG(ERROR) << "Custom path for ResLevelDB provided in config: "
+ << (*config).path();
+ path = (*config).path();
+ }
+ }
+ CreateDB(path);
+}
+
+void ResLevelDB::CreateDB(const std::string& path) {
+ LOG(ERROR) << "ResLevelDB Create DB: path:" << path
+ << " write buffer size:" << write_buffer_size_
+ << " batch size:" << write_batch_size_;
+ leveldb::Options options;
+ options.create_if_missing = true;
+ options.write_buffer_size = write_buffer_size_;
+
+ leveldb::DB* db = nullptr;
+ leveldb::Status status = leveldb::DB::Open(options, path, &db);
+ if (status.ok()) {
+ db_ = std::unique_ptr<leveldb::DB>(db);
+ }
+ assert(status.ok());
+ LOG(ERROR) << "Successfully opened LevelDB";
+}
+
+ResLevelDB::~ResLevelDB() {
+ if (db_) {
+ db_.reset();
+ }
+}
+
+int ResLevelDB::SetValue(const std::string& key, const std::string& value) {
+ batch_.Put(key, value);
+
+ if (batch_.ApproximateSize() >= write_batch_size_) {
+ leveldb::Status status = db_->Write(leveldb::WriteOptions(), &batch_);
+ if (status.ok()) {
+ batch_.Clear();
+ return 0;
+ } else {
+ LOG(ERROR) << "flush buffer fail:" << status.ToString();
+ return -1;
+ }
+ }
+ return 0;
+}
+
+std::string ResLevelDB::GetValue(const std::string& key) {
+ std::string value = "";
+ leveldb::Status status = db_->Get(leveldb::ReadOptions(), key, &value);
+ if (status.ok()) {
+ return value;
+ } else {
+ return "";
+ }
+}
+
+std::string ResLevelDB::GetAllValues(void) {
+ std::string values = "[";
+ leveldb::Iterator* it = db_->NewIterator(leveldb::ReadOptions());
+ bool first_iteration = true;
+ for (it->SeekToFirst(); it->Valid(); it->Next()) {
+ if (!first_iteration) values.append(",");
+ first_iteration = false;
+ values.append(it->value().ToString());
+ }
+ values.append("]");
+
+ delete it;
+ return values;
+}
+
+std::string ResLevelDB::GetRange(const std::string& min_key,
+ const std::string& max_key) {
+ std::string values = "[";
+ leveldb::Iterator* it = db_->NewIterator(leveldb::ReadOptions());
+ bool first_iteration = true;
+ for (it->Seek(min_key); it->Valid() && it->key().ToString() <= max_key;
+ it->Next()) {
+ if (!first_iteration) values.append(",");
+ first_iteration = false;
+ values.append(it->value().ToString());
+ }
+ values.append("]");
+
+ delete it;
+ return values;
+}
+
+bool ResLevelDB::Flush() {
+ leveldb::Status status = db_->Write(leveldb::WriteOptions(), &batch_);
+ if (status.ok()) {
+ batch_.Clear();
+ return true;
+ }
+ LOG(ERROR) << "flush buffer fail:" << status.ToString();
+ return false;
+}
+
+int ResLevelDB::SetValueWithVersion(const std::string& key,
+ const std::string& value, int version) {
+ std::string value_str = GetValue(key);
+ ValueHistory history;
+ if (!history.ParseFromString(value_str)) {
+ LOG(ERROR) << "old_value parse fail";
+ return -2;
+ }
+
+ int last_v = 0;
+ if (history.value_size() > 0) {
+ last_v = history.value(history.value_size() - 1).version();
+ }
+
+ if (last_v != version) {
+ LOG(ERROR) << "version does not match:" << version
+ << " old version:" << last_v;
+ return -2;
+ }
+
+ Value* new_value = history.add_value();
+ new_value->set_value(value);
+ new_value->set_version(version + 1);
+
+ history.SerializeToString(&value_str);
+ return SetValue(key, value_str);
+}
+
+std::pair<std::string, int> ResLevelDB::GetValueWithVersion(
+ const std::string& key, int version) {
+ std::string value_str = GetValue(key);
+ ValueHistory history;
+ if (!history.ParseFromString(value_str)) {
+ LOG(ERROR) << "old_value parse fail";
+ return std::make_pair("", 0);
+ }
+ if (history.value_size() == 0) {
+ return std::make_pair("", 0);
+ }
+ if (version > 0) {
+ for (int i = history.value_size() - 1; i >= 0; --i) {
+ if (history.value(i).version() == version) {
+ return std::make_pair(history.value(i).value(),
+ history.value(i).version());
+ }
+ if (history.value(i).version() < version) {
+ break;
+ }
+ }
+ }
+ int last_idx = history.value_size() - 1;
+ return std::make_pair(history.value(last_idx).value(),
+ history.value(last_idx).version());
+}
+
+// Return a map of <key, <value, version>>
+std::map<std::string, std::pair<std::string, int>> ResLevelDB::GetAllItems() {
+ std::map<std::string, std::pair<std::string, int>> resp;
+
+ leveldb::Iterator* it = db_->NewIterator(leveldb::ReadOptions());
+ for (it->SeekToFirst(); it->Valid(); it->Next()) {
+ ValueHistory history;
+ if (!history.ParseFromString(it->value().ToString()) ||
+ history.value_size() == 0) {
+ LOG(ERROR) << "old_value parse fail";
+ continue;
+ }
+ const Value& value = history.value(history.value_size() - 1);
+ resp.insert(std::make_pair(it->key().ToString(),
+ std::make_pair(value.value(), value.version())));
+ }
+ delete it;
+
+ return resp;
+}
+
+std::map<std::string, std::pair<std::string, int>> ResLevelDB::GetKeyRange(
+ const std::string& min_key, const std::string& max_key) {
+ std::map<std::string, std::pair<std::string, int>> resp;
+
+ leveldb::Iterator* it = db_->NewIterator(leveldb::ReadOptions());
+ for (it->Seek(min_key); it->Valid() && it->key().ToString() <= max_key;
+ it->Next()) {
+ ValueHistory history;
+ if (!history.ParseFromString(it->value().ToString()) ||
+ history.value_size() == 0) {
+ LOG(ERROR) << "old_value parse fail";
+ continue;
+ }
+ const Value& value = history.value(history.value_size() - 1);
+ resp.insert(std::make_pair(it->key().ToString(),
+ std::make_pair(value.value(), value.version())));
+ }
+ delete it;
+
+ return resp;
+}
+
+// Return a list of <value, version>
+std::vector<std::pair<std::string, int>> ResLevelDB::GetHistory(
+ const std::string& key, int min_version, int max_version) {
+ std::vector<std::pair<std::string, int>> resp;
+ std::string value_str = GetValue(key);
+ ValueHistory history;
+ if (!history.ParseFromString(value_str)) {
+ LOG(ERROR) << "old_value parse fail";
+ return resp;
+ }
+
+ for (int i = history.value_size() - 1; i >= 0; --i) {
+ if (history.value(i).version() < min_version) {
+ break;
+ }
+ if (history.value(i).version() <= max_version) {
+ resp.push_back(
+ std::make_pair(history.value(i).value(), history.value(i).version()));
+ }
+ }
+
+ return resp;
+}
+
+// Return a list of <value, version>
+std::vector<std::pair<std::string, int>> ResLevelDB::GetTopHistory(
+ const std::string& key, int top_number) {
+ std::vector<std::pair<std::string, int>> resp;
+ std::string value_str = GetValue(key);
+ ValueHistory history;
+ if (!history.ParseFromString(value_str)) {
+ LOG(ERROR) << "old_value parse fail";
+ return resp;
+ }
+
+ for (int i = history.value_size() - 1;
+ i >= 0 && resp.size() < static_cast<size_t>(top_number); --i) {
+ resp.push_back(
+ std::make_pair(history.value(i).value(), history.value(i).version()));
+ }
+
+ return resp;
+}
+
+} // namespace storage
+} // namespace resdb
diff --git a/chain/storage/leveldb.h b/chain/storage/leveldb.h
new file mode 100644
index 00000000..199f1f27
--- /dev/null
+++ b/chain/storage/leveldb.h
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <memory>
+#include <optional>
+#include <string>
+
+#include "chain/storage/proto/leveldb_config.pb.h"
+#include "chain/storage/storage.h"
+#include "leveldb/db.h"
+#include "leveldb/write_batch.h"
+
+namespace resdb {
+namespace storage {
+
+std::unique_ptr<Storage> NewResLevelDB(
+ const std::string& path, std::optional<LevelDBInfo> config = std::nullopt);
+std::unique_ptr<Storage> NewResLevelDB(
+ std::optional<LevelDBInfo> config = std::nullopt);
+
+class ResLevelDB : public Storage {
+ public:
+ ResLevelDB(std::optional<LevelDBInfo> config_data = std::nullopt);
+
+ virtual ~ResLevelDB();
+ int SetValue(const std::string& key, const std::string& value) override;
+ std::string GetValue(const std::string& key) override;
+ std::string GetAllValues(void) override;
+ std::string GetRange(const std::string& min_key,
+ const std::string& max_key) override;
+
+ int SetValueWithVersion(const std::string& key, const std::string& value,
+ int version) override;
+ std::pair<std::string, int> GetValueWithVersion(const std::string& key,
+ int version) override;
+
+ // Return a map of <key, <value, version>>
+ std::map<std::string, std::pair<std::string, int>> GetAllItems() override;
+ std::map<std::string, std::pair<std::string, int>> GetKeyRange(
+ const std::string& min_key, const std::string& max_key) override;
+
+ // Return a list of <value, version>
+ std::vector<std::pair<std::string, int>> GetHistory(const std::string& key,
+ int min_version,
+ int max_version) override;
+
+ std::vector<std::pair<std::string, int>> GetTopHistory(
+ const std::string& key, int top_number) override;
+
+ bool Flush() override;
+
+ private:
+ void CreateDB(const std::string& path);
+
+ private:
+ std::unique_ptr<leveldb::DB> db_ = nullptr;
+ ::leveldb::WriteBatch batch_;
+ unsigned int write_buffer_size_ = 64 << 20;
+ unsigned int write_batch_size_ = 1;
+};
+
+} // namespace storage
+} // namespace resdb
diff --git a/chain/storage/memory_db.cpp b/chain/storage/memory_db.cpp
new file mode 100644
index 00000000..2d5b8725
--- /dev/null
+++ b/chain/storage/memory_db.cpp
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "chain/storage/memory_db.h"
+
+#include <glog/logging.h>
+
+namespace resdb {
+namespace storage {
+
+std::unique_ptr<Storage> NewMemoryDB() { return std::make_unique<MemoryDB>(); }
+
+MemoryDB::MemoryDB() {}
+
+int MemoryDB::SetValue(const std::string& key, const std::string& value) {
+ kv_map_[key] = value;
+ return 0;
+}
+
+std::string MemoryDB::GetAllValues(void) {
+ std::string values = "[";
+ bool first_iteration = true;
+ for (auto kv : kv_map_) {
+ if (!first_iteration) values.append(",");
+ first_iteration = false;
+ values.append(kv.second);
+ }
+ values.append("]");
+ return values;
+}
+
+std::string MemoryDB::GetRange(const std::string& min_key,
+ const std::string& max_key) {
+ std::string values = "[";
+ bool first_iteration = true;
+ for (auto kv : kv_map_) {
+ if (kv.first >= min_key && kv.first <= max_key) {
+ if (!first_iteration) values.append(",");
+ first_iteration = false;
+ values.append(kv.second);
+ }
+ }
+ values.append("]");
+ return values;
+}
+
+std::string MemoryDB::GetValue(const std::string& key) {
+ auto search = kv_map_.find(key);
+ if (search != kv_map_.end())
+ return search->second;
+ else {
+ return "";
+ }
+}
+
+int MemoryDB::SetValueWithVersion(const std::string& key,
+ const std::string& value, int version) {
+ auto it = kv_map_with_v_.find(key);
+ if ((it == kv_map_with_v_.end() && version != 0) ||
+ (it != kv_map_with_v_.end() && it->second.back().second != version)) {
+ LOG(ERROR) << " value version not match. key:" << key << " db version:"
+ << (it == kv_map_with_v_.end() ? 0 : it->second.back().second)
+ << " user version:" << version;
+ return -2;
+ }
+ kv_map_with_v_[key].push_back(std::make_pair(value, version + 1));
+ return 0;
+}
+
+std::pair<std::string, int> MemoryDB::GetValueWithVersion(
+ const std::string& key, int version) {
+ auto search_it = kv_map_with_v_.find(key);
+ if (search_it != kv_map_with_v_.end() && search_it->second.size()) {
+ auto it = search_it->second.end();
+ do {
+ --it;
+ if (it->second == version) {
+ return *it;
+ }
+ if (it->second < version) {
+ break;
+ }
+ } while (it != search_it->second.begin());
+ it = --search_it->second.end();
+ LOG(ERROR) << " key:" << key << " no version:" << version
+ << " return max:" << it->second;
+ return *it;
+ }
+ return std::make_pair("", 0);
+}
+
+std::map<std::string, std::pair<std::string, int>> MemoryDB::GetAllItems() {
+ std::map<std::string, std::pair<std::string, int>> resp;
+
+ for (const auto& it : kv_map_with_v_) {
+ resp.insert(std::make_pair(it.first, it.second.back()));
+ }
+ return resp;
+}
+
+std::map<std::string, std::pair<std::string, int>> MemoryDB::GetKeyRange(
+ const std::string& min_key, const std::string& max_key) {
+ LOG(ERROR) << "min key:" << min_key << " max key:" << max_key;
+ std::map<std::string, std::pair<std::string, int>> resp;
+ for (const auto& it : kv_map_with_v_) {
+ if (it.first >= min_key && it.first <= max_key) {
+ resp.insert(std::make_pair(it.first, it.second.back()));
+ }
+ }
+ return resp;
+}
+
+std::vector<std::pair<std::string, int>> MemoryDB::GetHistory(
+ const std::string& key, int min_version, int max_version) {
+ std::vector<std::pair<std::string, int>> resp;
+ auto search_it = kv_map_with_v_.find(key);
+ if (search_it == kv_map_with_v_.end()) {
+ return resp;
+ }
+
+ auto it = search_it->second.end();
+ do {
+ --it;
+ if (it->second < min_version) {
+ break;
+ }
+ if (it->second <= max_version) {
+ resp.push_back(*it);
+ }
+ } while (it != search_it->second.begin());
+ return resp;
+}
+
+std::vector<std::pair<std::string, int>> MemoryDB::GetTopHistory(
+ const std::string& key, int top_number) {
+ std::vector<std::pair<std::string, int>> resp;
+ auto search_it = kv_map_with_v_.find(key);
+ if (search_it == kv_map_with_v_.end()) {
+ return resp;
+ }
+
+ auto it = search_it->second.end();
+ do {
+ --it;
+ resp.push_back(*it);
+ if (resp.size() >= static_cast<size_t>(top_number)) {
+ break;
+ }
+ } while (it != search_it->second.begin());
+ return resp;
+}
+
+} // namespace storage
+} // namespace resdb
diff --git a/chain/storage/memory_db.h b/chain/storage/memory_db.h
new file mode 100644
index 00000000..372f4647
--- /dev/null
+++ b/chain/storage/memory_db.h
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+#include <list>
+#include <map>
+#include <memory>
+#include <unordered_map>
+
+#include "chain/storage/storage.h"
+
+namespace resdb {
+namespace storage {
+
+// Key Value Storage supporting two types of interfaces:
+// Non-version:
+// It provides set and get function to set a value to a specific key
+// Values will be set directly.
+// Version:
+// It provides set and get function to set a value to a specific key
+// with a version.
+// The version inside setting function is to support OCC verification.
+// The version value should be obtained before setting
+// and returned back when setting a new value. If the version is not
+// the same as the old one, return failure.
+// If the value of a specific version does not exist or providing
+// version 0 as parameter when accessing get
+// it returns the current value along its version.
+//
+// Note: Only one type of interface are allowed to be used.
+//
+
+std::unique_ptr<Storage> NewMemoryDB();
+
+class MemoryDB : public Storage {
+ public:
+ MemoryDB();
+
+ int SetValue(const std::string& key, const std::string& value);
+ std::string GetValue(const std::string& key);
+
+ std::string GetAllValues() override;
+ std::string GetRange(const std::string& min_key,
+ const std::string& max_key) override;
+
+ int SetValueWithVersion(const std::string& key, const std::string& value,
+ int version) override;
+ std::pair<std::string, int> GetValueWithVersion(const std::string& key,
+ int version) override;
+
+ // Return a map of <key, <value, version>>
+ std::map<std::string, std::pair<std::string, int>> GetAllItems() override;
+ std::map<std::string, std::pair<std::string, int>> GetKeyRange(
+ const std::string& min_key, const std::string& max_key) override;
+
+ // Return a list of <value, version>
+ std::vector<std::pair<std::string, int>> GetHistory(const std::string& key,
+ int min_version,
+ int max_version) override;
+
+ std::vector<std::pair<std::string, int>> GetTopHistory(const std::string& key,
+ int number) override;
+
+ private:
+ std::unordered_map<std::string, std::string> kv_map_;
+ std::unordered_map<std::string, std::list<std::pair<std::string, int>>>
+ kv_map_with_v_;
+};
+
+} // namespace storage
+} // namespace resdb
diff --git a/chain/storage/mock_storage.h b/chain/storage/mock_storage.h
index 7aac187b..963d92bb 100644
--- a/chain/storage/mock_storage.h
+++ b/chain/storage/mock_storage.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
@@ -38,6 +32,24 @@ class MockStorage : public Storage {
MOCK_METHOD(std::string, GetAllValues, (), (override));
MOCK_METHOD(std::string, GetRange, (const std::string&, const std::string&),
(override));
+
+ MOCK_METHOD(int, SetValueWithVersion,
+ (const std::string& key, const std::string& value, int version),
+ (override));
+
+ using ValueType = std::pair<std::string, int>;
+ using ItemsType = std::map<std::string, ValueType>;
+ using ValuesType = std::vector<ValueType>;
+
+ MOCK_METHOD(ValueType, GetValueWithVersion,
+ (const std::string& key, int version), (override));
+ MOCK_METHOD(ItemsType, GetAllItems, (), (override));
+ MOCK_METHOD(ItemsType, GetKeyRange, (const std::string&, const std::string&),
+ (override));
+ MOCK_METHOD(ValuesType, GetHistory, (const std::string&, int, int),
+ (override));
+ MOCK_METHOD(ValuesType, GetTopHistory, (const std::string&, int), (override));
+
MOCK_METHOD(bool, Flush, (), (override));
};
diff --git a/chain/storage/proto/BUILD b/chain/storage/proto/BUILD
new file mode 100644
index 00000000..0b1c7263
--- /dev/null
+++ b/chain/storage/proto/BUILD
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+package(default_visibility = ["//visibility:public"])
+
+load("@rules_cc//cc:defs.bzl", "cc_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
+
+proto_library(
+ name = "kv_proto",
+ srcs = ["kv.proto"],
+ visibility = ["//chain/storage:__subpackages__"],
+)
+
+cc_proto_library(
+ name = "kv_cc_proto",
+ visibility = ["//chain/storage:__subpackages__"],
+ deps = [":kv_proto"],
+)
+
+proto_library(
+ name = "leveldb_config_proto",
+ srcs = ["leveldb_config.proto"],
+)
+
+cc_proto_library(
+ name = "leveldb_config_cc_proto",
+ deps = [":leveldb_config_proto"],
+)
diff --git a/chain/storage/proto/kv.proto b/chain/storage/proto/kv.proto
new file mode 100644
index 00000000..8466b8dc
--- /dev/null
+++ b/chain/storage/proto/kv.proto
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+syntax = "proto3";
+
+package resdb.storage;
+
+message Value {
+ bytes value = 1;
+ int32 version = 2;
+}
+
+message ValueHistory {
+ repeated Value value = 1;
+}
+
diff --git a/chain/storage/proto/leveldb_config.proto b/chain/storage/proto/leveldb_config.proto
new file mode 100644
index 00000000..d8be2519
--- /dev/null
+++ b/chain/storage/proto/leveldb_config.proto
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+syntax = "proto3";
+
+package resdb.storage;
+
+message LevelDBInfo {
+ uint32 write_buffer_size_mb = 2;
+ uint32 write_batch_size = 3;
+ string path = 4;
+}
diff --git a/chain/storage/res_leveldb.cpp b/chain/storage/res_leveldb.cpp
deleted file mode 100644
index 0cd48cca..00000000
--- a/chain/storage/res_leveldb.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-#include "chain/storage/res_leveldb.h"
-
-#include <glog/logging.h>
-
-namespace resdb {
-
-std::unique_ptr<Storage> NewResLevelDB(const char* cert_file,
- resdb::ResConfigData config_data) {
- return std::make_unique<ResLevelDB>(cert_file, config_data);
-}
-
-ResLevelDB::ResLevelDB(const char* cert_file,
- std::optional<ResConfigData> config_data) {
- std::string directory_id = "";
-
- std::string path = "/tmp/nexres-leveldb";
- if (cert_file == NULL) {
- LOG(ERROR) << "No cert file provided";
- } else {
- LOG(ERROR) << "Cert file: " << cert_file;
- std::string str(cert_file);
-
- for (int i = 0; i < (int)str.size(); i++) {
- if (str[i] >= '0' && str[i] <= '9') {
- directory_id += std::string(1, cert_file[i]);
- }
- }
-
- if (directory_id == "") {
- directory_id = "0";
- }
- }
-
- if (config_data.has_value()) {
- LevelDBInfo config = (*config_data).leveldb_info();
- write_buffer_size_ = config.write_buffer_size_mb() << 20;
- write_batch_size_ = config.write_batch_size();
- if (config.path() != "") {
- LOG(ERROR) << "Custom path for ResLevelDB provided in config: "
- << config.path();
- path = config.path();
- }
- if (config.generate_unique_pathnames()) {
- LOG(ERROR) << "Adding number to generate unique pathname: "
- << directory_id;
- path += directory_id;
- }
- }
- CreateDB(path);
-}
-
-void ResLevelDB::CreateDB(const std::string& path) {
- LOG(ERROR) << "ResLevelDB Create DB: path:" << path
- << " write buffer size:" << write_buffer_size_
- << " batch size:" << write_batch_size_;
- leveldb::Options options;
- options.create_if_missing = true;
- options.write_buffer_size = write_buffer_size_;
-
- leveldb::DB* db = nullptr;
- leveldb::Status status = leveldb::DB::Open(options, path, &db);
- if (status.ok()) {
- db_ = std::unique_ptr<leveldb::DB>(db);
- }
- assert(status.ok());
- LOG(ERROR) << "Successfully opened LevelDB";
-}
-
-ResLevelDB::~ResLevelDB() {
- if (db_) {
- db_.reset();
- }
-}
-
-int ResLevelDB::SetValue(const std::string& key, const std::string& value) {
- batch_.Put(key, value);
-
- if (batch_.ApproximateSize() >= write_batch_size_) {
- leveldb::Status status = db_->Write(leveldb::WriteOptions(), &batch_);
- if (status.ok()) {
- batch_.Clear();
- return 0;
- } else {
- LOG(ERROR) << "flush buffer fail:" << status.ToString();
- return -1;
- }
- }
- return 0;
-}
-
-std::string ResLevelDB::GetValue(const std::string& key) {
- std::string value = "";
- leveldb::Status status = db_->Get(leveldb::ReadOptions(), key, &value);
- if (status.ok()) {
- return value;
- } else {
- LOG(ERROR) << "get value fail:" << status.ToString();
- return "";
- }
-}
-
-std::string ResLevelDB::GetAllValues(void) {
- std::string values = "[";
- leveldb::Iterator* it = db_->NewIterator(leveldb::ReadOptions());
- bool first_iteration = true;
- for (it->SeekToFirst(); it->Valid(); it->Next()) {
- if (!first_iteration) values.append(",");
- first_iteration = false;
- values.append(it->value().ToString());
- }
- values.append("]");
-
- delete it;
- return values;
-}
-
-std::string ResLevelDB::GetRange(const std::string& min_key,
- const std::string& max_key) {
- std::string values = "[";
- leveldb::Iterator* it = db_->NewIterator(leveldb::ReadOptions());
- bool first_iteration = true;
- for (it->Seek(min_key); it->Valid() && it->key().ToString() <= max_key;
- it->Next()) {
- if (!first_iteration) values.append(",");
- first_iteration = false;
- values.append(it->value().ToString());
- }
- values.append("]");
-
- delete it;
- return values;
-}
-
-bool ResLevelDB::Flush() {
- leveldb::Status status = db_->Write(leveldb::WriteOptions(), &batch_);
- if (status.ok()) {
- batch_.Clear();
- return true;
- }
- LOG(ERROR) << "flush buffer fail:" << status.ToString();
- return false;
-}
-
-} // namespace resdb
diff --git a/chain/storage/res_leveldb.h b/chain/storage/res_leveldb.h
deleted file mode 100644
index f2c52631..00000000
--- a/chain/storage/res_leveldb.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-#pragma once
-
-#include <memory>
-#include <optional>
-#include <string>
-
-#include "chain/storage/storage.h"
-#include "leveldb/db.h"
-#include "leveldb/write_batch.h"
-#include "platform/proto/replica_info.pb.h"
-
-namespace resdb {
-
-std::unique_ptr<Storage> NewResLevelDB(const char* cert_file,
- resdb::ResConfigData config_data);
-
-class ResLevelDB : public Storage {
- public:
- ResLevelDB(const char* cert_file, std::optional<ResConfigData> config_data);
-
- virtual ~ResLevelDB();
- int SetValue(const std::string& key, const std::string& value) override;
- std::string GetValue(const std::string& key) override;
- std::string GetAllValues(void) override;
- std::string GetRange(const std::string& min_key,
- const std::string& max_key) override;
-
- bool Flush() override;
-
- private:
- void CreateDB(const std::string& path);
-
- private:
- std::unique_ptr<leveldb::DB> db_ = nullptr;
- ::leveldb::WriteBatch batch_;
- unsigned int write_buffer_size_ = 64 << 20;
- unsigned int write_batch_size_ = 1;
-};
-
-} // namespace resdb
diff --git a/chain/storage/res_leveldb_test.cpp b/chain/storage/res_leveldb_test.cpp
deleted file mode 100644
index 17deddff..00000000
--- a/chain/storage/res_leveldb_test.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-#include "chain/storage/res_leveldb.h"
-
-#include <glog/logging.h>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-#include <filesystem>
-
-namespace resdb {
-
-namespace {
-
-using ::testing::Test;
-
-class ResLevelDBDurableTest : public Test {
- public:
- ResLevelDBDurableTest() { Reset(); }
- ~ResLevelDBDurableTest() {}
- int Set(const std::string& key, const std::string& value) {
- resdb::ResConfigData config_data;
- config_data.mutable_leveldb_info()->set_path(path_);
- return NewResLevelDB(NULL, config_data)->SetValue(key, value);
- }
-
- std::string Get(const std::string& key) {
- resdb::ResConfigData config_data;
- config_data.mutable_leveldb_info()->set_path(path_);
- return NewResLevelDB(NULL, config_data)->GetValue(key);
- }
-
- std::string GetAllValues() {
- resdb::ResConfigData config_data;
- config_data.mutable_leveldb_info()->set_path(path_);
- return NewResLevelDB(NULL, config_data)->GetAllValues();
- }
-
- std::string GetRange(const std::string& min_key, const std::string& max_key) {
- resdb::ResConfigData config_data;
- config_data.mutable_leveldb_info()->set_path(path_);
- return NewResLevelDB(NULL, config_data)->GetRange(min_key, max_key);
- }
-
- void Reset() { std::filesystem::remove_all(path_.c_str()); }
-
- private:
- std::string path_ = "/tmp/leveldb_test";
-};
-
-TEST_F(ResLevelDBDurableTest, GetEmptyValue) {
- EXPECT_EQ(Get("empty_key"), "");
-}
-
-TEST_F(ResLevelDBDurableTest, SetValue) {
- EXPECT_EQ(Set("test_key", "test_value"), 0);
-}
-
-TEST_F(ResLevelDBDurableTest, GetValue) {
- EXPECT_EQ(Set("test_key", "test_value"), 0);
- EXPECT_EQ(Get("test_key"), "test_value");
-}
-
-TEST_F(ResLevelDBDurableTest, SetNewValue) {
- EXPECT_EQ(Set("test_key", "new_value"), 0);
-}
-
-TEST_F(ResLevelDBDurableTest, GetNewValue) { EXPECT_EQ(Get("test_key"), ""); }
-
-TEST_F(ResLevelDBDurableTest, GetAllValues) {
- EXPECT_EQ(Set("a", "a"), 0);
- EXPECT_EQ(Set("b", "b"), 0);
- EXPECT_EQ(Set("c", "c"), 0);
- EXPECT_EQ(GetAllValues(), "[a,b,c]");
-}
-
-TEST_F(ResLevelDBDurableTest, GetRange) {
- EXPECT_EQ(Set("key1", "value1"), 0);
- EXPECT_EQ(Set("key2", "value2"), 0);
- EXPECT_EQ(Set("key3", "value3"), 0);
- EXPECT_EQ(GetRange("key1", "key3"), "[value1,value2,value3]");
- EXPECT_EQ(GetRange("key1", "key2"), "[value1,value2]");
- EXPECT_EQ(GetRange("key4", "key5"), "[]");
-}
-
-} // namespace
-
-} // namespace resdb
diff --git a/chain/storage/res_rocksdb.cpp b/chain/storage/res_rocksdb.cpp
deleted file mode 100644
index 2655aca2..00000000
--- a/chain/storage/res_rocksdb.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-#include "chain/storage/res_rocksdb.h"
-
-#include <assert.h>
-#include <glog/logging.h>
-
-namespace resdb {
-
-std::unique_ptr<Storage> NewResRocksDB(
- const char* cert_file, std::optional<resdb::ResConfigData> config_data) {
- return std::make_unique<ResRocksDB>(cert_file, config_data);
-}
-
-ResRocksDB::ResRocksDB(const char* cert_file,
- std::optional<ResConfigData> config_data) {
- std::string directory_id = "";
-
- std::string path = "/tmp/nexres-rocksdb";
- LOG(ERROR) << "Default database path: " << path;
-
- if (cert_file == NULL) {
- LOG(ERROR) << "No cert file provided";
- } else {
- LOG(ERROR) << "Cert file: " << cert_file;
- std::string str(cert_file);
-
- for (int i = 0; i < (int)str.size(); i++) {
- if (str[i] >= '0' && str[i] <= '9') {
- directory_id += std::string(1, cert_file[i]);
- }
- }
-
- if (directory_id == "") {
- directory_id = "0";
- }
- }
-
- if (config_data.has_value()) {
- RocksDBInfo config = (*config_data).rocksdb_info();
- num_threads_ = config.num_threads();
- write_buffer_size_ = config.write_buffer_size_mb() << 20;
- write_batch_size_ = config.write_batch_size();
- if (config.path() != "") {
- LOG(ERROR) << "Custom path for RocksDB provided in config: "
- << config.path();
- path = config.path();
- }
- if (config.generate_unique_pathnames()) {
- LOG(ERROR) << "Adding number to generate unique pathname: "
- << directory_id;
- path += directory_id;
- }
- }
- LOG(ERROR) << "RocksDB Settings: " << num_threads_ << " "
- << write_buffer_size_ << " " << write_batch_size_;
-
- rocksdb::Options options;
- options.create_if_missing = true;
- if (num_threads_ > 1) options.IncreaseParallelism(num_threads_);
- options.OptimizeLevelStyleCompaction();
- options.write_buffer_size = write_buffer_size_;
-
- rocksdb::DB* db = nullptr;
- rocksdb::Status status = rocksdb::DB::Open(options, path, &db);
- if (status.ok()) {
- db_ = std::unique_ptr<rocksdb::DB>(db);
- LOG(ERROR) << "Successfully opened RocksDB in path: " << path;
- } else {
- LOG(ERROR) << "RocksDB status fail";
- }
- assert(status.ok());
-}
-
-ResRocksDB::~ResRocksDB() {
- if (db_) {
- db_.reset();
- }
-}
-
-int ResRocksDB::SetValue(const std::string& key, const std::string& value) {
- batch_.Put(key, value);
-
- if (batch_.Count() >= write_batch_size_) {
- rocksdb::Status status = db_->Write(rocksdb::WriteOptions(), &batch_);
- if (status.ok()) {
- batch_.Clear();
- } else {
- LOG(ERROR) << "write value fail:" << status.ToString();
- return -1;
- }
- }
- return 0;
-}
-
-std::string ResRocksDB::GetValue(const std::string& key) {
- std::string value = "";
- rocksdb::Status status = db_->Get(rocksdb::ReadOptions(), key, &value);
- if (status.ok()) {
- return value;
- } else {
- return "";
- }
-}
-
-std::string ResRocksDB::GetAllValues(void) {
- std::string values = "[";
- rocksdb::Iterator* itr = db_->NewIterator(rocksdb::ReadOptions());
- bool first_iteration = true;
- for (itr->SeekToFirst(); itr->Valid(); itr->Next()) {
- if (!first_iteration) values.append(",");
- first_iteration = false;
- values.append(itr->value().ToString());
- }
- values.append("]");
-
- delete itr;
- return values;
-}
-
-std::string ResRocksDB::GetRange(const std::string& min_key,
- const std::string& max_key) {
- std::string values = "[";
- rocksdb::Iterator* itr = db_->NewIterator(rocksdb::ReadOptions());
- bool first_iteration = true;
- for (itr->Seek(min_key); itr->Valid() && itr->key().ToString() <= max_key;
- itr->Next()) {
- if (!first_iteration) values.append(",");
- first_iteration = false;
- values.append(itr->value().ToString());
- }
- values.append("]");
-
- delete itr;
- return values;
-}
-
-bool ResRocksDB::Flush() {
- rocksdb::Status status = db_->Write(rocksdb::WriteOptions(), &batch_);
- if (status.ok()) {
- batch_.Clear();
- return true;
- }
- LOG(ERROR) << "write value fail:" << status.ToString();
- return false;
-}
-
-} // namespace resdb
diff --git a/chain/storage/res_rocksdb.h b/chain/storage/res_rocksdb.h
deleted file mode 100644
index 706957c2..00000000
--- a/chain/storage/res_rocksdb.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-#pragma once
-
-#include <optional>
-#include <string>
-
-#include "chain/storage/storage.h"
-#include "platform/proto/replica_info.pb.h"
-#include "rocksdb/db.h"
-#include "rocksdb/write_batch.h"
-
-namespace resdb {
-
-std::unique_ptr<Storage> NewResRocksDB(
- const char* cert_file, std::optional<resdb::ResConfigData> config_data);
-
-class ResRocksDB : public Storage {
- public:
- ResRocksDB(const char* cert_file, std::optional<ResConfigData> config_data);
- virtual ~ResRocksDB();
- int SetValue(const std::string& key, const std::string& value) override;
- std::string GetValue(const std::string& key) override;
- std::string GetAllValues(void) override;
- std::string GetRange(const std::string& min_key,
- const std::string& max_key) override;
-
- bool Flush() override;
-
- private:
- std::unique_ptr<rocksdb::DB> db_ = nullptr;
- rocksdb::WriteBatch batch_;
- unsigned int num_threads_ = 1;
- unsigned int write_buffer_size_ = 64 << 20;
- unsigned int write_batch_size_ = 1;
-};
-
-} // namespace resdb
diff --git a/chain/storage/res_rocksdb_test.cpp b/chain/storage/res_rocksdb_test.cpp
deleted file mode 100644
index 5c17f8b7..00000000
--- a/chain/storage/res_rocksdb_test.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-#include "storage/res_rocksdb.h"
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-#include <filesystem>
-
-namespace resdb {
-namespace {
-
-using ::testing::Test;
-
-class RocksDBDurableTest : public Test {
- public:
- RocksDBDurableTest() { Reset(); }
-
- int Set(const std::string& key, const std::string& value) {
- ResConfigData config_data;
- config_data.mutable_rocksdb_info()->set_path(path_);
- return NewResRocksDB(NULL, config_data)->SetValue(key, value);
- }
-
- std::string Get(const std::string& key) {
- ResConfigData config_data;
- config_data.mutable_rocksdb_info()->set_path(path_);
- return NewResRocksDB(NULL, config_data)->GetValue(key);
- }
-
- std::string GetAllValues() {
- ResConfigData config_data;
- config_data.mutable_rocksdb_info()->set_path(path_);
- return NewResRocksDB(NULL, config_data)->GetAllValues();
- }
-
- std::string GetRange(const std::string& min_key, const std::string& max_key) {
- ResConfigData config_data;
- config_data.mutable_rocksdb_info()->set_path(path_);
- return NewResRocksDB(NULL, config_data)->GetRange(min_key, max_key);
- }
-
- void Reset() { std::filesystem::remove_all(path_.c_str()); }
-
- private:
- std::string path_ = "/tmp/rocksdb_test";
-};
-
-TEST_F(RocksDBDurableTest, GetEmptyValue) { EXPECT_EQ(Get("empty_key"), ""); }
-
-TEST_F(RocksDBDurableTest, SetValue) {
- EXPECT_EQ(Set("test_key", "test_value"), 0);
-}
-
-TEST_F(RocksDBDurableTest, GetValue) {
- EXPECT_EQ(Set("test_key", "test_value"), 0);
- EXPECT_EQ(Get("test_key"), "test_value");
-}
-
-TEST_F(RocksDBDurableTest, SetNewValue) {
- EXPECT_EQ(Set("test_key", "new_value"), 0);
-}
-
-TEST_F(RocksDBDurableTest, GetNewValue) {
- EXPECT_EQ(Set("test_key", "new_value1"), 0);
- EXPECT_EQ(Get("test_key"), "new_value1");
-}
-
-TEST_F(RocksDBDurableTest, GetAllValues) {
- EXPECT_EQ(Set("a", "a"), 0);
- EXPECT_EQ(Set("b", "b"), 0);
- EXPECT_EQ(Set("c", "c"), 0);
- EXPECT_EQ(GetAllValues(), "[a,b,c]");
-}
-
-TEST_F(RocksDBDurableTest, GetRange) {
- EXPECT_EQ(Set("key1", "value1"), 0);
- EXPECT_EQ(Set("key2", "value2"), 0);
- EXPECT_EQ(Set("key3", "value3"), 0);
- EXPECT_EQ(GetRange("key1", "key3"), "[value1,value2,value3]");
- EXPECT_EQ(GetRange("key1", "key2"), "[value1,value2]");
- EXPECT_EQ(GetRange("key4", "key5"), "[]");
-}
-
-} // namespace
-} // namespace resdb
diff --git a/chain/storage/setting/BUILD b/chain/storage/setting/BUILD
new file mode 100644
index 00000000..25d11b4e
--- /dev/null
+++ b/chain/storage/setting/BUILD
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+package(default_visibility = ["//visibility:public"])
+
+load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
+
+bool_flag(
+ name = "enable_leveldb",
+ build_setting_default = False,
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "enable_leveldb_setting",
+ values = {
+ "define": "enable_leveldb=True",
+ },
+ visibility = ["//visibility:public"],
+)
diff --git a/chain/storage/storage.h b/chain/storage/storage.h
index 3ab09568..76e352de 100644
--- a/chain/storage/storage.h
+++ b/chain/storage/storage.h
@@ -1,31 +1,27 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
+#include <map>
#include <string>
+#include <vector>
namespace resdb {
@@ -34,22 +30,31 @@ class Storage {
Storage() = default;
virtual ~Storage() = default;
- // Set value by key
- // Return >=0 if success.
virtual int SetValue(const std::string& key, const std::string& value) = 0;
-
- // Get value by key
virtual std::string GetValue(const std::string& key) = 0;
-
- // Get all values in db
virtual std::string GetAllValues() = 0;
-
- // Get values on a range of keys
virtual std::string GetRange(const std::string& min_key,
const std::string& max_key) = 0;
- // Flush data to disk
- virtual bool Flush() = 0;
+ virtual int SetValueWithVersion(const std::string& key,
+ const std::string& value, int version) = 0;
+ virtual std::pair<std::string, int> GetValueWithVersion(
+ const std::string& key, int version) = 0;
+
+ // Return a map of <key, <value, version>>
+ virtual std::map<std::string, std::pair<std::string, int>> GetAllItems() = 0;
+ virtual std::map<std::string, std::pair<std::string, int>> GetKeyRange(
+ const std::string& min_key, const std::string& max_key) = 0;
+
+ // Return a list of <value, version> from a key
+ // The version list is sorted by the version value in descending order
+ virtual std::vector<std::pair<std::string, int>> GetHistory(
+ const std::string& key, int min_version, int max_version) = 0;
+
+ virtual std::vector<std::pair<std::string, int>> GetTopHistory(
+ const std::string& key, int number) = 0;
+
+ virtual bool Flush() { return true; };
};
} // namespace resdb
diff --git a/chain/storage/txn_memory_db.cpp b/chain/storage/txn_memory_db.cpp
deleted file mode 100644
index f16445c0..00000000
--- a/chain/storage/txn_memory_db.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-#include "chain/storage/txn_memory_db.h"
-
-#include <glog/logging.h>
-
-namespace resdb {
-
-TxnMemoryDB::TxnMemoryDB() : max_seq_(0) {}
-
-Request* TxnMemoryDB::Get(uint64_t seq) {
- std::unique_lock<std::mutex> lk(mutex_);
- if (data_.find(seq) == data_.end()) {
- return nullptr;
- }
- return data_[seq].get();
-}
-
-void TxnMemoryDB::Put(std::unique_ptr<Request> request) {
- std::unique_lock<std::mutex> lk(mutex_);
- max_seq_ = request->seq();
- data_[max_seq_] = std::move(request);
-}
-
-uint64_t TxnMemoryDB::GetMaxSeq() { return max_seq_; }
-
-} // namespace resdb
diff --git a/chain/storage/txn_memory_db.h b/chain/storage/txn_memory_db.h
deleted file mode 100644
index de69d70c..00000000
--- a/chain/storage/txn_memory_db.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-#pragma once
-
-#include <map>
-#include <unordered_map>
-
-#include "platform/proto/resdb.pb.h"
-
-namespace resdb {
-
-class TxnMemoryDB {
- public:
- TxnMemoryDB();
- Request* Get(uint64_t seq);
- void Put(std::unique_ptr<Request> request);
- uint64_t GetMaxSeq();
-
- private:
- std::mutex mutex_;
- std::unordered_map<uint64_t, std::unique_ptr<Request> > data_;
- std::atomic<uint64_t> max_seq_;
-};
-
-} // namespace resdb
diff --git a/chain/storage/txn_memory_db_test.cpp b/chain/storage/txn_memory_db_test.cpp
deleted file mode 100644
index 1ff726dc..00000000
--- a/chain/storage/txn_memory_db_test.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-#include "database/txn_memory_db.h"
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-#include "common/test/test_macros.h"
-
-namespace resdb {
-namespace {
-
-using ::resdb::testing::EqualsProto;
-using ::testing::Pointee;
-
-TEST(TxnMemoryDBTest, GetEmptyValue) {
- TxnMemoryDB db;
- EXPECT_EQ(db.Get(1), nullptr);
-}
-
-TEST(TxnMemoryDBTest, GetValue) {
- Request request;
- request.set_seq(1);
- request.set_data("test");
-
- TxnMemoryDB db;
- db.Put(std::make_unique<Request>(request));
- EXPECT_THAT(db.Get(1), Pointee(EqualsProto(request)));
-}
-
-TEST(TxnMemoryDBTest, GetSecondValue) {
- Request request;
- request.set_seq(1);
- request.set_data("test");
-
- TxnMemoryDB db;
- db.Put(std::make_unique<Request>(request));
-
- request.set_seq(1);
- request.set_data("test_1");
- db.Put(std::make_unique<Request>(request));
-
- EXPECT_THAT(db.Get(1), Pointee(EqualsProto(request)));
-}
-
-} // namespace
-
-} // namespace resdb
diff --git a/common/BUILD b/common/BUILD
index 62d32413..c5982dd1 100644
--- a/common/BUILD
+++ b/common/BUILD
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
cc_library(
@@ -15,6 +33,13 @@ cc_library(
],
)
+cc_library(
+ name = "beast",
+ deps = [
+ "@boost//:beast",
+ ],
+)
+
cc_library(
name = "boost_lockfree",
deps = [
diff --git a/common/crypto/BUILD b/common/crypto/BUILD
index 1b7dbebe..e5596903 100644
--- a/common/crypto/BUILD
+++ b/common/crypto/BUILD
@@ -1,3 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
cc_library(
diff --git a/common/crypto/hash.cpp b/common/crypto/hash.cpp
index 8173109d..b96a2b81 100644
--- a/common/crypto/hash.cpp
+++ b/common/crypto/hash.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "common/crypto/hash.h"
diff --git a/common/crypto/hash.h b/common/crypto/hash.h
index 10d028cb..5136bfd5 100644
--- a/common/crypto/hash.h
+++ b/common/crypto/hash.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/common/crypto/hash_test.cpp b/common/crypto/hash_test.cpp
index 258d4a64..8cb32022 100644
--- a/common/crypto/hash_test.cpp
+++ b/common/crypto/hash_test.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "common/crypto/hash.h"
diff --git a/common/crypto/key_generator.cpp b/common/crypto/key_generator.cpp
index 89ec6971..5a60923f 100644
--- a/common/crypto/key_generator.cpp
+++ b/common/crypto/key_generator.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "common/crypto/key_generator.h"
diff --git a/common/crypto/key_generator.h b/common/crypto/key_generator.h
index 846039ff..fcbe0f59 100644
--- a/common/crypto/key_generator.h
+++ b/common/crypto/key_generator.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/common/crypto/mock_signature_verifier.h b/common/crypto/mock_signature_verifier.h
index 1bf88628..e22d3586 100644
--- a/common/crypto/mock_signature_verifier.h
+++ b/common/crypto/mock_signature_verifier.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/common/crypto/signature_utils.cpp b/common/crypto/signature_utils.cpp
index e86f99b1..4df11022 100644
--- a/common/crypto/signature_utils.cpp
+++ b/common/crypto/signature_utils.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "common/crypto/signature_utils.h"
diff --git a/common/crypto/signature_utils.h b/common/crypto/signature_utils.h
index 18415eaa..927cbbd3 100644
--- a/common/crypto/signature_utils.h
+++ b/common/crypto/signature_utils.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/common/crypto/signature_verifier.cpp b/common/crypto/signature_verifier.cpp
index 09e81985..cf2046e2 100644
--- a/common/crypto/signature_verifier.cpp
+++ b/common/crypto/signature_verifier.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "common/crypto/signature_verifier.h"
diff --git a/common/crypto/signature_verifier.h b/common/crypto/signature_verifier.h
index 619908ea..2a8e312c 100644
--- a/common/crypto/signature_verifier.h
+++ b/common/crypto/signature_verifier.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/common/crypto/signature_verifier_interface.cpp b/common/crypto/signature_verifier_interface.cpp
index 07bed5cc..865eccff 100644
--- a/common/crypto/signature_verifier_interface.cpp
+++ b/common/crypto/signature_verifier_interface.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "common/crypto/signature_verifier_interface.h"
diff --git a/common/crypto/signature_verifier_interface.h b/common/crypto/signature_verifier_interface.h
index eea1b410..197387fc 100644
--- a/common/crypto/signature_verifier_interface.h
+++ b/common/crypto/signature_verifier_interface.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/common/crypto/signature_verifier_test.cpp b/common/crypto/signature_verifier_test.cpp
index b7453bb9..3bdecc8d 100644
--- a/common/crypto/signature_verifier_test.cpp
+++ b/common/crypto/signature_verifier_test.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "common/crypto/signature_verifier.h"
diff --git a/common/proto/BUILD b/common/proto/BUILD
index d6647a53..2122cef4 100644
--- a/common/proto/BUILD
+++ b/common/proto/BUILD
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
diff --git a/common/proto/signature_info.proto b/common/proto/signature_info.proto
index 607fe4ac..cc1cfc42 100644
--- a/common/proto/signature_info.proto
+++ b/common/proto/signature_info.proto
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
syntax = "proto3";
package resdb;
diff --git a/common/test/BUILD b/common/test/BUILD
index df156e5c..e6bd3d61 100644
--- a/common/test/BUILD
+++ b/common/test/BUILD
@@ -1,3 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
cc_library(
diff --git a/common/test/json_test.cpp b/common/test/json_test.cpp
index ccc28680..4fcaeed5 100644
--- a/common/test/json_test.cpp
+++ b/common/test/json_test.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include <gtest/gtest.h>
diff --git a/common/test/test.proto b/common/test/test.proto
index c8a075d1..2e8320c0 100644
--- a/common/test/test.proto
+++ b/common/test/test.proto
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
syntax = "proto3";
package resdb.test;
diff --git a/common/test/test_macros.h b/common/test/test_macros.h
index 6a991ed4..5e510f2a 100644
--- a/common/test/test_macros.h
+++ b/common/test/test_macros.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/common/utils/BUILD b/common/utils/BUILD
index 3f6d1d06..44d5e69b 100644
--- a/common/utils/BUILD
+++ b/common/utils/BUILD
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
cc_library(
diff --git a/common/utils/utils.cpp b/common/utils/utils.cpp
index d4707fc5..c5124120 100644
--- a/common/utils/utils.cpp
+++ b/common/utils/utils.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "common/utils/utils.h"
diff --git a/common/utils/utils.h b/common/utils/utils.h
index bc57af07..2a17286a 100644
--- a/common/utils/utils.h
+++ b/common/utils/utils.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/dev/.rat-excludes b/dev/.rat-excludes
new file mode 100644
index 00000000..7889a072
--- /dev/null
+++ b/dev/.rat-excludes
@@ -0,0 +1,19 @@
+.bazelrc
+.bazelversion
+.clang-format
+.licenserc.yaml
+repositories.bzl
+.gitignore
+.git
+.rat-excludes
+DISCLAIMER-WIP
+CNAME
+WORKSPACE
+build
+.*\.conf
+.*\.config
+.*\.pub
+.*\.pri
+Doxyfile
+header
+.*\.sol
diff --git a/dev/check-license b/dev/check-license
new file mode 100755
index 00000000..e929e68b
--- /dev/null
+++ b/dev/check-license
@@ -0,0 +1,86 @@
+#!/usr/bin/env bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+acquire_rat_jar () {
+
+ URL="https://repo.maven.apache.org/maven2/org/apache/rat/apache-rat/${RAT_VERSION}/apache-rat-${RAT_VERSION}.jar"
+
+ JAR="$rat_jar"
+
+ # Download rat launch jar if it hasn't been downloaded yet
+ if [ ! -f "$JAR" ]; then
+ # Download
+ printf "Attempting to fetch rat\n"
+ JAR_DL="${JAR}.part"
+ if [ $(command -v curl) ]; then
+ curl -L --silent "${URL}" > "$JAR_DL" && mv "$JAR_DL" "$JAR"
+ elif [ $(command -v wget) ]; then
+ wget --quiet ${URL} -O "$JAR_DL" && mv "$JAR_DL" "$JAR"
+ else
+ printf "You do not have curl or wget installed, please install rat manually.\n"
+ exit -1
+ fi
+ fi
+
+ unzip -tq "$JAR" &> /dev/null
+ if [ $? -ne 0 ]; then
+ # We failed to download
+ rm "$JAR"
+ printf "Our attempt to download rat locally to ${JAR} failed. Please install rat manually.\n"
+ exit -1
+ fi
+}
+
+# Go to the Spark project root directory
+FWDIR="$(cd "`dirname "$0"`"/..; pwd)"
+cd "$FWDIR"
+
+if test -x "$JAVA_HOME/bin/java"; then
+ declare java_cmd="$JAVA_HOME/bin/java"
+else
+ declare java_cmd=java
+fi
+
+export RAT_VERSION=0.16.1
+export rat_jar="$FWDIR"/lib/apache-rat-${RAT_VERSION}.jar
+mkdir -p "$FWDIR"/lib
+
+[[ -f "$rat_jar" ]] || acquire_rat_jar || {
+ echo "Download failed. Obtain the rat jar manually and place it at $rat_jar"
+ exit 1
+}
+
+mkdir -p build
+$java_cmd -jar "$rat_jar" --scan-hidden-directories -E "$FWDIR"/dev/.rat-excludes -d "$FWDIR" > build/rat-results.txt
+
+if [ $? -ne 0 ]; then
+ echo "RAT exited abnormally"
+ exit 1
+fi
+
+ERRORS="$(cat build/rat-results.txt | grep -e "??")"
+
+if test ! -z "$ERRORS"; then
+ echo "Could not find Apache license headers in the following files:"
+ echo "$ERRORS"
+ exit 1
+else
+ echo -e "RAT checks passed."
+fi
diff --git a/documents/doxygen/Doxyfile b/documents/doxygen/Doxyfile
index 547a34fc..13911062 100644
--- a/documents/doxygen/Doxyfile
+++ b/documents/doxygen/Doxyfile
@@ -42,7 +42,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.
-PROJECT_NAME = ResilientDB
+PROJECT_NAME = ResilientDB
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
@@ -54,7 +54,7 @@ PROJECT_NUMBER = v1.3.1
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.
-PROJECT_BRIEF = NexRes
+PROJECT_BRIEF = ResilientDB
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
@@ -1330,7 +1330,7 @@ HTML_FILE_EXTENSION = .html
# of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_HEADER =
+HTML_HEADER = header
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard
@@ -1370,7 +1370,7 @@ HTML_STYLESHEET =
# documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_STYLESHEET = doxygen_html_style.css
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
diff --git a/documents/doxygen/DoxygenLayout.xml b/documents/doxygen/DoxygenLayout.xml
index 34a428d5..50f95acc 100644
--- a/documents/doxygen/DoxygenLayout.xml
+++ b/documents/doxygen/DoxygenLayout.xml
@@ -1,3 +1,19 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
<doxygenlayout version="1.0">
<!-- Generated by doxygen 1.9.6 -->
<!-- Navigation index tabs for HTML output -->
diff --git a/documents/doxygen/doxygen_html_style.css b/documents/doxygen/doxygen_html_style.css
new file mode 100644
index 00000000..93cbf2e1
--- /dev/null
+++ b/documents/doxygen/doxygen_html_style.css
@@ -0,0 +1,20 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+img[src="logo.png"]{
+ width: 250px;
+ height: 83px;
+}
diff --git a/documents/doxygen/header b/documents/doxygen/header
new file mode 100644
index 00000000..7fd1bd26
--- /dev/null
+++ b/documents/doxygen/header
@@ -0,0 +1,60 @@
+<!-- HTML header for doxygen 1.9.8-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="$langISO">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=11"/>
+<meta name="generator" content="Doxygen $doxygenversion"/>
+<meta name="viewport" content="width=device-width, initial-scale=1"/>
+<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
+<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
+<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
+<!--BEGIN DISABLE_INDEX-->
+ <!--BEGIN FULL_SIDEBAR-->
+<script type="text/javascript">var page_layout=1;</script>
+ <!--END FULL_SIDEBAR-->
+<!--END DISABLE_INDEX-->
+<script type="text/javascript" src="$relpath^jquery.js"></script>
+<script type="text/javascript" src="$relpath^dynsections.js"></script>
+$treeview
+$search
+$mathjax
+$darkmode
+<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
+$extrastylesheet
+</head>
+<body>
+<!--BEGIN DISABLE_INDEX-->
+ <!--BEGIN FULL_SIDEBAR-->
+<div id="side-nav" class="ui-resizable side-nav-resizable"><!-- do not remove this div, it is closed by doxygen! -->
+ <!--END FULL_SIDEBAR-->
+<!--END DISABLE_INDEX-->
+
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+
+<!--BEGIN TITLEAREA-->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr id="projectrow">
+ <!--BEGIN PROJECT_LOGO-->
+ <td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td>
+ <!--END PROJECT_LOGO-->
+ <!--BEGIN DISABLE_INDEX-->
+ <!--BEGIN SEARCHENGINE-->
+ <!--BEGIN !FULL_SIDEBAR-->
+ <td>$searchbox</td>
+ <!--END !FULL_SIDEBAR-->
+ <!--END SEARCHENGINE-->
+ <!--END DISABLE_INDEX-->
+ </tr>
+ <!--BEGIN SEARCHENGINE-->
+ <!--BEGIN FULL_SIDEBAR-->
+ <tr><td colspan="2">$searchbox</td></tr>
+ <!--END FULL_SIDEBAR-->
+ <!--END SEARCHENGINE-->
+ </tbody>
+</table>
+</div>
+<!--END TITLEAREA-->
+<!-- end header part -->
diff --git a/documents/doxygen/logo.png b/documents/doxygen/logo.png
index 58dd2008..b9509d2e 100644
Binary files a/documents/doxygen/logo.png and b/documents/doxygen/logo.png differ
diff --git a/documents/file/prometheus.yml b/documents/file/prometheus.yml
index 72fbeaf5..e2204277 100644
--- a/documents/file/prometheus.yml
+++ b/documents/file/prometheus.yml
@@ -1,7 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
# my global config
global:
- scrape_interval: 5s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
- evaluation_interval: 5s # Evaluate rules every 15 seconds. The default is every 1 minute.
+ scrape_interval: 5s # Set the scrape interval to every 5 seconds. Default is every 1 minute.
+ evaluation_interval: 5s # Evaluate rules every 5 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
diff --git a/entrypoint.sh b/entrypoint.sh
index a5ef6599..0b3d1019 100755
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -1,4 +1,21 @@
-#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
./service/tools/kv/server_tools/start_kv_service.sh
-tail -f /dev/null
\ No newline at end of file
+tail -f /dev/null
diff --git a/executor/common/BUILD b/executor/common/BUILD
index 0e0d8ee5..e50dab38 100644
--- a/executor/common/BUILD
+++ b/executor/common/BUILD
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
cc_library(
diff --git a/executor/common/custom_query.h b/executor/common/custom_query.h
index e574a98d..2c8bf4a7 100644
--- a/executor/common/custom_query.h
+++ b/executor/common/custom_query.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/executor/common/mock_transaction_manager.h b/executor/common/mock_transaction_manager.h
index 86972f66..b4a6ba53 100644
--- a/executor/common/mock_transaction_manager.h
+++ b/executor/common/mock_transaction_manager.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/executor/common/transaction_manager.cpp b/executor/common/transaction_manager.cpp
index 85471586..036f9619 100644
--- a/executor/common/transaction_manager.cpp
+++ b/executor/common/transaction_manager.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/common/transaction_manager.h"
diff --git a/executor/common/transaction_manager.h b/executor/common/transaction_manager.h
index 7e243f97..16e1a58d 100644
--- a/executor/common/transaction_manager.h
+++ b/executor/common/transaction_manager.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/executor/contract/executor/BUILD b/executor/contract/executor/BUILD
index d93b372b..c6e40c65 100644
--- a/executor/contract/executor/BUILD
+++ b/executor/contract/executor/BUILD
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
cc_library(
diff --git a/executor/contract/executor/contract_executor.cpp b/executor/contract/executor/contract_executor.cpp
index 6e8c994a..6db35ad7 100644
--- a/executor/contract/executor/contract_executor.cpp
+++ b/executor/contract/executor/contract_executor.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/contract/executor/contract_executor.h"
diff --git a/executor/contract/executor/contract_executor.h b/executor/contract/executor/contract_executor.h
index 8c2a50c8..c902e297 100644
--- a/executor/contract/executor/contract_executor.h
+++ b/executor/contract/executor/contract_executor.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/executor/contract/executor/contract_executor_test.cpp b/executor/contract/executor/contract_executor_test.cpp
index 5d29333d..b8b63aec 100644
--- a/executor/contract/executor/contract_executor_test.cpp
+++ b/executor/contract/executor/contract_executor_test.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/contract/executor/contract_executor.h"
diff --git a/executor/contract/executor/test_data/BUILD b/executor/contract/executor/test_data/BUILD
index 65e3dc3d..25213295 100644
--- a/executor/contract/executor/test_data/BUILD
+++ b/executor/contract/executor/test_data/BUILD
@@ -1 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
exports_files(["contract.json"])
diff --git a/executor/contract/manager/BUILD b/executor/contract/manager/BUILD
index 17d9d709..f1d26925 100644
--- a/executor/contract/manager/BUILD
+++ b/executor/contract/manager/BUILD
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
cc_library(
diff --git a/executor/contract/manager/address_manager.cpp b/executor/contract/manager/address_manager.cpp
index e155d9f8..2a886dac 100644
--- a/executor/contract/manager/address_manager.cpp
+++ b/executor/contract/manager/address_manager.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/contract/manager/address_manager.h"
diff --git a/executor/contract/manager/address_manager.h b/executor/contract/manager/address_manager.h
index b0446503..4e6055aa 100644
--- a/executor/contract/manager/address_manager.h
+++ b/executor/contract/manager/address_manager.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/executor/contract/manager/address_manager_test.cpp b/executor/contract/manager/address_manager_test.cpp
index 08287b62..21fd9044 100644
--- a/executor/contract/manager/address_manager_test.cpp
+++ b/executor/contract/manager/address_manager_test.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/contract/manager/address_manager.h"
diff --git a/executor/contract/manager/contract_manager.cpp b/executor/contract/manager/contract_manager.cpp
index 3b8ff11c..426a0b8a 100644
--- a/executor/contract/manager/contract_manager.cpp
+++ b/executor/contract/manager/contract_manager.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/contract/manager/contract_manager.h"
diff --git a/executor/contract/manager/contract_manager.h b/executor/contract/manager/contract_manager.h
index b645d728..7e250aa6 100644
--- a/executor/contract/manager/contract_manager.h
+++ b/executor/contract/manager/contract_manager.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/executor/contract/manager/contract_manager_test.cpp b/executor/contract/manager/contract_manager_test.cpp
index 7b7cc32d..32540bd4 100644
--- a/executor/contract/manager/contract_manager_test.cpp
+++ b/executor/contract/manager/contract_manager_test.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/contract/manager/contract_manager.h"
@@ -40,7 +34,7 @@ using ::testing::Test;
const std::string test_dir = std::string(getenv("TEST_SRCDIR")) + "/" +
std::string(getenv("TEST_WORKSPACE")) +
- "/service/contract/executor/manager/";
+ "/executor/contract/manager/";
Address get_random_address() { return AddressManager().CreateRandomAddress(); }
diff --git a/executor/contract/manager/test_data/BUILD b/executor/contract/manager/test_data/BUILD
index 65e3dc3d..25213295 100644
--- a/executor/contract/manager/test_data/BUILD
+++ b/executor/contract/manager/test_data/BUILD
@@ -1 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
exports_files(["contract.json"])
diff --git a/executor/contract/manager/utils.h b/executor/contract/manager/utils.h
index 2d243d66..ff9548ca 100644
--- a/executor/contract/manager/utils.h
+++ b/executor/contract/manager/utils.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/executor/kv/BUILD b/executor/kv/BUILD
index 9117dd93..09f75c24 100644
--- a/executor/kv/BUILD
+++ b/executor/kv/BUILD
@@ -1,41 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
-bool_flag(
- name = "enable_leveldb",
- build_setting_default = False,
- visibility = ["//visibility:public"],
-)
-
-bool_flag(
- name = "enable_rocksdb",
- build_setting_default = False,
- visibility = ["//visibility:public"],
-)
-
-config_setting(
- name = "enable_leveldb_setting",
- values = {
- "define": "enable_leveldb=True",
- },
- visibility = ["//visibility:public"],
-)
-
-config_setting(
- name = "enable_rocksdb_setting",
- values = {
- "define": "enable_rocksdb=True",
- },
- visibility = ["//visibility:public"],
-)
-
cc_library(
name = "kv_executor",
srcs = ["kv_executor.cpp"],
hdrs = ["kv_executor.h"],
deps = [
- "//chain/state:chain_state",
+ "//chain/storage",
"//common:comm",
"//executor/common:transaction_manager",
"//platform/config:resdb_config_utils",
@@ -48,7 +38,7 @@ cc_test(
srcs = ["kv_executor_test.cpp"],
deps = [
":kv_executor",
- "//chain/storage:mock_storage",
+ "//chain/storage:memory_db",
"//common/test:test_main",
],
)
diff --git a/executor/kv/kv_executor.cpp b/executor/kv/kv_executor.cpp
index 8d2ecf55..742253b0 100644
--- a/executor/kv/kv_executor.cpp
+++ b/executor/kv/kv_executor.cpp
@@ -1,38 +1,30 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/kv/kv_executor.h"
#include <glog/logging.h>
-#include "proto/kv/kv.pb.h"
-
namespace resdb {
-KVExecutor::KVExecutor(std::unique_ptr<ChainState> state)
- : state_(std::move(state)) {}
+KVExecutor::KVExecutor(std::unique_ptr<Storage> storage)
+ : storage_(std::move(storage)) {}
std::unique_ptr<std::string> KVExecutor::ExecuteData(
const std::string& request) {
@@ -48,34 +40,108 @@ std::unique_ptr<std::string> KVExecutor::ExecuteData(
Set(kv_request.key(), kv_request.value());
} else if (kv_request.cmd() == KVRequest::GET) {
kv_response.set_value(Get(kv_request.key()));
- } else if (kv_request.cmd() == KVRequest::GETVALUES) {
- kv_response.set_value(GetValues());
+ } else if (kv_request.cmd() == KVRequest::GETALLVALUES) {
+ kv_response.set_value(GetAllValues());
} else if (kv_request.cmd() == KVRequest::GETRANGE) {
kv_response.set_value(GetRange(kv_request.key(), kv_request.value()));
+ } else if (kv_request.cmd() == KVRequest::SET_WITH_VERSION) {
+ SetWithVersion(kv_request.key(), kv_request.value(), kv_request.version());
+ } else if (kv_request.cmd() == KVRequest::GET_WITH_VERSION) {
+ GetWithVersion(kv_request.key(), kv_request.version(),
+ kv_response.mutable_value_info());
+ } else if (kv_request.cmd() == KVRequest::GET_ALL_ITEMS) {
+ GetAllItems(kv_response.mutable_items());
+ } else if (kv_request.cmd() == KVRequest::GET_KEY_RANGE) {
+ GetKeyRange(kv_request.min_key(), kv_request.max_key(),
+ kv_response.mutable_items());
+ } else if (kv_request.cmd() == KVRequest::GET_HISTORY) {
+ GetHistory(kv_request.key(), kv_request.min_version(),
+ kv_request.max_version(), kv_response.mutable_items());
+ } else if (kv_request.cmd() == KVRequest::GET_TOP) {
+ GetTopHistory(kv_request.key(), kv_request.top_number(),
+ kv_response.mutable_items());
}
std::unique_ptr<std::string> resp_str = std::make_unique<std::string>();
if (!kv_response.SerializeToString(resp_str.get())) {
return nullptr;
}
-
return resp_str;
}
void KVExecutor::Set(const std::string& key, const std::string& value) {
- state_->SetValue(key, value);
+ storage_->SetValue(key, value);
}
std::string KVExecutor::Get(const std::string& key) {
- return state_->GetValue(key);
+ return storage_->GetValue(key);
}
-std::string KVExecutor::GetValues() { return state_->GetAllValues(); }
+std::string KVExecutor::GetAllValues() { return storage_->GetAllValues(); }
// Get values on a range of keys
std::string KVExecutor::GetRange(const std::string& min_key,
const std::string& max_key) {
- return state_->GetRange(min_key, max_key);
+ return storage_->GetRange(min_key, max_key);
+}
+
+void KVExecutor::SetWithVersion(const std::string& key,
+ const std::string& value, int version) {
+ storage_->SetValueWithVersion(key, value, version);
+}
+
+void KVExecutor::GetWithVersion(const std::string& key, int version,
+ ValueInfo* info) {
+ std::pair<std::string, int> ret = storage_->GetValueWithVersion(key, version);
+ info->set_value(ret.first);
+ info->set_version(ret.second);
+}
+
+void KVExecutor::GetAllItems(Items* items) {
+ const std::map<std::string, std::pair<std::string, int>>& ret =
+ storage_->GetAllItems();
+ for (auto it : ret) {
+ Item* item = items->add_item();
+ item->set_key(it.first);
+ item->mutable_value_info()->set_value(it.second.first);
+ item->mutable_value_info()->set_version(it.second.second);
+ }
+}
+
+void KVExecutor::GetKeyRange(const std::string& min_key,
+ const std::string& max_key, Items* items) {
+ const std::map<std::string, std::pair<std::string, int>>& ret =
+ storage_->GetKeyRange(min_key, max_key);
+ for (auto it : ret) {
+ Item* item = items->add_item();
+ item->set_key(it.first);
+ item->mutable_value_info()->set_value(it.second.first);
+ item->mutable_value_info()->set_version(it.second.second);
+ }
+}
+
+void KVExecutor::GetHistory(const std::string& key, int min_version,
+ int max_version, Items* items) {
+ const std::vector<std::pair<std::string, int>>& ret =
+ storage_->GetHistory(key, min_version, max_version);
+ for (auto it : ret) {
+ Item* item = items->add_item();
+ item->set_key(key);
+ item->mutable_value_info()->set_value(it.first);
+ item->mutable_value_info()->set_version(it.second);
+ }
+}
+
+void KVExecutor::GetTopHistory(const std::string& key, int top_number,
+ Items* items) {
+ const std::vector<std::pair<std::string, int>>& ret =
+ storage_->GetTopHistory(key, top_number);
+ for (auto it : ret) {
+ Item* item = items->add_item();
+ item->set_key(key);
+ item->mutable_value_info()->set_value(it.first);
+ item->mutable_value_info()->set_version(it.second);
+ }
}
} // namespace resdb
diff --git a/executor/kv/kv_executor.h b/executor/kv/kv_executor.h
index 58392f03..0fda88ae 100644
--- a/executor/kv/kv_executor.h
+++ b/executor/kv/kv_executor.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
@@ -29,15 +23,15 @@
#include <optional>
#include <unordered_map>
-#include "chain/state/chain_state.h"
+#include "chain/storage/storage.h"
#include "executor/common/transaction_manager.h"
-#include "platform/config/resdb_config_utils.h"
+#include "proto/kv/kv.pb.h"
namespace resdb {
class KVExecutor : public TransactionManager {
public:
- KVExecutor(std::unique_ptr<ChainState> state);
+ KVExecutor(std::unique_ptr<Storage> storage);
virtual ~KVExecutor() = default;
std::unique_ptr<std::string> ExecuteData(const std::string& request) override;
@@ -45,11 +39,21 @@ class KVExecutor : public TransactionManager {
protected:
virtual void Set(const std::string& key, const std::string& value);
std::string Get(const std::string& key);
- std::string GetValues();
+ std::string GetAllValues();
std::string GetRange(const std::string& min_key, const std::string& max_key);
+ void SetWithVersion(const std::string& key, const std::string& value,
+ int version);
+ void GetWithVersion(const std::string& key, int version, ValueInfo* info);
+ void GetAllItems(Items* items);
+ void GetKeyRange(const std::string& min_key, const std::string& max_key,
+ Items* items);
+ void GetHistory(const std::string& key, int min_key, int max_key,
+ Items* items);
+ void GetTopHistory(const std::string& key, int top_number, Items* items);
+
private:
- std::unique_ptr<ChainState> state_;
+ std::unique_ptr<Storage> storage_;
};
} // namespace resdb
diff --git a/executor/kv/kv_executor_test.cpp b/executor/kv/kv_executor_test.cpp
index 17b32a46..9bf78dc4 100644
--- a/executor/kv/kv_executor_test.cpp
+++ b/executor/kv/kv_executor_test.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/kv/kv_executor.h"
@@ -28,13 +22,17 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-#include "chain/storage/mock_storage.h"
+#include "chain/storage/memory_db.h"
+#include "chain/storage/storage.h"
+#include "common/test/test_macros.h"
#include "platform/config/resdb_config_utils.h"
#include "proto/kv/kv.pb.h"
namespace resdb {
namespace {
+using ::resdb::testing::EqualsProto;
+using storage::MemoryDB;
using ::testing::Invoke;
using ::testing::Return;
using ::testing::Test;
@@ -42,10 +40,9 @@ using ::testing::Test;
class KVExecutorTest : public Test {
public:
KVExecutorTest() {
- auto mock_storage = std::make_unique<MockStorage>();
- mock_storage_ptr_ = mock_storage.get();
- impl_ = std::make_unique<KVExecutor>(
- std::make_unique<ChainState>(std::move(mock_storage)));
+ auto storage = std::make_unique<MemoryDB>();
+ storage_ptr_ = storage.get();
+ impl_ = std::make_unique<KVExecutor>(std::move(storage));
}
int Set(const std::string& key, const std::string& value) {
@@ -83,9 +80,9 @@ class KVExecutorTest : public Test {
return kv_response.value();
}
- std::string GetValues() {
+ std::string GetAllValues() {
KVRequest request;
- request.set_cmd(KVRequest::GETVALUES);
+ request.set_cmd(KVRequest::GETALLVALUES);
std::string str;
if (!request.SerializeToString(&str)) {
@@ -123,8 +120,115 @@ class KVExecutorTest : public Test {
return kv_response.value();
}
+ int Set(const std::string& key, const std::string& value, int version) {
+ KVRequest request;
+ request.set_cmd(KVRequest::SET_WITH_VERSION);
+ request.set_key(key);
+ request.set_value(value);
+ request.set_version(version);
+
+ std::string str;
+ if (!request.SerializeToString(&str)) {
+ return -1;
+ }
+
+ impl_->ExecuteData(str);
+ return 0;
+ }
+
+ ValueInfo Get(const std::string& key, int version) {
+ KVRequest request;
+ request.set_cmd(KVRequest::GET_WITH_VERSION);
+ request.set_key(key);
+ request.set_version(version);
+
+ std::string str;
+ if (!request.SerializeToString(&str)) {
+ return ValueInfo();
+ }
+
+ auto resp = impl_->ExecuteData(str);
+ if (resp == nullptr) {
+ return ValueInfo();
+ }
+ KVResponse kv_response;
+ if (!kv_response.ParseFromString(*resp)) {
+ return ValueInfo();
+ }
+
+ return kv_response.value_info();
+ }
+
+ Items GetAllItems() {
+ KVRequest request;
+ request.set_cmd(KVRequest::GET_ALL_ITEMS);
+
+ std::string str;
+ if (!request.SerializeToString(&str)) {
+ return Items();
+ }
+
+ auto resp = impl_->ExecuteData(str);
+ if (resp == nullptr) {
+ return Items();
+ }
+ KVResponse kv_response;
+ if (!kv_response.ParseFromString(*resp)) {
+ return Items();
+ }
+
+ return kv_response.items();
+ }
+
+ Items GetKeyRange(const std::string& min_key, const std::string& max_key) {
+ KVRequest request;
+ request.set_cmd(KVRequest::GET_KEY_RANGE);
+ request.set_min_key(min_key);
+ request.set_max_key(max_key);
+
+ std::string str;
+ if (!request.SerializeToString(&str)) {
+ return Items();
+ }
+
+ auto resp = impl_->ExecuteData(str);
+ if (resp == nullptr) {
+ return Items();
+ }
+ KVResponse kv_response;
+ if (!kv_response.ParseFromString(*resp)) {
+ return Items();
+ }
+
+ return kv_response.items();
+ }
+
+ Items GetHistory(const std::string& key, int min_version, int max_version) {
+ KVRequest request;
+ request.set_cmd(KVRequest::GET_HISTORY);
+ request.set_key(key);
+ request.set_min_version(min_version);
+ request.set_max_version(max_version);
+
+ std::string str;
+ if (!request.SerializeToString(&str)) {
+ return Items();
+ }
+
+ auto resp = impl_->ExecuteData(str);
+ if (resp == nullptr) {
+ return Items();
+ }
+ KVResponse kv_response;
+ if (!kv_response.ParseFromString(*resp)) {
+ return Items();
+ }
+
+ return kv_response.items();
+ }
+
protected:
- MockStorage* mock_storage_ptr_;
+ Storage* storage_ptr_;
private:
std::unique_ptr<KVExecutor> impl_;
@@ -133,33 +237,105 @@ class KVExecutorTest : public Test {
TEST_F(KVExecutorTest, SetValue) {
std::map<std::string, std::string> data;
- EXPECT_CALL(*mock_storage_ptr_, SetValue("test_key", "test_value"))
- .WillOnce(Invoke([&](const std::string& key, const std::string& value) {
- data[key] = value;
- return 0;
- }));
+ EXPECT_EQ(GetAllValues(), "[]");
+ EXPECT_EQ(Set("test_key", "test_value"), 0);
+ EXPECT_EQ(Get("test_key"), "test_value");
- EXPECT_CALL(*mock_storage_ptr_, GetValue("test_key"))
- .WillOnce(Invoke([&](const std::string& key) {
- std::string ret = data[key];
- return ret;
- }));
+ // GetAllValues and GetRange may be out of order for in-memory, so we test up
+ // to 1 key-value pair
+ EXPECT_EQ(GetAllValues(), "[test_value]");
+ EXPECT_EQ(GetRange("a", "z"), "[test_value]");
+}
- EXPECT_CALL(*mock_storage_ptr_, GetAllValues())
- .WillOnce(Return("[]"))
- .WillOnce(Return("[test_value]"));
+TEST_F(KVExecutorTest, SetValueWithVersion) {
+ std::map<std::string, std::string> data;
- EXPECT_CALL(*mock_storage_ptr_, GetRange("a", "z"))
- .WillOnce(Return("[test_value]"));
+ {
+ EXPECT_EQ(Set("test_key", "test_value", 0), 0);
+ ValueInfo expected_info;
+ expected_info.set_value("test_value");
+ expected_info.set_version(1);
+ EXPECT_THAT(Get("test_key", 1), EqualsProto(expected_info));
+ }
- EXPECT_EQ(GetValues(), "[]");
- EXPECT_EQ(Set("test_key", "test_value"), 0);
- EXPECT_EQ(Get("test_key"), "test_value");
+ {
+ EXPECT_EQ(Set("test_key", "test_value1", 1), 0);
+ ValueInfo expected_info;
+ expected_info.set_value("test_value1");
+ expected_info.set_version(2);
+ EXPECT_THAT(Get("test_key", 2), EqualsProto(expected_info));
+ }
+ {
+ EXPECT_EQ(Set("test_key", "test_value1", 1), 0);
+ ValueInfo expected_info;
+ expected_info.set_value("test_value");
+ expected_info.set_version(1);
+ EXPECT_THAT(Get("test_key", 1), EqualsProto(expected_info));
+ }
- // GetValues and GetRange may be out of order for in-memory, so we test up to
- // 1 key-value pair
- EXPECT_EQ(GetValues(), "[test_value]");
- EXPECT_EQ(GetRange("a", "z"), "[test_value]");
+ {
+ EXPECT_EQ(Set("test_key1", "test_key1", 0), 0);
+ ValueInfo expected_info;
+ expected_info.set_value("test_key1");
+ expected_info.set_version(1);
+ EXPECT_THAT(Get("test_key1", 1), EqualsProto(expected_info));
+
+ ValueInfo expected_info2;
+ expected_info2.set_value("test_value");
+ expected_info2.set_version(1);
+ EXPECT_THAT(Get("test_key", 1), EqualsProto(expected_info2));
+
+ ValueInfo expected_info3;
+ expected_info3.set_value("test_value1");
+ expected_info3.set_version(2);
+ EXPECT_THAT(Get("test_key", 0), EqualsProto(expected_info3));
+ }
+
+ {
+ Items items;
+ {
+ Item* item = items.add_item();
+ item->set_key("test_key");
+ item->mutable_value_info()->set_value("test_value1");
+ item->mutable_value_info()->set_version(2);
+ }
+ {
+ Item* item = items.add_item();
+ item->set_key("test_key1");
+ item->mutable_value_info()->set_value("test_key1");
+ item->mutable_value_info()->set_version(1);
+ }
+
+ EXPECT_THAT(GetAllItems(), EqualsProto(items));
+ }
+
+ {
+ Items items;
+ {
+ Item* item = items.add_item();
+ item->set_key("test_key");
+ item->mutable_value_info()->set_value("test_value1");
+ item->mutable_value_info()->set_version(2);
+ }
+ EXPECT_THAT(GetKeyRange("test_key", "test_key"), EqualsProto(items));
+ }
+
+ {
+ Items items;
+ {
+ Item* item = items.add_item();
+ item->set_key("test_key");
+ item->mutable_value_info()->set_value("test_value1");
+ item->mutable_value_info()->set_version(2);
+ }
+ {
+ Item* item = items.add_item();
+ item->set_key("test_key");
+ item->mutable_value_info()->set_value("test_value");
+ item->mutable_value_info()->set_version(1);
+ }
+ EXPECT_THAT(GetHistory("test_key", 0, 2), EqualsProto(items));
+ }
}
} // namespace
diff --git a/executor/utxo/executor/BUILD b/executor/utxo/executor/BUILD
index 013e4ad6..2a4fb938 100644
--- a/executor/utxo/executor/BUILD
+++ b/executor/utxo/executor/BUILD
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
cc_library(
diff --git a/executor/utxo/executor/utxo_executor.cpp b/executor/utxo/executor/utxo_executor.cpp
index ff84f7dd..a60e535a 100644
--- a/executor/utxo/executor/utxo_executor.cpp
+++ b/executor/utxo/executor/utxo_executor.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/utxo/executor/utxo_executor.h"
diff --git a/executor/utxo/executor/utxo_executor.h b/executor/utxo/executor/utxo_executor.h
index a0b62542..2e9acf8b 100644
--- a/executor/utxo/executor/utxo_executor.h
+++ b/executor/utxo/executor/utxo_executor.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/executor/utxo/executor/utxo_executor_test.cpp b/executor/utxo/executor/utxo_executor_test.cpp
index cda4a839..0de5d69d 100644
--- a/executor/utxo/executor/utxo_executor_test.cpp
+++ b/executor/utxo/executor/utxo_executor_test.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/utxo/executor/utxo_executor.h"
diff --git a/executor/utxo/manager/BUILD b/executor/utxo/manager/BUILD
index 13958c40..77f125f4 100644
--- a/executor/utxo/manager/BUILD
+++ b/executor/utxo/manager/BUILD
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//executor/utxo:__subpackages__"])
cc_library(
diff --git a/executor/utxo/manager/transaction.cpp b/executor/utxo/manager/transaction.cpp
index b2c75067..787e2011 100644
--- a/executor/utxo/manager/transaction.cpp
+++ b/executor/utxo/manager/transaction.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/utxo/manager/transaction.h"
diff --git a/executor/utxo/manager/transaction.h b/executor/utxo/manager/transaction.h
index 238101af..556d75b0 100644
--- a/executor/utxo/manager/transaction.h
+++ b/executor/utxo/manager/transaction.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/executor/utxo/manager/transaction_test.cpp b/executor/utxo/manager/transaction_test.cpp
index 0fe154d7..50e239f0 100644
--- a/executor/utxo/manager/transaction_test.cpp
+++ b/executor/utxo/manager/transaction_test.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/utxo/manager/transaction.h"
diff --git a/executor/utxo/manager/tx_mempool.cpp b/executor/utxo/manager/tx_mempool.cpp
index 889b1fea..ef832bc6 100644
--- a/executor/utxo/manager/tx_mempool.cpp
+++ b/executor/utxo/manager/tx_mempool.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/utxo/manager/tx_mempool.h"
diff --git a/executor/utxo/manager/tx_mempool.h b/executor/utxo/manager/tx_mempool.h
index 13af92bd..808361b4 100644
--- a/executor/utxo/manager/tx_mempool.h
+++ b/executor/utxo/manager/tx_mempool.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/executor/utxo/manager/tx_mempool_test.cpp b/executor/utxo/manager/tx_mempool_test.cpp
index 205ad66c..a9af0517 100644
--- a/executor/utxo/manager/tx_mempool_test.cpp
+++ b/executor/utxo/manager/tx_mempool_test.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/utxo/manager/tx_mempool.h"
diff --git a/executor/utxo/manager/wallet.cpp b/executor/utxo/manager/wallet.cpp
index b69e7568..644b35d9 100644
--- a/executor/utxo/manager/wallet.cpp
+++ b/executor/utxo/manager/wallet.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/utxo/manager/wallet.h"
diff --git a/executor/utxo/manager/wallet.h b/executor/utxo/manager/wallet.h
index 5ed03c1a..b9755515 100644
--- a/executor/utxo/manager/wallet.h
+++ b/executor/utxo/manager/wallet.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/executor/utxo/manager/wallet_test.cpp b/executor/utxo/manager/wallet_test.cpp
index ebf6e2b3..6e606e20 100644
--- a/executor/utxo/manager/wallet_test.cpp
+++ b/executor/utxo/manager/wallet_test.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "executor/utxo/manager/wallet.h"
diff --git a/img/apache-incubator.png b/img/apache-incubator.png
new file mode 100644
index 00000000..338169e4
Binary files /dev/null and b/img/apache-incubator.png differ
diff --git a/img/apache-resdb.png b/img/apache-resdb.png
new file mode 100644
index 00000000..1e2d0a0a
Binary files /dev/null and b/img/apache-resdb.png differ
diff --git a/img/resdb-v2.png b/img/resdb-v2.png
new file mode 100644
index 00000000..aa5bf166
Binary files /dev/null and b/img/resdb-v2.png differ
diff --git a/img/resdb.png b/img/resdb.png
new file mode 100644
index 00000000..bce6eb40
Binary files /dev/null and b/img/resdb.png differ
diff --git a/interface/common/BUILD b/interface/common/BUILD
index e5765e1e..63f5bdee 100644
--- a/interface/common/BUILD
+++ b/interface/common/BUILD
@@ -1,3 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
cc_library(
diff --git a/interface/common/mock_resdb_txn_accessor.h b/interface/common/mock_resdb_txn_accessor.h
index c900dba4..3962ba27 100644
--- a/interface/common/mock_resdb_txn_accessor.h
+++ b/interface/common/mock_resdb_txn_accessor.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/interface/common/resdb_state_accessor.cpp b/interface/common/resdb_state_accessor.cpp
index 9dbc847c..ec7033ea 100644
--- a/interface/common/resdb_state_accessor.cpp
+++ b/interface/common/resdb_state_accessor.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "interface/common/resdb_state_accessor.h"
@@ -41,8 +35,7 @@ std::unique_ptr<NetChannel> ResDBStateAccessor::GetNetChannel(
}
// Obtain ReplicaState of each replica.
-absl::StatusOr<std::vector<ReplicaState>>
-ResDBStateAccessor::GetReplicaStates() {
+absl::StatusOr<ReplicaState> ResDBStateAccessor::GetReplicaState() {
const auto& client_info = config_.GetReplicaInfos()[0];
Request request;
@@ -55,24 +48,12 @@ ResDBStateAccessor::GetReplicaStates() {
return absl::InternalError("send data fail.");
}
- std::unique_ptr<ReplicaState> state = std::make_unique<ReplicaState>();
- ret = client->RecvRawMessage(state.get());
+ ReplicaState state;
+ ret = client->RecvRawMessage(&state);
if (ret < 0) {
return absl::InternalError("recv data fail.");
}
- if (state == nullptr) {
- return absl::InternalError("recv data fail.");
- }
-
- std::vector<ReplicaState> resp;
- for (const auto& region : state->replica_config().region()) {
- for (const auto& info : region.replica_info()) {
- ReplicaState new_state;
- *new_state.mutable_replica_info() = info;
- resp.push_back(new_state);
- }
- }
- return resp;
+ return state;
}
} // namespace resdb
diff --git a/interface/common/resdb_state_accessor.h b/interface/common/resdb_state_accessor.h
index 8ce5dbed..8410547b 100644
--- a/interface/common/resdb_state_accessor.h
+++ b/interface/common/resdb_state_accessor.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
@@ -40,7 +34,7 @@ class ResDBStateAccessor {
virtual ~ResDBStateAccessor() = default;
// Obtain ReplicaState of each replica.
- absl::StatusOr<std::vector<ReplicaState>> GetReplicaStates();
+ absl::StatusOr<ReplicaState> GetReplicaState();
protected:
virtual std::unique_ptr<NetChannel> GetNetChannel(const std::string& ip,
diff --git a/interface/common/resdb_state_accessor_test.cpp b/interface/common/resdb_state_accessor_test.cpp
index 77e0954f..ad27ca5f 100644
--- a/interface/common/resdb_state_accessor_test.cpp
+++ b/interface/common/resdb_state_accessor_test.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "interface/common/resdb_state_accessor.h"
@@ -35,6 +29,7 @@ namespace resdb {
namespace {
using ::google::protobuf::util::MessageDifferencer;
+using ::resdb::testing::EqualsProto;
using ::testing::ElementsAre;
using ::testing::Invoke;
using ::testing::Test;
@@ -101,18 +96,9 @@ TEST_F(StateClientTest, GetAllReplicaState) {
}));
return client;
}));
- auto ret = client.GetReplicaStates();
+ auto ret = client.GetReplicaState();
EXPECT_TRUE(ret.ok());
- std::set<int> results;
- for (auto& state : *ret) {
- auto it = std::find_if(
- replicas_.begin(), replicas_.end(), [&](const ReplicaInfo& info) {
- return MessageDifferencer::Equals(info, state.replica_info());
- });
- EXPECT_TRUE(it != replicas_.end());
- results.insert(it - replicas_.begin());
- }
- EXPECT_EQ(results.size(), 4);
+ EXPECT_THAT(state, EqualsProto(*ret));
}
} // namespace
diff --git a/interface/common/resdb_txn_accessor.cpp b/interface/common/resdb_txn_accessor.cpp
index b6e4fb13..3b775191 100644
--- a/interface/common/resdb_txn_accessor.cpp
+++ b/interface/common/resdb_txn_accessor.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "interface/common/resdb_txn_accessor.h"
@@ -153,4 +147,45 @@ absl::StatusOr<std::vector<Request>> ResDBTxnAccessor::GetRequestFromReplica(
return txn_resp;
}
+absl::StatusOr<uint64_t> ResDBTxnAccessor::GetBlockNumbers() {
+ QueryRequest request;
+ request.set_min_seq(0);
+ request.set_max_seq(0);
+
+ std::vector<std::unique_ptr<NetChannel>> clients;
+ std::vector<std::thread> ths;
+ std::string final_str;
+ std::mutex mtx;
+ std::condition_variable resp_cv;
+ bool success = false;
+
+ std::unique_ptr<NetChannel> client =
+ GetNetChannel(replicas_[0].ip(), replicas_[0].port());
+
+ LOG(INFO) << "ip:" << replicas_[0].ip() << " port:" << replicas_[0].port();
+
+ std::string response_str;
+ int ret = 0;
+ for (int i = 0; i < 5; ++i) {
+ ret = client->SendRequest(request, Request::TYPE_QUERY);
+ if (ret) {
+ continue;
+ }
+ client->SetRecvTimeout(100000);
+ ret = client->RecvRawMessageStr(&response_str);
+ LOG(INFO) << "receive str:" << ret << " len:" << response_str.size();
+ if (ret != 0) {
+ continue;
+ }
+ break;
+ }
+
+ QueryResponse resp;
+ if (response_str.empty() || !resp.ParseFromString(response_str)) {
+ LOG(ERROR) << "parse fail len:" << final_str.size();
+ return absl::InternalError("recv data fail.");
+ }
+ return resp.max_seq();
+}
+
} // namespace resdb
diff --git a/interface/common/resdb_txn_accessor.h b/interface/common/resdb_txn_accessor.h
index 5aa1305b..6f1e1fd9 100644
--- a/interface/common/resdb_txn_accessor.h
+++ b/interface/common/resdb_txn_accessor.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
@@ -45,6 +39,7 @@ class ResDBTxnAccessor {
virtual absl::StatusOr<std::vector<Request>> GetRequestFromReplica(
uint64_t min_seq, uint64_t max_seq, const ReplicaInfo& replica);
+ virtual absl::StatusOr<uint64_t> GetBlockNumbers();
protected:
virtual std::unique_ptr<NetChannel> GetNetChannel(const std::string& ip,
diff --git a/interface/common/resdb_txn_accessor_test.cpp b/interface/common/resdb_txn_accessor_test.cpp
index f7832c2e..39c407bc 100644
--- a/interface/common/resdb_txn_accessor_test.cpp
+++ b/interface/common/resdb_txn_accessor_test.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "interface/common/resdb_txn_accessor.h"
@@ -38,6 +32,7 @@ namespace {
using ::resdb::testing::EqualsProto;
using ::testing::_;
+using ::testing::AtLeast;
using ::testing::ElementsAre;
using ::testing::Invoke;
using ::testing::Pointee;
@@ -67,9 +62,11 @@ TEST(ResDBTxnAccessorTest, GetTransactionsFail) {
auto client = std::make_unique<MockNetChannel>(ip, port);
EXPECT_CALL(*client,
SendRequest(EqualsProto(request), Request::TYPE_QUERY, _))
- .WillOnce(Return(0));
+ .Times(AtLeast(1))
+ .WillRepeatedly(Return(0));
EXPECT_CALL(*client, RecvRawMessageStr)
- .WillOnce(Invoke([&](std::string* resp) { return -1; }));
+ .Times(AtLeast(1))
+ .WillRepeatedly(Invoke([&](std::string* resp) { return -1; }));
return client;
}));
absl::StatusOr<std::vector<std::pair<uint64_t, std::string>>> resp =
diff --git a/interface/contract/BUILD b/interface/contract/BUILD
index f31924fb..f5223930 100644
--- a/interface/contract/BUILD
+++ b/interface/contract/BUILD
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
cc_library(
diff --git a/interface/contract/contract_client.cpp b/interface/contract/contract_client.cpp
index a2d944b9..2d8b2e98 100644
--- a/interface/contract/contract_client.cpp
+++ b/interface/contract/contract_client.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "interface/contract/contract_client.h"
diff --git a/interface/contract/contract_client.h b/interface/contract/contract_client.h
index 69e2d405..7b0c5aed 100644
--- a/interface/contract/contract_client.h
+++ b/interface/contract/contract_client.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/interface/kv/BUILD b/interface/kv/BUILD
index 2acf3636..e90fb9ef 100644
--- a/interface/kv/BUILD
+++ b/interface/kv/BUILD
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
cc_library(
diff --git a/interface/kv/kv_client.cpp b/interface/kv/kv_client.cpp
index e3a3e7e4..25526395 100644
--- a/interface/kv/kv_client.cpp
+++ b/interface/kv/kv_client.cpp
@@ -1,34 +1,26 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "interface/kv/kv_client.h"
#include <glog/logging.h>
-#include "proto/kv/kv.pb.h"
-
namespace resdb {
KVClient::KVClient(const ResDBConfig& config)
@@ -55,9 +47,9 @@ std::unique_ptr<std::string> KVClient::Get(const std::string& key) {
return std::make_unique<std::string>(response.value());
}
-std::unique_ptr<std::string> KVClient::GetValues() {
+std::unique_ptr<std::string> KVClient::GetAllValues() {
KVRequest request;
- request.set_cmd(KVRequest::GETVALUES);
+ request.set_cmd(KVRequest::GETALLVALUES);
KVResponse response;
int ret = SendRequest(request, &response);
if (ret != 0) {
@@ -82,4 +74,75 @@ std::unique_ptr<std::string> KVClient::GetRange(const std::string& min_key,
return std::make_unique<std::string>(response.value());
}
+int KVClient::Set(const std::string& key, const std::string& data,
+ int version) {
+ KVRequest request;
+ request.set_cmd(KVRequest::SET_WITH_VERSION);
+ request.set_key(key);
+ request.set_value(data);
+ request.set_version(version);
+ return SendRequest(request);
+}
+
+std::unique_ptr<ValueInfo> KVClient::Get(const std::string& key, int version) {
+ KVRequest request;
+ request.set_cmd(KVRequest::GET_WITH_VERSION);
+ request.set_key(key);
+ request.set_version(version);
+ KVResponse response;
+ int ret = SendRequest(request, &response);
+ if (ret != 0) {
+ LOG(ERROR) << "send request fail, ret:" << ret;
+ return nullptr;
+ }
+ return std::make_unique<ValueInfo>(response.value_info());
+}
+
+std::unique_ptr<Items> KVClient::GetKeyRange(const std::string& min_key,
+ const std::string& max_key) {
+ KVRequest request;
+ request.set_cmd(KVRequest::GET_KEY_RANGE);
+ request.set_min_key(min_key);
+ request.set_max_key(max_key);
+ KVResponse response;
+ int ret = SendRequest(request, &response);
+ if (ret != 0) {
+ LOG(ERROR) << "send request fail, ret:" << ret;
+ return nullptr;
+ }
+ return std::make_unique<Items>(response.items());
+}
+
+std::unique_ptr<Items> KVClient::GetKeyHistory(const std::string& key,
+ int min_version,
+ int max_version) {
+ KVRequest request;
+ request.set_cmd(KVRequest::GET_HISTORY);
+ request.set_key(key);
+ request.set_min_version(min_version);
+ request.set_max_version(max_version);
+ KVResponse response;
+ int ret = SendRequest(request, &response);
+ if (ret != 0) {
+ LOG(ERROR) << "send request fail, ret:" << ret;
+ return nullptr;
+ }
+ return std::make_unique<Items>(response.items());
+}
+
+std::unique_ptr<Items> KVClient::GetKeyTopHistory(const std::string& key,
+ int top_number) {
+ KVRequest request;
+ request.set_cmd(KVRequest::GET_TOP);
+ request.set_key(key);
+ request.set_top_number(top_number);
+ KVResponse response;
+ int ret = SendRequest(request, &response);
+ if (ret != 0) {
+ LOG(ERROR) << "send request fail, ret:" << ret;
+ return nullptr;
+ }
+ return std::make_unique<Items>(response.items());
+}
+
} // namespace resdb
diff --git a/interface/kv/kv_client.h b/interface/kv/kv_client.h
index 03724d38..52cbcab1 100644
--- a/interface/kv/kv_client.h
+++ b/interface/kv/kv_client.h
@@ -1,31 +1,26 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
#include "interface/rdbc/transaction_constructor.h"
+#include "proto/kv/kv.pb.h"
namespace resdb {
@@ -34,9 +29,36 @@ class KVClient : public TransactionConstructor {
public:
KVClient(const ResDBConfig& config);
+ // Version-based interfaces.
+ // Obtain the current version before setting a new data
+ int Set(const std::string& key, const std::string& data, int version);
+
+ // Obtain the value with a specific version.
+ // If the version parameter is zero, it will return the data with the current
+ // version in the database. ValueInfo contains the version and its version.
+ // Return nullptr if there is an error.
+ std::unique_ptr<ValueInfo> Get(const std::string& key, int version);
+
+ // Obtain the latest values of the keys within [min_key, max_key].
+ // Keys should be comparable.
+ std::unique_ptr<Items> GetKeyRange(const std::string& min_key,
+ const std::string& max_key);
+
+ // Obtain the histories of `key` with the versions in [min_version,
+ // max_version]
+ std::unique_ptr<Items> GetKeyHistory(const std::string& key, int min_version,
+ int max_version);
+
+ // Obtain the top `top_number` histories of the `key`.
+ std::unique_ptr<Items> GetKeyTopHistory(const std::string& key,
+ int top_number);
+
+ // Non-version-based Interfaces.
+ // These interfaces are not compatible with the version-based interfaces
+ // above.
int Set(const std::string& key, const std::string& data);
std::unique_ptr<std::string> Get(const std::string& key);
- std::unique_ptr<std::string> GetValues();
+ std::unique_ptr<std::string> GetAllValues();
std::unique_ptr<std::string> GetRange(const std::string& min_key,
const std::string& max_key);
};
diff --git a/interface/rdbc/BUILD b/interface/rdbc/BUILD
index b1137dbf..e51e677c 100644
--- a/interface/rdbc/BUILD
+++ b/interface/rdbc/BUILD
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
cc_library(
diff --git a/interface/rdbc/mock_net_channel.h b/interface/rdbc/mock_net_channel.h
index 39874da1..73785c22 100644
--- a/interface/rdbc/mock_net_channel.h
+++ b/interface/rdbc/mock_net_channel.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/interface/rdbc/mock_resdb_txn_accessor.h b/interface/rdbc/mock_resdb_txn_accessor.h
index 281c0510..f70fa9a3 100644
--- a/interface/rdbc/mock_resdb_txn_accessor.h
+++ b/interface/rdbc/mock_resdb_txn_accessor.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/interface/rdbc/net_channel.cpp b/interface/rdbc/net_channel.cpp
index c4999c4b..981b0af2 100644
--- a/interface/rdbc/net_channel.cpp
+++ b/interface/rdbc/net_channel.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "interface/rdbc/net_channel.h"
diff --git a/interface/rdbc/net_channel.h b/interface/rdbc/net_channel.h
index 53b1578e..d1baa692 100644
--- a/interface/rdbc/net_channel.h
+++ b/interface/rdbc/net_channel.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/interface/rdbc/net_channel_test.cpp b/interface/rdbc/net_channel_test.cpp
index 1ac81a02..a0da7675 100644
--- a/interface/rdbc/net_channel_test.cpp
+++ b/interface/rdbc/net_channel_test.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "interface/rdbc/net_channel.h"
diff --git a/interface/rdbc/transaction_constructor.cpp b/interface/rdbc/transaction_constructor.cpp
index f7143348..be42224a 100644
--- a/interface/rdbc/transaction_constructor.cpp
+++ b/interface/rdbc/transaction_constructor.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "interface/rdbc/transaction_constructor.h"
diff --git a/interface/rdbc/transaction_constructor.h b/interface/rdbc/transaction_constructor.h
index c305badf..39754a84 100644
--- a/interface/rdbc/transaction_constructor.h
+++ b/interface/rdbc/transaction_constructor.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/interface/rdbc/transaction_constructor_test.cpp b/interface/rdbc/transaction_constructor_test.cpp
index 1dda2a89..cd00646d 100644
--- a/interface/rdbc/transaction_constructor_test.cpp
+++ b/interface/rdbc/transaction_constructor_test.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "interface/rdbc/transaction_constructor.h"
diff --git a/interface/utxo/BUILD b/interface/utxo/BUILD
index 7079e644..b47bb997 100644
--- a/interface/utxo/BUILD
+++ b/interface/utxo/BUILD
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
package(default_visibility = ["//visibility:public"])
cc_library(
diff --git a/interface/utxo/utxo_client.cpp b/interface/utxo/utxo_client.cpp
index fa68656a..8ed006f1 100644
--- a/interface/utxo/utxo_client.cpp
+++ b/interface/utxo/utxo_client.cpp
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#include "interface/utxo/utxo_client.h"
diff --git a/interface/utxo/utxo_client.h b/interface/utxo/utxo_client.h
index b4217545..9cf0d8fc 100644
--- a/interface/utxo/utxo_client.h
+++ b/interface/utxo/utxo_client.h
@@ -1,26 +1,20 @@
/*
- * Copyright (c) 2019-2022 ExpoLab, UC Davis
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
#pragma once
diff --git a/monitoring/README.md b/monitoring/README.md
index 2e8c4cc9..ddd42572 100644
--- a/monitoring/README.md
+++ b/monitoring/README.md
@@ -1,3 +1,22 @@
+<!--
+ - Licensed to the Apache Software Foundation (ASF) under one
+ - or more contributor license agreements. See the NOTICE file
+ - distributed with this work for additional information
+ - regarding copyright ownership. The ASF licenses this file
+ - to you under the Apache License, Version 2.0 (the
+ - "License"); you may not use this file except in compliance
+ - with the License. You may obtain a copy of the License at
+ -
+ - http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing,
+ - software distributed under the License is distributed on an
+ - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ - KIND, either express or implied. See the License for the
+ - specific language governing permissions and limitations
+ - under the License.
+ -->
+
# Download Prometheus
wget https://github.com/prometheus/prometheus/releases/download/v2.47.0/prometheus-2.47.0.linux-amd64.tar.gz
tar xvf prometheus-2.47.0.linux-amd64.tar.gz
diff --git a/monitoring/prometheus/prometheus.yml b/monitoring/prometheus/prometheus.yml
index c0046d38..39c18fcf 100644
--- a/monitoring/prometheus/prometheus.yml
+++ b/monitoring/prometheus/prometheus.yml
@@ -1,3 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
@@ -25,19 +44,19 @@ scrape_configs:
- targets: ["localhost:9090"]
- job_name: "node_exporter1"
static_configs:
- - targets: ["172.31.52.247:9100"]
... 25011 lines suppressed ...