├── .clang-format ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── README.md ├── cmake └── GRPCGenerateCPP.cmake ├── configs ├── 2host_config.xml └── exporter_example_config.xml ├── exporter └── HttpTaskExporter.java ├── protos ├── CMakeLists.txt ├── dbos_status.proto ├── frontend.proto ├── ipc_bench.proto └── scheduler.proto ├── scripts ├── benchmark │ ├── run_fifotask_fraction.sh │ ├── run_grpc_bench.sh │ ├── run_scantask_scale.sh │ ├── run_synthetic_index.sh │ ├── run_synthetic_partitions.sh │ └── run_synthetic_scale.sh ├── create_tables.sh ├── initialize_voltdb.sh ├── initialize_voltdb_httpexport.sh ├── install_cmake.sh ├── install_grpc.sh ├── install_openssl.sh ├── install_protobuf.sh ├── install_voltdb.sh ├── install_voltdb_cpp_client.sh └── update_voltdb_procedures.sh ├── sql ├── BroadcastMessage.java ├── FinishWorkerTask.java ├── InsertSparkWorker.java ├── InsertTask.java ├── InsertWorker.java ├── PushTask.java ├── ReceiveMessage.java ├── ScanPartitionedTaskWorker.java ├── ScanTaskWorker.java ├── SelectDataShardPartition.java ├── SelectOrderedWorker.java ├── SelectPartitionedTaskWorker.java ├── SelectSinglePartitionedTaskWorker.java ├── SelectSparkWorker.java ├── SelectTaskWorker.java ├── SelectWorker.java ├── SendMessage.java ├── TruncateTaskTable.java ├── TruncateWorkerTable.java ├── WorkerSelectTask.java ├── WorkerUpdateTask.java ├── create_broadcast_table.sql ├── create_data_table.sql ├── create_message_table.sql ├── create_task_stream.sql ├── create_task_table.sql ├── create_worker_table.sql └── load_procedures.sql ├── src ├── CMakeLists.txt ├── libs │ ├── CMakeLists.txt │ ├── lib_scheduler │ │ ├── CMakeLists.txt │ │ ├── PartitionedFIFOScheduler.cc │ │ ├── PartitionedFIFOScheduler.h │ │ ├── PartitionedFIFOTaskScheduler.cc │ │ ├── PartitionedFIFOTaskScheduler.h │ │ ├── PartitionedLocalFIFOScheduler.cc │ │ ├── PartitionedLocalFIFOScheduler.h │ │ ├── PartitionedScanTask.cc │ │ ├── PartitionedScanTask.h │ │ ├── PushFIFOScheduler.cc │ │ ├── PushFIFOScheduler.h │ │ ├── SchedulerServer.cpp │ │ ├── SchedulerServer.h │ │ ├── SinglePartitionedFIFOTaskScheduler.cc │ │ ├── SinglePartitionedFIFOTaskScheduler.h │ │ ├── SparkScheduler.cc │ │ ├── SparkScheduler.h │ │ ├── Task.h │ │ ├── VoltdbSchedulerUtil.cc │ │ └── VoltdbSchedulerUtil.h │ ├── lib_util │ │ ├── BenchmarkUtil.cc │ │ ├── BenchmarkUtil.h │ │ ├── CMakeLists.txt │ │ ├── DbosDefs.h │ │ └── RandomGenerator.h │ └── lib_worker │ │ ├── CMakeLists.txt │ │ ├── Executor.cc │ │ ├── Executor.h │ │ ├── MockExecutor.cc │ │ ├── MockExecutor.h │ │ ├── MockGRPCWorker.cc │ │ ├── MockGRPCWorker.h │ │ ├── MockHTTPWorker.cc │ │ ├── MockHTTPWorker.h │ │ ├── MockPollWorker.cc │ │ ├── MockPollWorker.h │ │ ├── WorkerManager.cc │ │ ├── WorkerManager.h │ │ └── httpserver.h └── simulation │ ├── AsyncSyntheticScheduler.cc │ ├── CMakeLists.txt │ ├── CommunicationBench.cc │ ├── DBCommBenchClient.cc │ ├── DBCommBenchServer.cc │ ├── GrpcBenchClient.cc │ ├── GrpcBenchServer.cc │ ├── LoadGenerator.cc │ ├── SyntheticScheduler.cc │ ├── SyntheticWorker.cc │ ├── TCPBenchClient.cc │ ├── TCPBenchServer.cc │ ├── TestPartitionedFIFOScheduler.cc │ ├── TestPartitionedScanTask.cc │ └── TestSparkScheduler.cc └── third_party └── voltdb-client-cpp ├── include ├── AuthenticationRequest.hpp ├── AuthenticationResponse.hpp ├── ByteBuffer.hpp ├── Client.h ├── ClientConfig.h ├── ClientImpl.h ├── ClientLogger.h ├── Column.hpp ├── ConnectionPool.h ├── Decimal.hpp ├── Distributer.h ├── ElasticHashinator.h ├── Exception.hpp ├── Geography.hpp ├── GeographyPoint.hpp ├── InvocationResponse.hpp ├── MurmurHash3.h ├── Parameter.hpp ├── ParameterSet.hpp ├── Procedure.hpp ├── ProcedureCallback.hpp ├── Row.hpp ├── RowBuilder.h ├── StatusListener.h ├── Table.h ├── TableIterator.h ├── TheHashinator.h ├── WireType.h ├── event2 │ ├── buffer.h │ ├── buffer_compat.h │ ├── bufferevent.h │ ├── bufferevent_compat.h │ ├── bufferevent_ssl.h │ ├── bufferevent_struct.h │ ├── dns.h │ ├── dns_compat.h │ ├── dns_struct.h │ ├── event-config.h │ ├── event.h │ ├── event_compat.h │ ├── event_struct.h │ ├── http.h │ ├── http_compat.h │ ├── http_struct.h │ ├── keyvalq_struct.h │ ├── listener.h │ ├── rpc.h │ ├── rpc_compat.h │ ├── rpc_struct.h │ ├── tag.h │ ├── tag_compat.h │ ├── thread.h │ ├── util.h │ └── visibility.h ├── openssl │ ├── aes.h │ ├── asn1.h │ ├── asn1_mac.h │ ├── asn1t.h │ ├── bio.h │ ├── blowfish.h │ ├── bn.h │ ├── buffer.h │ ├── camellia.h │ ├── cast.h │ ├── cmac.h │ ├── cms.h │ ├── comp.h │ ├── conf.h │ ├── conf_api.h │ ├── crypto.h │ ├── des.h │ ├── des_old.h │ ├── dh.h │ ├── dsa.h │ ├── dso.h │ ├── dtls1.h │ ├── e_os2.h │ ├── ebcdic.h │ ├── ec.h │ ├── ecdh.h │ ├── ecdsa.h │ ├── engine.h │ ├── err.h │ ├── evp.h │ ├── hmac.h │ ├── idea.h │ ├── krb5_asn.h │ ├── kssl.h │ ├── lhash.h │ ├── md4.h │ ├── md5.h │ ├── mdc2.h │ ├── modes.h │ ├── obj_mac.h │ ├── objects.h │ ├── ocsp.h │ ├── opensslconf.h │ ├── opensslv.h │ ├── ossl_typ.h │ ├── pem.h │ ├── pem2.h │ ├── pkcs12.h │ ├── pkcs7.h │ ├── pqueue.h │ ├── rand.h │ ├── rc2.h │ ├── rc4.h │ ├── ripemd.h │ ├── rsa.h │ ├── safestack.h │ ├── seed.h │ ├── sha.h │ ├── srp.h │ ├── srtp.h │ ├── ssl.h │ ├── ssl2.h │ ├── ssl23.h │ ├── ssl3.h │ ├── stack.h │ ├── symhacks.h │ ├── tls1.h │ ├── ts.h │ ├── txt_db.h │ ├── ui.h │ ├── ui_compat.h │ ├── whrlpool.h │ ├── x509.h │ ├── x509_vfy.h │ └── x509v3.h └── ttmath │ ├── COPYRIGHT │ ├── ttmath.h │ ├── ttmathbig.h │ ├── ttmathint.h │ ├── ttmathmisc.h │ ├── ttmathobjects.h │ ├── ttmathparser.h │ ├── ttmaththreads.h │ ├── ttmathtypes.h │ ├── ttmathuint.h │ ├── ttmathuint_noasm.h │ ├── ttmathuint_x86.h │ ├── ttmathuint_x86_64.h │ └── ttmathuint_x86_64_msvc.asm └── lib ├── libcrypto.a ├── libevent.a ├── libevent_openssl.a ├── libevent_pthreads.a ├── libssl.a └── libvoltdbcpp.a /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: Google 3 | IndentWidth: 2 4 | IndentCaseLabels: true 5 | AccessModifierOffset: -2 6 | AllowShortBlocksOnASingleLine: true 7 | AllowShortIfStatementsOnASingleLine: true 8 | AllowShortLoopsOnASingleLine: true 9 | --- 10 | Language: Cpp 11 | # Force pointers to the type for C++. 12 | DerivePointerAlignment: false 13 | PointerAlignment: Left 14 | AlwaysBreakAfterReturnType: None 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/*.log 2 | scripts/temp/** 3 | **/build*/ 4 | *.swp 5 | *.DS_Store 6 | # Prerequisites 7 | *.d 8 | .vscode 9 | **/obj*/ 10 | **/log*/ 11 | *.csv 12 | .idea/ 13 | cmake-build-debug 14 | 15 | # Compiled Object files 16 | *.slo 17 | *.lo 18 | *.o 19 | *.obj 20 | 21 | # Precompiled Headers 22 | *.gch 23 | *.pch 24 | 25 | # Compiled Dynamic libraries 26 | *.so 27 | *.dylib 28 | *.dll 29 | 30 | # Fortran module files 31 | *.mod 32 | *.smod 33 | 34 | # Compiled Static libraries 35 | *.lai 36 | *.la 37 | *.a 38 | !third_party/** 39 | *.lib 40 | 41 | # Executables 42 | *.exe 43 | *.out 44 | *.app 45 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "third_party/grpc"] 2 | path = third_party/grpc 3 | url = https://github.com/grpc/grpc 4 | [submodule "third_party/protobuf"] 5 | path = third_party/protobuf 6 | url = https://github.com/protocolbuffers/protobuf 7 | [submodule "third_party/openssl"] 8 | path = third_party/openssl 9 | url = https://github.com/openssl/openssl 10 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | message(STATUS "Using CMake version ${CMAKE_VERSION}") 3 | project(dbos-scheduler) 4 | 5 | set(CMAKE_VERBOSE_MAKEFILE ON) 6 | set(CMAKE_COLOR_MAKEFILE ON) 7 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) 8 | 9 | # Additional CMake files path 10 | list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) 11 | 12 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 13 | set(gRPC_SSL_PROVIDER "package" CACHE STRING "") 14 | 15 | # NOTE: change this path or comment it out if openssl is installed at a different path. 16 | set(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/openssl/install" CACHE STRING "") 17 | set(OPENSSL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/openssl/install/include" CACHE STRING "") 18 | find_package(OpenSSL REQUIRED) 19 | 20 | # Find gRPC installation 21 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/grpc ${CMAKE_CURRENT_BINARY_DIR}/grpc EXCLUDE_FROM_ALL) 22 | message(STATUS "Using gRPC via add_subdirectory.") 23 | set(_PROTOBUF_LIBPROTOBUF libprotobuf) 24 | set(_REFLECTION grpc++_reflection) 25 | set(_GRPC_GRPCPP grpc++) 26 | set(_GRPC_CPP_PLUGIN_EXECUTABLE $) 27 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/grpc/include) 28 | 29 | # Find protobuf installation 30 | list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/third_party/protobuf/cmake/install/) 31 | INCLUDE(FindProtobuf) 32 | find_package(Protobuf CONFIG REQUIRED) 33 | find_program(Protobuf_PROTOC_EXECUTABLE protoc) 34 | include_directories(${PROTOBUF_INCLUDE_DIRS}) 35 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) 36 | 37 | # Targets 38 | add_subdirectory(protos) 39 | add_subdirectory(src) 40 | 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 DBOS-project 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dbos-scheduler 2 | 3 | ## Pre-requisite 4 | Install cmake (at least version 3.5.1): 5 | ``` 6 | sudo apt-get install cmake 7 | ``` 8 | 9 | For VoltDB C++ client: 10 | Install Boost C++ Library 1.53 if using the downloaded client library. 11 | If building from source, you may use 1.53 or above. 12 | ``` 13 | sudo apt-get install libboost-all-dev 14 | ``` 15 | 16 | Install VoltDB: 17 | ``` 18 | ./scripts/install_voltdb.sh INSTALLATION_PATH 19 | ``` 20 | For example: `./install_voltdb.sh /home/`. Then VoltDB will be installed under `/home/voltdb` 21 | 22 | (Optional for now) Install CMake-3.17 23 | ``` 24 | ./scripts/install_cmake.sh 25 | ``` 26 | 27 | ## Init and update submodules 28 | Pull remote grpc and protobuf codebase as third party dependency. 29 | ``` 30 | git submodule update --init --recursive --progress 31 | ``` 32 | 33 | Then build protobuf: 34 | ``` 35 | cd third_party/protobuf 36 | mkdir -p ./cmake/build 37 | mkdir -p ./cmake/install 38 | cd cmake/build 39 | cmake -DCMAKE_INSTALL_PREFIX=${PWD}/../install .. 40 | make -j40 41 | make install 42 | ``` 43 | 44 | Then build openssl: 45 | ``` 46 | cd third_party/openssl 47 | mkdir -p ./install 48 | ./config --prefix=${PWD}/install 49 | make -j40 50 | make install 51 | ``` 52 | 53 | ## Build DBOS scheduler 54 | ``` 55 | mkdir build/ 56 | cd build/ 57 | cmake .. 58 | make -j8 59 | ``` 60 | 61 | (Optional for now) If you would like to build with gRPC: 62 | ``` 63 | cmake .. -DBUILD_WITH_GRPC=ON 64 | make -j8 65 | ``` 66 | 67 | ## Initialize VoltDB and load Stored Procedures 68 | Note that you will need to export "$VOLT_HOME" variable to the VoltDB installation path. 69 | For example `export VOLT_HOME=/home/voltdb`. 70 | 71 | Then you could initialize the tables and procedures: 72 | ``` 73 | ./scripts/initialize_voltdb.sh 74 | ``` 75 | 76 | ## Shutdown VoltDB 77 | On a single node cluster, run: 78 | ``` 79 | voltadmin shutdown 80 | ``` 81 | 82 | ## Initialize a cluster of DB 83 | ``` 84 | First, follow the instruction in shared_scripts to init and start a cluster. 85 | Then, on one of the host node, run 86 | ./scripts/create_tables.sh 87 | ./scripts/update_voltdb_procedures.sh 88 | ``` 89 | TODO: figure out a way to automate the process. For now, we need to manually 90 | start the cluster because `$TMPDIR` is only available inside a slurm session. 91 | -------------------------------------------------------------------------------- /cmake/GRPCGenerateCPP.cmake: -------------------------------------------------------------------------------- 1 | # Origin: https://raw.githubusercontent.com/NVIDIA/yais/master/cmake/GRPCGenerateCPP.cmake 2 | #find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin) # Get full path to plugin 3 | set(GRPC_CPP_PLUGIN $) # TODO: Need double check this, when TARGET_FILE is set? 4 | #set(GRPC_CPP_PLUGIN ${CMAKE_BINARY_DIR}/grpc/grpc_cpp_plugin) 5 | 6 | function(PROTOBUF_GENERATE_GRPC_CPP SRCS HDRS) 7 | cmake_parse_arguments(protobuf "" "EXPORT_MACRO;DESCRIPTORS" "" ${ARGN}) 8 | 9 | set(PROTO_FILES "${protobuf_UNPARSED_ARGUMENTS}") 10 | if(NOT PROTO_FILES) 11 | message(SEND_ERROR "Error: PROTOBUF_GENERATE_GRPC_CPP() called without any proto files") 12 | return() 13 | endif() 14 | 15 | if(PROTOBUF_GENERATE_CPP_APPEND_PATH) # This variable is common for all types of output. 16 | # Create an include path for each file specified 17 | foreach(FIL ${PROTO_FILES}) 18 | get_filename_component(ABS_FIL ${FIL} ABSOLUTE) 19 | get_filename_component(ABS_PATH ${ABS_FIL} PATH) 20 | list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) 21 | if(${_contains_already} EQUAL -1) 22 | list(APPEND _protobuf_include_path -I ${ABS_PATH}) 23 | endif() 24 | endforeach() 25 | else() 26 | set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) 27 | endif() 28 | 29 | if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) 30 | set(Protobuf_IMPORT_DIR "${PROTOBUF_IMPORT_DIRS") 31 | endif() 32 | 33 | if(DEFINED Protobuf_IMPORT_DIRS) 34 | foreach(DIR ${Protobuf_IMPORT_DIRS}) 35 | get_filename_component(ABS_PATH ${DIR} ABSOLUTE) 36 | list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) 37 | if(${_contains_already} EQUAL -1) 38 | list(APPEND _protobuf_include_path -I ${ABS_PATH}) 39 | endif() 40 | endforeach() 41 | endif() 42 | 43 | set(${SRCS}) 44 | set(${HDRS}) 45 | foreach(FIL ${PROTO_FILES}) 46 | get_filename_component(ABS_FIL ${FIL} ABSOLUTE) 47 | get_filename_component(FIL_WE ${FIL} NAME_WE) 48 | 49 | if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH) 50 | get_filename_component(FIL_DIR ${FIL} DIRECTORY) 51 | if(FIL_DIR) 52 | set(FIL_WE "${FIL_DIR}/${FIL_WE}") 53 | endif() 54 | endif() 55 | 56 | set(_protobuf_grpc_src "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.grpc.pb.cc") 57 | set(_protobuf_grpc_hdr "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.grpc.pb.h") 58 | list(APPEND ${SRCS} "${_protobuf_grpc_src}") 59 | list(APPEND ${HDRS} "${_protobuf_grpc_hdr}") 60 | 61 | add_custom_command( 62 | OUTPUT "${_protobuf_grpc_src}" 63 | "${_protobuf_grpc_hdr}" 64 | COMMAND ${Protobuf_PROTOC_EXECUTABLE} 65 | --grpc_out=${CMAKE_CURRENT_BINARY_DIR} 66 | --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} 67 | ${_protobuf_include_path} ${ABS_FIL} 68 | DEPENDS ${ABS_FIL} ${Protobuf_PROTOC_EXECUTABLE} 69 | COMMENT "Running gRPC C++ protocol buffer compiler on ${FIL}" 70 | VERBATIM) 71 | endforeach() 72 | 73 | set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) 74 | set(${SRCS} ${${SRCS}} PARENT_SCOPE) 75 | set(${HDRS} ${${HDRS}} PARENT_SCOPE) 76 | endfunction() 77 | -------------------------------------------------------------------------------- /configs/2host_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /configs/exporter_example_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | false 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /exporter/HttpTaskExporter.java: -------------------------------------------------------------------------------- 1 | package dbos.voltdb.exportclient; 2 | 3 | import java.io.*; 4 | 5 | import java.net.URL; 6 | import java.net.HttpURLConnection; 7 | import java.util.Properties; 8 | 9 | import org.voltdb.VoltType; 10 | 11 | import org.voltcore.logging.VoltLogger; 12 | 13 | import org.voltdb.client.Client; 14 | import org.voltdb.client.ClientImpl; 15 | import org.voltdb.export.AdvertisedDataSource; 16 | import org.voltdb.exportclient.ExportRow; 17 | import org.voltdb.exportclient.ExportClientBase; 18 | import org.voltdb.exportclient.ExportDecoderBase; 19 | 20 | public class HttpTaskExporter extends ExportClientBase { 21 | private static final VoltLogger m_logger = new VoltLogger("ExportClient"); 22 | 23 | @Override 24 | public void configure(Properties config) throws Exception 25 | { 26 | m_logger.debug("Configuring HttpTaskExporter"); 27 | //no-op 28 | } 29 | 30 | @Override 31 | public ExportDecoderBase constructExportDecoder(AdvertisedDataSource source) 32 | { 33 | HttpTaskDecoder dec = new HttpTaskDecoder(source); 34 | return dec; 35 | } 36 | 37 | class HttpTaskDecoder extends ExportDecoderBase { 38 | 39 | public HttpTaskDecoder(AdvertisedDataSource source) 40 | { 41 | super(source); 42 | m_logger.debug("HttpTaskDecoder"); 43 | } 44 | 45 | @Override 46 | public void sourceNoLongerAdvertised(AdvertisedDataSource source) 47 | { 48 | m_logger.debug("sourceNoLongerAdvertised"); 49 | } 50 | 51 | @Override 52 | public void onBlockStart(ExportRow row) throws RestartBlockException 53 | { 54 | m_logger.debug("onBlockStart"); 55 | } 56 | 57 | @Override 58 | public void onBlockCompletion(ExportRow row) throws RestartBlockException 59 | { 60 | m_logger.debug("onBlockCompletion"); 61 | } 62 | 63 | @Override 64 | public boolean processRow(ExportRow row) throws RestartBlockException 65 | { 66 | m_logger.debug("processRow"); 67 | try { 68 | String url = ""; 69 | int taskID = 0; 70 | for (int i =0; i < row.values.length; i++) { 71 | String column_name = row.names.get(i); 72 | switch (column_name) { 73 | case "TASKID": 74 | taskID = (int) row.values[i]; 75 | break; 76 | case "URL": 77 | url = (String) row.values[i]; 78 | break; 79 | default: 80 | break; 81 | } 82 | } 83 | URL urlObj = new URL(url); 84 | HttpURLConnection httpCon = (HttpURLConnection) urlObj.openConnection(); 85 | httpCon.setRequestProperty("taskID", String.valueOf(taskID)); 86 | 87 | int responseCode = httpCon.getResponseCode(); 88 | if (responseCode != HttpURLConnection.HTTP_OK) { 89 | m_logger.error("Not OK HTTP Response code"); 90 | return false; 91 | } 92 | } catch (Exception e) { 93 | m_logger.error("Exception during HTTP", e); 94 | return false; 95 | } 96 | return true; 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /protos/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "Building DBOS scheduler protos") 2 | 3 | INCLUDE(GRPCGenerateCPP) 4 | 5 | PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS 6 | dbos_status.proto 7 | frontend.proto 8 | scheduler.proto 9 | ipc_bench.proto 10 | ) 11 | 12 | PROTOBUF_GENERATE_GRPC_CPP(PROTO_GRPC_SRCS PROTO_GRPC_HDRS 13 | frontend.proto 14 | scheduler.proto 15 | ipc_bench.proto 16 | ) 17 | 18 | add_library(dbos-scheduler-protos 19 | ${PROTO_SRCS} 20 | ${PROTO_GRPC_SRCS} 21 | ) 22 | 23 | target_include_directories(dbos-scheduler-protos PUBLIC 24 | ${CMAKE_CURRENT_BINARY_DIR} 25 | ) 26 | 27 | # For IPC benchmark. 28 | PROTOBUF_GENERATE_CPP(IPC_SRCS IPC_HDRS 29 | ipc_bench.proto 30 | ) 31 | 32 | PROTOBUF_GENERATE_GRPC_CPP(IPC_GRPC_SRCS IPC_GRPC_HDRS 33 | ipc_bench.proto 34 | ) 35 | 36 | add_library(ipcbench-protos 37 | ${IPC_SRCS} 38 | ${IPC_GRPC_SRCS} 39 | ) 40 | 41 | target_include_directories(ipcbench-protos PUBLIC 42 | ${CMAKE_CURRENT_BINARY_DIR} 43 | ) 44 | 45 | -------------------------------------------------------------------------------- /protos/dbos_status.proto: -------------------------------------------------------------------------------- 1 | // Define enum message type here 2 | 3 | syntax = "proto3"; 4 | 5 | package dbos_scheduler; 6 | 7 | // Request status enums 8 | enum DbosStatusEnum { 9 | INVALID = 0; 10 | SUCCESS = 1; 11 | UNAVAILABLE = 2; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /protos/frontend.proto: -------------------------------------------------------------------------------- 1 | // API for DBOS components 2 | // Interface between client and scheduler 3 | 4 | syntax = "proto3"; 5 | 6 | package dbos_scheduler; 7 | 8 | import "dbos_status.proto"; 9 | 10 | // TODO: need to discuss the interface design; subject to changes. 11 | service Frontend { 12 | // Client sends a task to the scheduler. 13 | rpc SubmitTask(SubmitTaskRequest) returns (SubmitTaskResponse) {} 14 | } 15 | 16 | // Message types for Frontend 17 | message SubmitTaskRequest { 18 | int64 targetdata = 1; // resource requirement. 19 | int64 exectime = 2; // execution time in nanoseconds. 20 | } 21 | 22 | message SubmitTaskResponse { 23 | DbosStatusEnum status = 1; 24 | } 25 | -------------------------------------------------------------------------------- /protos/ipc_bench.proto: -------------------------------------------------------------------------------- 1 | // For IPC benchmark 2 | 3 | syntax = "proto3"; 4 | 5 | package ipcbench; 6 | 7 | service IpcBench { 8 | // Ping-pong string text between client and server. 9 | rpc PingPong(StringMsg) returns (StringMsg); 10 | 11 | // For the broadcast test. 12 | rpc Broadcast(StringMsg) returns (AckMsg); 13 | 14 | // For ping^n-pong^n test. Send multiple outstanding ping-pong requests. 15 | // The server would reply until receiving a batch of input. 16 | // The senderId field will be used to store a "numMessages" value. 17 | rpc StreamPingPong(stream StringMsg) returns (stream StringMsg); 18 | } 19 | 20 | message StringMsg { 21 | int32 senderId = 1; 22 | string msg = 2; 23 | } 24 | 25 | message AckMsg { 26 | bool ack = 1; 27 | } 28 | -------------------------------------------------------------------------------- /protos/scheduler.proto: -------------------------------------------------------------------------------- 1 | // API for DBOS components 2 | // Interface between scheduler and worker 3 | 4 | syntax = "proto3"; 5 | 6 | package dbos_scheduler; 7 | 8 | import "dbos_status.proto"; 9 | 10 | // TODO: need to discuss the interface design; subject to changes. 11 | service Schedule { 12 | // Scheduler notifies worker a task. 13 | rpc NotifyTask(NotifyTaskRequest) returns (NotifyTaskResponse) {} 14 | 15 | // Heartbeat to a worker. 16 | rpc Heartbeat(HeartbeatRequest) returns (HeartbeatResponse) {} 17 | } 18 | 19 | // Message types for Schedule 20 | message NotifyTaskRequest { 21 | string taskId = 1; // The variable length task id. 22 | } 23 | 24 | message NotifyTaskResponse { 25 | DbosStatusEnum status = 1; 26 | } 27 | 28 | message HeartbeatRequest { 29 | string msg = 1; 30 | } 31 | 32 | message HeartbeatResponse { 33 | DbosStatusEnum status = 1; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /scripts/benchmark/run_fifotask_fraction.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | SCRIPT_DIR=$(dirname $(readlink -f $0)) 5 | 6 | cd $SCRIPT_DIR 7 | mkdir -p runlogs/ 8 | 9 | declare -a PROBS=("0.0" "0.0001" "0.001" "0.01" "0.1" "0.2" "0.5" "0.8" "1.0") 10 | P=40 11 | W=40 12 | N=100 13 | T=40 14 | 15 | for prob in "${PROBS[@]}"; do 16 | OUTLOG="runlogs/syn-N${N}-W${W}-P${P}-T${T}-prob${prob}.csv" 17 | ${SCRIPT_DIR}/../../build/bin/SyntheticScheduler -i 5000 -t 15000 -o $OUTLOG \ 18 | -N $N -W $W -P $P -T $T -A fifo-task -p ${prob} 19 | done 20 | -------------------------------------------------------------------------------- /scripts/benchmark/run_grpc_bench.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | SCRIPT_DIR=$(dirname $(readlink -f $0)) 5 | 6 | cd $SCRIPT_DIR 7 | 8 | # First, start the gRPC server on the remote machine. 9 | # ./bin/GrpcBenchServer -N 10 | 11 | # Then, run this script and provide server name. 12 | SERVER="localhost" 13 | 14 | if [[ $# -eq 1 ]]; then 15 | SERVER="$1" 16 | fi 17 | 18 | 19 | # For ping-ping-pong-pong 20 | LOGFILE="grpc_pingpong_stream.log" 21 | declare -a msgsizes=(64 1024 8192) 22 | 23 | # Outstanding messages. 24 | declare -a outmsgs=(1 5 10 20 50 100) 25 | 26 | # Number of receivers 27 | declare -a numrecvs=(1 10) 28 | 29 | for numrecv in "${numrecvs[@]}"; do 30 | echo "================= Running $numrecv receiver(s) =================" | tee -a ${LOGFILE} 31 | for msgsize in "${msgsizes[@]}"; do 32 | echo "================= Running msgsize ${msgsize} =================" | tee -a ${LOGFILE} 33 | for outmsg in "${outmsgs[@]}"; do 34 | # Run streaming. 35 | ${SCRIPT_DIR}/../../build/bin/GrpcBenchClient -N ${numrecv} -s ${SERVER} -m ${msgsize} -M ${outmsg} -S 2>&1 | tee -a ${LOGFILE} 36 | 37 | # Cool down a bit. 38 | sleep 5 39 | done 40 | done 41 | done 42 | 43 | 44 | # For broadcast. 45 | LOGFILE="grpc_broadcast.log" 46 | #declare -a msgsizes=(64 1024 8192) 47 | declare -a msgsizes=(64) 48 | 49 | # Number of receivers 50 | declare -a numrecvs=(1 5 10 20 40) 51 | 52 | for msgsize in "${msgsizes[@]}"; do 53 | echo "================= Running msgsize ${msgsize} =================" | tee -a ${LOGFILE} 54 | for numrecv in "${numrecvs[@]}"; do 55 | ${SCRIPT_DIR}/../../build/bin/GrpcBenchClient -b -R ${numrecv} -s ${SERVER} -m ${msgsize} -M 1 2>&1 | tee -a ${LOGFILE} 56 | 57 | # Cool down a bit. 58 | sleep 5 59 | done 60 | done 61 | 62 | -------------------------------------------------------------------------------- /scripts/benchmark/run_scantask_scale.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | SCRIPT_DIR=$(dirname $(readlink -f $0)) 5 | 6 | cd $SCRIPT_DIR 7 | mkdir -p runlogs/ 8 | 9 | declare -a TASKS=(1 10 100 1000 10000 100000) 10 | P=1 11 | W=16 12 | N=8 13 | 14 | for T in "${TASKS[@]}"; do 15 | OUTLOG="runlogs/scan-N${N}-W${W}-P${P}-T${T}.csv" 16 | ${SCRIPT_DIR}/../../build/bin/SyntheticScheduler -i 5000 -t 15000 -o $OUTLOG \ 17 | -N $N -W $W -P $P -T $T -p 0.0 -A scan-task 18 | done 19 | 20 | N=100 21 | P=40 22 | T=10000 23 | p="1.0" # change to 0.0 for single-partition test 24 | 25 | declare -a WORKERS=(1 20 40 60 80 100) 26 | for W in "${WORKERS[@]}"; do 27 | OUTLOG="runlogs/scan-N${N}-W${W}-P${P}-T${T}-prob${p}.csv" 28 | ${SCRIPT_DIR}/../../build/bin/SyntheticScheduler -i 5000 -t 15000 -o $OUTLOG \ 29 | -N $N -W $W -P $P -T $T -p $p -A scan-task 30 | done 31 | 32 | 33 | -------------------------------------------------------------------------------- /scripts/benchmark/run_synthetic_index.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | SCRIPT_DIR=$(dirname $(readlink -f $0)) 5 | 6 | cd $SCRIPT_DIR 7 | mkdir -p runlogs/ 8 | 9 | P=1 10 | N=8 11 | 12 | declare -a WORKERS=(1 10 100 1000 10000 100000) 13 | declare -a CAPACITIES=(2000000 200000 20000 2000 200 20) 14 | 15 | for i in {0..5}; do 16 | W=${WORKERS[$i]} 17 | C=${CAPACITIES[$i]} 18 | OUTLOG="runlogs/syn-N${N}-W${W}-C${C}-P${P}-index.csv" 19 | ${SCRIPT_DIR}/../../build/bin/SyntheticScheduler -i 5000 -t 15000 -o ${OUTLOG} \ 20 | -N $N -W ${W} -C ${C} -P ${P} 21 | done 22 | -------------------------------------------------------------------------------- /scripts/benchmark/run_synthetic_partitions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | SCRIPT_DIR=$(dirname $(readlink -f $0)) 5 | 6 | cd $SCRIPT_DIR 7 | mkdir -p runlogs/ 8 | 9 | declare -a PARS=(1 10 20 40 80 120 160 200 240) 10 | W=8000 11 | N=100 12 | SERVER="d-14-2-1" 13 | 14 | for P in "${PARS[@]}"; do 15 | OUTLOG="runlogs/syn-N${N}-W${W}-P${P}.csv" 16 | ${SCRIPT_DIR}/../../build/bin/SyntheticScheduler -i 5000 -t 15000 -o $OUTLOG \ 17 | -N $N -W $W -P $P -s $SERVER 18 | done 19 | -------------------------------------------------------------------------------- /scripts/benchmark/run_synthetic_scale.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | SCRIPT_DIR=$(dirname $(readlink -f $0)) 5 | 6 | cd $SCRIPT_DIR 7 | mkdir -p runlogs/ 8 | 9 | declare -a SCHEDULERS=(1 10 20 40 80 120 160 200 240) 10 | P=40 11 | W=8000 12 | N=100 13 | 14 | for N in "${SCHEDULERS[@]}"; do 15 | OUTLOG="runlogs/syn-N${N}-W${W}-P${P}.csv" 16 | ${SCRIPT_DIR}/../../build/bin/SyntheticScheduler -i 5000 -t 15000 -o $OUTLOG \ 17 | -N $N -W $W -P $P 18 | done 19 | -------------------------------------------------------------------------------- /scripts/create_tables.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | SCRIPT_DIR=$(dirname $(readlink -f $0)) 5 | # Enter the root dir of the repo. 6 | cd ${SCRIPT_DIR}/../ 7 | 8 | # On supercloud, use the enterprise version. On local cluster, change the path. 9 | VOLT_HOME=${VOLT_HOME:-"/home/gridsan/groups/DBOS/shared/VoltDB/voltdb-ent-9.3.2"} 10 | VOLTDB_BIN="${VOLT_HOME}/bin" 11 | 12 | # Create tables. 13 | ${VOLTDB_BIN}/sqlcmd < sql/create_task_table.sql 14 | ${VOLTDB_BIN}/sqlcmd < sql/create_worker_table.sql 15 | ${VOLTDB_BIN}/sqlcmd < sql/create_task_stream.sql 16 | ${VOLTDB_BIN}/sqlcmd < sql/create_data_table.sql 17 | ${VOLTDB_BIN}/sqlcmd < sql/create_message_table.sql 18 | ${VOLTDB_BIN}/sqlcmd < sql/create_broadcast_table.sql 19 | -------------------------------------------------------------------------------- /scripts/initialize_voltdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | # Increase open files limit. 5 | ulimit -n 32768 6 | 7 | SCRIPT_DIR=$(dirname $(readlink -f $0)) 8 | # Enter the root dir of the repo. 9 | cd ${SCRIPT_DIR}/../ 10 | 11 | # On supercloud, use the enterprise version. On local cluster, change the path. 12 | VOLT_HOME=${VOLT_HOME:-"/home/gridsan/groups/DBOS/shared/VoltDB/voltdb-ent-9.3.2"} 13 | VOLTDB_BIN="${VOLT_HOME}/bin" 14 | 15 | # Create obj directory 16 | mkdir -p obj/sql 17 | mkdir -p obj/exporter 18 | 19 | # Add custom exporter BEFORE starting the db. 20 | javac -classpath "$VOLT_HOME/voltdb/*" -d obj/exporter exporter/HttpTaskExporter.java 21 | jar cvf build/HttpTaskExporter.jar -C obj/exporter . 22 | cp build/HttpTaskExporter.jar ${VOLT_HOME}/lib/extension/ 23 | 24 | # On supercloud, use the shared scripts. 25 | SHARED_DIR="/home/gridsan/groups/DBOS/shared_scripts/voltdb" 26 | bash ${SHARED_DIR}/init_start.sh 27 | 28 | # On local cluster, uncomment the following lines. 29 | # voltdb init -f --dir=/var/tmp 30 | # voltdb start -B --ignore=thp --dir=/var/tmp 31 | # sleep 5 32 | 33 | # Create tables 34 | bash ${SCRIPT_DIR}/create_tables.sh 35 | 36 | # Load stored procedures 37 | bash ${SCRIPT_DIR}/update_voltdb_procedures.sh 38 | -------------------------------------------------------------------------------- /scripts/initialize_voltdb_httpexport.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | # Increase open files limit. 5 | ulimit -n 32768 6 | 7 | SCRIPT_DIR=$(dirname $(readlink -f $0)) 8 | # Enter the root dir of the repo. 9 | cd ${SCRIPT_DIR}/../ 10 | 11 | # On supercloud, use the enterprise version. On local cluster, change the path. 12 | VOLT_HOME=${VOLT_HOME:-"/home/gridsan/groups/DBOS/shared/VoltDB/voltdb-ent-9.3.2"} 13 | VOLTDB_BIN="${VOLT_HOME}/bin" 14 | 15 | # Create obj directory 16 | mkdir -p obj/sql 17 | mkdir -p obj/exporter 18 | 19 | # Add custom exporter BEFORE starting the db. 20 | javac -classpath "$VOLT_HOME/voltdb/*" -d obj/exporter exporter/HttpTaskExporter.java 21 | jar cvf build/HttpTaskExporter.jar -C obj/exporter . 22 | cp build/HttpTaskExporter.jar ${VOLT_HOME}/lib/extension/ 23 | 24 | # On supercloud, use the shared scripts. 25 | SHARED_DIR="/home/gridsan/groups/DBOS/shared_scripts/voltdb" 26 | 27 | # Use special config file. 28 | CONFIG_FILE="configs/exporter_example_config.xml" 29 | bash ${SHARED_DIR}/init_start.sh "$TMPDIR" "${CONFIG_FILE}" 30 | 31 | # On local cluster, uncomment the following lines. 32 | # voltdb init -f --dir=/var/tmp 33 | # voltdb start -B --ignore=thp --dir=/var/tmp 34 | # sleep 5 35 | 36 | # Create tables 37 | bash ${SCRIPT_DIR}/create_tables.sh 38 | 39 | # Load stored procedures 40 | bash ${SCRIPT_DIR}/update_voltdb_procedures.sh 41 | -------------------------------------------------------------------------------- /scripts/install_cmake.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -xe 3 | 4 | # Install a specific version of cmake 5 | sudo apt remove --purge --auto-remove cmake 6 | sudo apt update && sudo apt upgrade 7 | sudo apt install libssl-dev 8 | 9 | version=3.17 10 | build=0 11 | mkdir ./temp 12 | cd ./temp 13 | wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz 14 | tar -xzvf cmake-$version.$build.tar.gz 15 | pushd cmake-$version.$build/ 16 | 17 | ./bootstrap 18 | make -j8 19 | sudo make install -j8 20 | 21 | cmake --version 22 | 23 | # Clean up 24 | popd 25 | cd ../ 26 | rm -rf ./temp 27 | -------------------------------------------------------------------------------- /scripts/install_grpc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | # Script to install gRPC C++ 5 | BASE_DIR=./temp/grpc 6 | mkdir -p ./temp 7 | sudo apt-get install -y build-essential autoconf libtool pkg-config 8 | 9 | # Check the latest release version at: https://grpc.io/release 10 | # In order to be reproducible, we chose v1.32.0 11 | git clone --recurse-submodules -b v1.32.0 https://github.com/grpc/grpc ${BASE_DIR} 12 | cd ${BASE_DIR} 13 | 14 | mkdir -p cmake/build 15 | pushd cmake/build 16 | cmake -DgRPC_INSTALL=ON \ 17 | -DgRPC_BUILD_TESTS=OFF \ 18 | ../.. 19 | 20 | make -j8 21 | sudo make install 22 | popd 23 | 24 | #rm -rf ${BASE_DIR} 25 | 26 | -------------------------------------------------------------------------------- /scripts/install_openssl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | # Script to install openssl 5 | OPENSSL_DIR=./third_party/openssl 6 | cd ${OPENSSL_DIR} 7 | 8 | mkdir -p ./install 9 | ./config --prefix=${PWD}/install 10 | make -j40 11 | make install 12 | -------------------------------------------------------------------------------- /scripts/install_protobuf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | # Script to install protobuf 5 | PROTO_DIR=./third_party/protobuf 6 | cd ${PROTO_DIR} 7 | git submodule update --init --recursive 8 | 9 | mkdir -p ./cmake/build 10 | mkdir -p ./cmake/install 11 | cd cmake/build 12 | cmake -DCMAKE_INSTALL_PREFIX=${PWD}/../install .. 13 | make -j40 14 | make install 15 | -------------------------------------------------------------------------------- /scripts/install_voltdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$#" -lt 1 ]; then 4 | echo "Usage: ./install_voltdb.sh INSTALLATION_PATH" 5 | exit 1 6 | fi 7 | 8 | # Install the required packages 9 | sudo apt-get -y install ant build-essential ant-optional default-jdk python \ 10 | cmake valgrind ntp ccache git python-httplib2 \ 11 | python-setuptools python-dev apt-show-versions \ 12 | openjdk-8-jdk 13 | 14 | # Make sure that Java 8 is the default 15 | echo "Select Java 8" 16 | sudo update-alternatives --config java 17 | 18 | # Clone and build VoltDB 19 | cd $1 20 | git clone https://github.com/voltdb/voltdb 21 | cd voltdb 22 | 23 | # Avoid "WARN: Strict java memory checking is enabled, don't do release builds 24 | # or performance runs with this enabled. Invoke "ant clean" and "ant 25 | # -Djmemcheck=NO_MEMCHECK" to disable." 26 | ant -Djmemcheck=NO_MEMCHECK 27 | 28 | PATH="$PATH:$(pwd)/bin/" 29 | -------------------------------------------------------------------------------- /scripts/install_voltdb_cpp_client.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | SCRIPT_DIR=$(dirname $(readlink -f $0)) 5 | INSTALL_PATH="${SCRIPT_DIR}/../third_party/voltdb-client-cpp" 6 | 7 | # Install the required packages 8 | sudo apt-get -y install libboost-all-dev 9 | 10 | # Clone and build VoltDB 11 | mkdir -p ./temp 12 | cd ./temp 13 | git clone https://github.com/VoltDB/voltdb-client-cpp 14 | cd voltdb-client-cpp/ 15 | make 16 | 17 | # Copy headers and libs.a to install path 18 | cp libvoltdbcpp.a "${INSTALL_PATH}/lib" 19 | cp third_party_libs/linux/* "${INSTALL_PATH}/lib" 20 | cp -r include/ "${INSTALL_PATH}/include" 21 | 22 | # Show the files 23 | ls $INSTALL_PATH 24 | -------------------------------------------------------------------------------- /scripts/update_voltdb_procedures.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | SCRIPT_DIR=$(dirname $(readlink -f $0)) 5 | # Enter the root dir of the repo. 6 | cd ${SCRIPT_DIR}/../ 7 | 8 | # Create obj directory 9 | mkdir -p obj/ 10 | 11 | # On supercloud, use the enterprise version. On local cluster, change the path. 12 | VOLT_HOME=${VOLT_HOME:-"/home/gridsan/groups/DBOS/shared/VoltDB/voltdb-ent-9.3.2"} 13 | VOLTDB_BIN="${VOLT_HOME}/bin" 14 | 15 | javac -classpath "$VOLT_HOME/voltdb/*" -d obj/sql sql/*.java 16 | jar cvf build/DBOSProcedures.jar -C obj/sql . 17 | ${VOLTDB_BIN}/sqlcmd < sql/load_procedures.sql 18 | -------------------------------------------------------------------------------- /sql/BroadcastMessage.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class BroadcastMessage extends VoltProcedure { 6 | final long SUCCESS = 0; 7 | 8 | public final SQLStmt broadcastMessage = new SQLStmt ( 9 | "INSERT INTO Broadcast VALUES(?);" 10 | ); 11 | 12 | public long run(int msg) throws VoltAbortException { 13 | voltQueueSQL(broadcastMessage, msg); 14 | voltExecuteSQL(); 15 | return SUCCESS; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /sql/FinishWorkerTask.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class FinishWorkerTask extends VoltProcedure { 6 | // Task states. 7 | final long PENDING = 1; 8 | final long RUNNING = 2; 9 | final long COMPLETE = 3; 10 | 11 | public final SQLStmt getCapacity = new SQLStmt ( 12 | "SELECT Capacity FROM Worker WHERE PKey=? AND WorkerID=?;" 13 | ); 14 | 15 | public final SQLStmt updateCapacity = new SQLStmt ( 16 | "UPDATE Worker SET Capacity=? WHERE PKey=? AND WorkerID=?;" 17 | ); 18 | 19 | public final SQLStmt updateState = new SQLStmt ( 20 | "UPDATE Task SET State=3 WHERE PKey=? AND taskID=?;" 21 | ); 22 | public long run(int workerID, int taskID, int pkey) throws VoltAbortException { 23 | voltQueueSQL(getCapacity, pkey, workerID); 24 | VoltTable[] results = voltExecuteSQL(); 25 | VoltTable r = results[0]; 26 | if (r.getRowCount() < 1) { 27 | return -1; 28 | } 29 | long capacity = r.fetchRow(0).getLong(0); 30 | voltQueueSQL(updateCapacity, capacity + 1, pkey, workerID); 31 | if (taskID != -1 ) { 32 | voltQueueSQL(updateState, pkey, taskID); 33 | voltExecuteSQL(); 34 | } else { 35 | voltExecuteSQL(); 36 | } 37 | return 0; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /sql/InsertSparkWorker.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class InsertSparkWorker extends VoltProcedure { 6 | 7 | public final SQLStmt insert = new SQLStmt ( 8 | "INSERT INTO Worker VALUES (?, ?, ?, ?, ?);" 9 | ); 10 | 11 | public final SQLStmt insertData = new SQLStmt ( 12 | "INSERT INTO DataLocation VALUES (?, ?);" 13 | ); 14 | 15 | public long run(int workerID, int capacity, int workerData, int pkey, String url) throws VoltAbortException { 16 | voltQueueSQL(insert, workerID, capacity, workerData, pkey, url); 17 | voltExecuteSQL(); 18 | voltQueueSQL(insertData, workerData, pkey); 19 | voltExecuteSQL(); 20 | return 0; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /sql/InsertTask.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class InsertTask extends VoltProcedure { 6 | 7 | public final SQLStmt insert = new SQLStmt ( 8 | "INSERT INTO Task VALUES (?, ?, ?, ?);" 9 | ); 10 | 11 | public long run(int taskID, int workerID, int state, int pkey) throws VoltAbortException { 12 | voltQueueSQL(insert, taskID, workerID, state, pkey); 13 | voltExecuteSQL(); 14 | return 0; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /sql/InsertWorker.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class InsertWorker extends VoltProcedure { 6 | 7 | public final SQLStmt insert = new SQLStmt ( 8 | "INSERT INTO Worker VALUES (?, ?, 0, ?, ?);" 9 | ); 10 | 11 | public long run(int workerID, int capacity, int pkey, String url) throws VoltAbortException { 12 | voltQueueSQL(insert, workerID, capacity, pkey, url); 13 | voltExecuteSQL(); 14 | return 0; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /sql/PushTask.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class PushTask extends VoltProcedure { 6 | 7 | final long SUCCESS = 0; 8 | final long NOTASK = -1; 9 | final long NOWORKER = -2; 10 | 11 | // Task states. 12 | final long PENDING = 1; 13 | final long RUNNING = 2; 14 | final long COMPLETE = 3; 15 | 16 | 17 | public final SQLStmt selectWorker = new SQLStmt ( 18 | "SELECT WorkerID, Capacity, Url FROM Worker WHERE PKey=? AND Capacity > 0 LIMIT 1;" 19 | ); 20 | 21 | public final SQLStmt updateCapacity = new SQLStmt( 22 | "UPDATE Worker SET Capacity=? WHERE PKey=? AND WorkerID=?;" 23 | ); 24 | 25 | public final SQLStmt insertTask = new SQLStmt ( 26 | "INSERT INTO Task VALUES (?, ?, ?, ?);" 27 | ); 28 | 29 | public final SQLStmt insertTaskAssign = new SQLStmt ( 30 | "INSERT INTO TaskAssign VALUES(?, ?, ?);" 31 | ); 32 | 33 | public long run(int pkey, long taskID) throws VoltAbortException { 34 | // Select an available worker. 35 | voltQueueSQL(selectWorker, pkey); 36 | VoltTable[] results = voltExecuteSQL(); 37 | VoltTable r = results[0]; 38 | if (r.getRowCount() < 1) { 39 | // If no worker is available, return NOTASK failure. 40 | return NOWORKER; 41 | } 42 | long workerID = r.fetchRow(0).getLong(0); 43 | long capacity = r.fetchRow(0).getLong(1); 44 | String url = r.fetchRow(0).getString(2); 45 | long state = RUNNING; // RUNNING 46 | 47 | // If a worker is available, insert task into table and update the worker capacity. 48 | voltQueueSQL(insertTask, taskID, workerID, state, pkey); 49 | voltQueueSQL(updateCapacity, capacity - 1, pkey, workerID); 50 | voltQueueSQL(insertTaskAssign, taskID, url, pkey); 51 | voltExecuteSQL(); 52 | 53 | return SUCCESS; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /sql/ReceiveMessage.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class ReceiveMessage extends VoltProcedure { 6 | 7 | public final SQLStmt receiveMessage = new SQLStmt ( 8 | "SELECT SenderID, MessageID, Data FROM Message WHERE ReceiverID=?;" 9 | ); 10 | 11 | public final SQLStmt ackMessage = new SQLStmt ( 12 | "DELETE FROM Message WHERE ReceiverID=?;" 13 | ); 14 | 15 | public VoltTable[] run(int receiverID) throws VoltAbortException { 16 | voltQueueSQL(receiveMessage, receiverID); 17 | VoltTable[] results = voltExecuteSQL(); 18 | VoltTable r = results[0]; 19 | if (r.getRowCount() < 1) { 20 | // No message. 21 | return results; 22 | } 23 | 24 | voltQueueSQL(ackMessage, receiverID); 25 | voltExecuteSQL(); 26 | 27 | return results; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /sql/ScanPartitionedTaskWorker.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class ScanPartitionedTaskWorker extends VoltProcedure { 6 | 7 | final long SUCCESS = 0; 8 | final long NOWORKER = -2; 9 | 10 | public final SQLStmt scanTaskWorker = new SQLStmt ( 11 | "SELECT agg.WorkerID " 12 | + "FROM (SELECT WorkerID, COUNT(*) AS cnt " 13 | + "FROM Task WHERE WorkerID >= 0 AND PKey=? " 14 | + "GROUP BY WorkerID) as agg " 15 | + "ORDER BY agg.cnt DESC LIMIT 1;" 16 | ); 17 | 18 | // TODO: probably return VoltTable[] is more reasonable. 19 | public long run(int pkey) throws VoltAbortException { 20 | // Find the worker with most tasks and get the task count. 21 | long workerId = NOWORKER; 22 | voltQueueSQL(scanTaskWorker, pkey); 23 | VoltTable[] results = voltExecuteSQL(); 24 | VoltTable r = results[0]; 25 | if (r.getRowCount() < 1) { 26 | // If no worker found, return 27 | return NOWORKER; 28 | } 29 | workerId = r.fetchRow(0).getLong(0); 30 | return workerId; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /sql/ScanTaskWorker.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class ScanTaskWorker extends VoltProcedure { 6 | 7 | final long SUCCESS = 0; 8 | final long NOWORKER = -2; 9 | 10 | public final SQLStmt scanTaskWorker = new SQLStmt ( 11 | "SELECT agg.WorkerID " 12 | + "FROM (SELECT WorkerID, COUNT(*) AS cnt " 13 | + "FROM Task WHERE WorkerID >= 0 " 14 | + "GROUP BY WorkerID) as agg " 15 | + "ORDER BY agg.cnt DESC LIMIT 1;" 16 | ); 17 | 18 | // TODO: probably return VoltTable[] is more reasonable. 19 | public long run() throws VoltAbortException { 20 | // Find the worker with most tasks and get the task count. 21 | long workerId = NOWORKER; 22 | voltQueueSQL(scanTaskWorker); 23 | VoltTable[] results = voltExecuteSQL(); 24 | VoltTable r = results[0]; 25 | if (r.getRowCount() < 1) { 26 | // If no worker found, return 27 | return NOWORKER; 28 | } 29 | workerId = r.fetchRow(0).getLong(0); 30 | return workerId; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /sql/SelectDataShardPartition.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class SelectDataShardPartition extends VoltProcedure { 6 | 7 | public final SQLStmt selectPKey = new SQLStmt ( 8 | "SELECT DISTINCT PKey FROM DataLocation WHERE DataShard=?;" 9 | ); 10 | 11 | public VoltTable[] run(int dataShard) throws VoltAbortException { 12 | voltQueueSQL(selectPKey, dataShard); 13 | return voltExecuteSQL(); 14 | } 15 | } -------------------------------------------------------------------------------- /sql/SelectOrderedWorker.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class SelectOrderedWorker extends VoltProcedure { 6 | 7 | public final SQLStmt selectWorker = new SQLStmt ( 8 | "SELECT WorkerID, Capacity FROM Worker WHERE PKey=? AND Capacity > 0 ORDER BY Capacity DESC LIMIT 1;" 9 | ); 10 | 11 | public final SQLStmt updateCapacity = new SQLStmt( 12 | "UPDATE Worker SET Capacity=? WHERE PKey=? AND WorkerID=?;" 13 | ); 14 | 15 | public final SQLStmt insertTask = new SQLStmt ( 16 | "INSERT INTO Task VALUES (?, ?, ?, ?);" 17 | ); 18 | 19 | public long run(int pkey, long taskID) throws VoltAbortException { 20 | voltQueueSQL(selectWorker, pkey); 21 | VoltTable[] results = voltExecuteSQL(); 22 | VoltTable r = results[0]; 23 | if (r.getRowCount() < 1) { 24 | return -1; 25 | } 26 | long workerID = r.fetchRow(0).getLong(0); 27 | long capacity = r.fetchRow(0).getLong(1); 28 | voltQueueSQL(insertTask, taskID, workerID, 1, pkey); 29 | voltQueueSQL(updateCapacity, capacity - 1, pkey, workerID); 30 | voltExecuteSQL(); 31 | return workerID; 32 | } 33 | } -------------------------------------------------------------------------------- /sql/SelectPartitionedTaskWorker.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class SelectPartitionedTaskWorker extends VoltProcedure { 6 | 7 | final long SUCCESS = 0; 8 | final long NOTASK = -1; 9 | final long NOWORKER = -2; 10 | 11 | public final SQLStmt selectWorker = new SQLStmt ( 12 | "SELECT WorkerID, Capacity FROM Worker WHERE PKey=? AND Capacity > 0 LIMIT 1;" 13 | ); 14 | 15 | public final SQLStmt updateCapacity = new SQLStmt( 16 | "UPDATE Worker SET Capacity=? WHERE PKey=? AND WorkerID=?;" 17 | ); 18 | 19 | public final SQLStmt selectTask = new SQLStmt ( 20 | "SELECT TaskID FROM Task WHERE PKey=? LIMIT 1;" 21 | ); 22 | 23 | public final SQLStmt updateTask = new SQLStmt ( 24 | "UPDATE Task SET WorkerID=? WHERE PKey=? AND TaskID=?;" 25 | ); 26 | 27 | public long run(int pkey) throws VoltAbortException { 28 | // Select an available Task. 29 | voltQueueSQL(selectTask, pkey); 30 | VoltTable[] results = voltExecuteSQL(); 31 | VoltTable r = results[0]; 32 | if (r.getRowCount() < 1) { 33 | // If no task is available, return NOTASK failure. 34 | return NOTASK; 35 | } 36 | long taskID = r.fetchRow(0).getLong(0); 37 | 38 | // Try to find a worker in the same partition. 39 | voltQueueSQL(selectWorker, pkey); 40 | results = voltExecuteSQL(); 41 | r = results[0]; 42 | if (r.getRowCount() < 1) { 43 | // If no worker is available, return NOWORKER failure. 44 | return NOWORKER; 45 | } 46 | // If a worker is available, update its capacity and the task table. 47 | long workerID = r.fetchRow(0).getLong(0); 48 | long capacity = r.fetchRow(0).getLong(1); 49 | voltQueueSQL(updateCapacity, capacity - 1, pkey, workerID); 50 | // voltExecuteSQL(); 51 | // No need to execute SQL here. can push multiple sql queries then execute in a batch. 52 | 53 | voltQueueSQL(updateTask, workerID, pkey, taskID); 54 | voltExecuteSQL(); 55 | return 0; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /sql/SelectSinglePartitionedTaskWorker.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class SelectSinglePartitionedTaskWorker extends VoltProcedure { 6 | 7 | final long SUCCESS = 0; 8 | final long NOWORKER = -2; 9 | 10 | public final SQLStmt selectWorker = new SQLStmt ( 11 | "SELECT WorkerID, Capacity FROM Worker WHERE PKey=? AND Capacity > 0 LIMIT 1;" 12 | ); 13 | 14 | public final SQLStmt updateCapacity = new SQLStmt( 15 | "UPDATE Worker SET Capacity=? WHERE PKey=? AND WorkerID=?;" 16 | ); 17 | 18 | public final SQLStmt insertTask = new SQLStmt ( 19 | "INSERT INTO Task VALUES (?, ?, ?, ?);" 20 | ); 21 | 22 | public long run(int pkey, long taskID) throws VoltAbortException { 23 | // Select an available Worker. 24 | voltQueueSQL(selectWorker, pkey); 25 | VoltTable[] results = voltExecuteSQL(); 26 | VoltTable r = results[0]; 27 | if (r.getRowCount() < 1) { 28 | // If no worker is available, return NOWORKER failure. 29 | return NOWORKER; 30 | } 31 | 32 | long workerID = r.fetchRow(0).getLong(0); 33 | long capacity = r.fetchRow(0).getLong(1); 34 | long state = 1; //RUNNING? 35 | 36 | // If a worker is available, insert task into table and update the worker capacity. 37 | voltQueueSQL(insertTask, taskID, workerID, state, pkey); 38 | // voltExecuteSQL(); 39 | 40 | voltQueueSQL(updateCapacity, capacity - 1, pkey, workerID); 41 | voltExecuteSQL(); 42 | 43 | return SUCCESS; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /sql/SelectSparkWorker.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class SelectSparkWorker extends VoltProcedure { 6 | 7 | public final SQLStmt selectWorker = new SQLStmt ( 8 | "SELECT WorkerID, Capacity FROM Worker WHERE PKey=? AND Capacity > 0 AND DataShards=? LIMIT 1;" 9 | ); 10 | 11 | public final SQLStmt updateCapacity = new SQLStmt( 12 | "UPDATE Worker SET Capacity=? WHERE PKey=? AND WorkerID=?;" 13 | ); 14 | 15 | public long run(int pkey, int targetData) throws VoltAbortException { 16 | voltQueueSQL(selectWorker, pkey, targetData); 17 | VoltTable[] results = voltExecuteSQL(); 18 | VoltTable r = results[0]; 19 | if (r.getRowCount() < 1) { 20 | return -1; 21 | } 22 | long workerID = r.fetchRow(0).getLong(0); 23 | long capacity = r.fetchRow(0).getLong(1); 24 | voltQueueSQL(updateCapacity, capacity - 1, pkey, workerID); 25 | voltExecuteSQL(); 26 | return workerID; 27 | } 28 | } -------------------------------------------------------------------------------- /sql/SelectTaskWorker.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class SelectTaskWorker extends VoltProcedure { 6 | 7 | final long SUCCESS = 0; 8 | final long NOTASK = -1; 9 | final long NOWORKER = -2; 10 | 11 | public final SQLStmt selectWorker = new SQLStmt ( 12 | "SELECT WorkerID, Capacity FROM Worker WHERE Capacity > 0 LIMIT 1;" 13 | ); 14 | 15 | public final SQLStmt updateCapacity = new SQLStmt( 16 | "UPDATE Worker SET Capacity=? WHERE WorkerID=?;" 17 | ); 18 | 19 | public final SQLStmt selectTask = new SQLStmt ( 20 | "SELECT TaskID FROM Task LIMIT 1;" 21 | ); 22 | 23 | public final SQLStmt updateTask = new SQLStmt ( 24 | "UPDATE Task SET WorkerID=? WHERE TaskID=?;" 25 | ); 26 | 27 | public long run() throws VoltAbortException { 28 | // Select any available Task. 29 | voltQueueSQL(selectTask); 30 | VoltTable[] results = voltExecuteSQL(); 31 | VoltTable r = results[0]; 32 | if (r.getRowCount() < 1) { 33 | return NOTASK; 34 | } 35 | long taskID = r.fetchRow(0).getLong(0); 36 | 37 | voltQueueSQL(selectWorker); 38 | results = voltExecuteSQL(); 39 | r = results[0]; 40 | if (r.getRowCount() < 1) { 41 | return NOWORKER; 42 | } 43 | // If a worker is available, update its capacity and the task table. 44 | long workerID = r.fetchRow(0).getLong(0); 45 | long capacity = r.fetchRow(0).getLong(1); 46 | voltQueueSQL(updateCapacity, capacity - 1, workerID); 47 | voltExecuteSQL(); 48 | 49 | voltQueueSQL(updateTask, workerID, taskID); 50 | voltExecuteSQL(); 51 | return SUCCESS; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /sql/SelectWorker.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class SelectWorker extends VoltProcedure { 6 | 7 | public final SQLStmt selectWorker = new SQLStmt ( 8 | "SELECT WorkerID, Capacity FROM Worker WHERE PKey=? AND Capacity > 0 LIMIT 1;" 9 | ); 10 | 11 | public final SQLStmt updateCapacity = new SQLStmt( 12 | "UPDATE Worker SET Capacity=? WHERE PKey=? AND WorkerID=?;" 13 | ); 14 | 15 | public long run(int pkey) throws VoltAbortException { 16 | voltQueueSQL(selectWorker, pkey); 17 | VoltTable[] results = voltExecuteSQL(); 18 | VoltTable r = results[0]; 19 | if (r.getRowCount() < 1) { 20 | return -1; 21 | } 22 | long workerID = r.fetchRow(0).getLong(0); 23 | long capacity = r.fetchRow(0).getLong(1); 24 | voltQueueSQL(updateCapacity, capacity - 1, pkey, workerID); 25 | voltExecuteSQL(); 26 | return workerID; 27 | } 28 | } -------------------------------------------------------------------------------- /sql/SendMessage.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class SendMessage extends VoltProcedure { 6 | final long SUCCESS = 0; 7 | 8 | public final SQLStmt sendMessage = new SQLStmt ( 9 | "INSERT INTO Message VALUES(?,?,?,?);" 10 | ); 11 | 12 | public long run(int receiverID, int senderID, long messageID, String data) throws VoltAbortException { 13 | voltQueueSQL(sendMessage, receiverID, senderID, messageID, data); 14 | voltExecuteSQL(); 15 | return SUCCESS; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /sql/TruncateTaskTable.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class TruncateTaskTable extends VoltProcedure { 6 | 7 | public final SQLStmt truncateTaskTable = new SQLStmt ( 8 | "TRUNCATE TABLE Task;" 9 | ); 10 | 11 | public long run() throws VoltAbortException { 12 | voltQueueSQL(truncateTaskTable); 13 | voltExecuteSQL(); 14 | return 0; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /sql/TruncateWorkerTable.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | public class TruncateWorkerTable extends VoltProcedure { 6 | 7 | public final SQLStmt truncateWorkerTable = new SQLStmt ( 8 | "TRUNCATE TABLE Worker;" 9 | ); 10 | 11 | public final SQLStmt truncateDataShardTable = new SQLStmt ( 12 | "TRUNCATE TABLE DataLocation;" 13 | ); 14 | 15 | public long run() throws VoltAbortException { 16 | voltQueueSQL(truncateWorkerTable); 17 | voltExecuteSQL(); 18 | voltQueueSQL(truncateDataShardTable); 19 | voltExecuteSQL(); 20 | return 0; 21 | } 22 | } -------------------------------------------------------------------------------- /sql/WorkerSelectTask.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | // Select top-K tasks that are pending and assigned to this worker. 6 | // Update task status to running. 7 | public class WorkerSelectTask extends VoltProcedure { 8 | 9 | // Task states. 10 | final long PENDING = 1; 11 | final long RUNNING = 2; 12 | final long COMPLETE = 3; 13 | 14 | public final SQLStmt selectPendingTasks = new SQLStmt ( 15 | "SELECT TaskID FROM Task WHERE PKey=? AND WorkerID=? AND State=1 LIMIT ?;" 16 | ); 17 | 18 | public final SQLStmt updateTaskRunning = new SQLStmt( 19 | "UPDATE Task SET State=2 WHERE PKey=? AND TaskID=? AND WorkerID=?;" 20 | ); 21 | 22 | public VoltTable[] run(int pkey, long workerId, long topk) throws VoltAbortException { 23 | // Select pending topk tasks. 24 | voltQueueSQL(selectPendingTasks, pkey, workerId, topk); 25 | VoltTable[] results = voltExecuteSQL(); 26 | VoltTable r = results[0]; 27 | int numTasks = r.getRowCount(); 28 | if (numTasks < 1) { 29 | // Return empty table. 30 | return results; 31 | } 32 | 33 | // Iteratively update tasks. 34 | for (int i = 0; i < numTasks; i++) { 35 | long taskId = r.fetchRow(i).getLong(0); 36 | voltQueueSQL(updateTaskRunning, pkey, taskId, workerId); 37 | } 38 | 39 | voltExecuteSQL(); 40 | 41 | // Return task ids. 42 | return results; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /sql/WorkerUpdateTask.java: -------------------------------------------------------------------------------- 1 | package dbos.procedures; 2 | 3 | import org.voltdb.*; 4 | 5 | // Update a task state on a worker. 6 | public class WorkerUpdateTask extends VoltProcedure { 7 | 8 | // Task states. 9 | final long PENDING = 1; 10 | final long RUNNING = 2; 11 | final long COMPLETE = 3; 12 | 13 | // status 14 | final long SUCCESS = 0; 15 | 16 | public final SQLStmt updateTask = new SQLStmt( 17 | "UPDATE Task SET State=? WHERE PKey=? AND TaskID=? AND WorkerID=?;" 18 | ); 19 | 20 | public final SQLStmt updateCapacity = new SQLStmt( 21 | "UPDATE Worker SET Capacity=Capacity+1 WHERE PKey=? AND WorkerID=?;" 22 | ); 23 | 24 | 25 | public long run(int pkey, long workerId, long taskId, long taskState) throws VoltAbortException { 26 | // TODO: add sanity check that taskState is valid? 27 | voltQueueSQL(updateTask, taskState, pkey, taskId, workerId); 28 | if (taskState == COMPLETE) { 29 | // If change to complete, then add back one capacity. 30 | voltQueueSQL(updateCapacity, pkey, workerId); 31 | } 32 | voltExecuteSQL(); 33 | return SUCCESS; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /sql/create_broadcast_table.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE Broadcast ( 2 | Message INTEGER NOT NULL 3 | ); 4 | -------------------------------------------------------------------------------- /sql/create_data_table.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE DataLocation ( 2 | DataShard INTEGER NOT NULL, 3 | PKey INTEGER NOT NULL 4 | ); 5 | CREATE INDEX DataShardIndex ON DataLocation (DataShard); 6 | -------------------------------------------------------------------------------- /sql/create_message_table.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE Message ( 2 | ReceiverID INTEGER NOT NULL, 3 | SenderID INTEGER NOT NULL, 4 | MessageID BIGINT NOT NULL, 5 | Data VARCHAR(1048576) NOT NULL 6 | ); 7 | PARTITION TABLE Message ON COLUMN ReceiverID; 8 | -------------------------------------------------------------------------------- /sql/create_task_stream.sql: -------------------------------------------------------------------------------- 1 | CREATE STREAM TaskAssign PARTITION ON COLUMN PKey EXPORT TO TARGET httpexporter ( 2 | TaskID INTEGER NOT NULL, 3 | Url VARCHAR(512) NOT NULL, 4 | PKey INTEGER NOT NULL 5 | ); 6 | -------------------------------------------------------------------------------- /sql/create_task_table.sql: -------------------------------------------------------------------------------- 1 | ECHO "Task state: 0=unknwon, 1=pending, 2=running, 3=completed" 2 | CREATE TABLE Task ( 3 | TaskID INTEGER NOT NULL, 4 | WorkerID INTEGER NOT NULL, 5 | State INTEGER NOT NULL, 6 | PKey INTEGER NOT NULL 7 | ); 8 | PARTITION TABLE Task ON COLUMN PKey; 9 | CREATE ASSUMEUNIQUE INDEX taskIDIndex ON Task (taskID); 10 | CREATE INDEX stateIndex ON Task (State); 11 | -------------------------------------------------------------------------------- /sql/create_worker_table.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE Worker ( 2 | WorkerID INTEGER NOT NULL, 3 | Capacity INTEGER NOT NULL, 4 | DataShards Integer NOT NULL, 5 | PKey INTEGER NOT NULL, 6 | Url VARCHAR(512) 7 | ); 8 | PARTITION TABLE Worker ON COLUMN PKey; 9 | CREATE INDEX workerIDIndex ON Worker (workerID); 10 | CREATE INDEX capacityIndex ON Worker (Capacity); 11 | CREATE INDEX dataShardsIndex ON Worker (DataShards, Capacity); 12 | -------------------------------------------------------------------------------- /sql/load_procedures.sql: -------------------------------------------------------------------------------- 1 | load classes build/DBOSProcedures.jar; 2 | 3 | DROP PROCEDURE InsertTask IF EXISTS; 4 | CREATE PROCEDURE FROM CLASS dbos.procedures.InsertTask; 5 | 6 | DROP PROCEDURE InsertWorker IF EXISTS; 7 | CREATE PROCEDURE PARTITION ON TABLE Worker COLUMN PKey PARAMETER 2 FROM CLASS dbos.procedures.InsertWorker; 8 | 9 | DROP PROCEDURE InsertSparkWorker IF EXISTS; 10 | CREATE PROCEDURE FROM CLASS dbos.procedures.InsertSparkWorker; 11 | 12 | DROP PROCEDURE SelectTaskWorker IF EXISTS; 13 | CREATE PROCEDURE FROM CLASS dbos.procedures.SelectTaskWorker; 14 | 15 | DROP PROCEDURE SelectWorker IF EXISTS; 16 | CREATE PROCEDURE PARTITION ON TABLE Worker COLUMN PKey FROM CLASS dbos.procedures.SelectWorker; 17 | 18 | DROP PROCEDURE SelectOrderedWorker IF EXISTS; 19 | CREATE PROCEDURE PARTITION ON TABLE Worker COLUMN PKey FROM CLASS dbos.procedures.SelectOrderedWorker; 20 | 21 | DROP PROCEDURE SelectPartitionedTaskWorker IF EXISTS; 22 | CREATE PROCEDURE PARTITION ON TABLE Worker COLUMN PKey FROM CLASS dbos.procedures.SelectPartitionedTaskWorker; 23 | 24 | DROP PROCEDURE SelectSinglePartitionedTaskWorker IF EXISTS; 25 | CREATE PROCEDURE PARTITION ON TABLE Worker COLUMN PKey FROM CLASS dbos.procedures.SelectSinglePartitionedTaskWorker; 26 | 27 | DROP PROCEDURE SelectSparkWorker IF EXISTS; 28 | CREATE PROCEDURE PARTITION ON TABLE Worker COLUMN PKey FROM CLASS dbos.procedures.SelectSparkWorker; 29 | 30 | DROP PROCEDURE TruncateTaskTable IF EXISTS; 31 | CREATE PROCEDURE FROM CLASS dbos.procedures.TruncateTaskTable; 32 | 33 | DROP PROCEDURE TruncateWorkerTable IF EXISTS; 34 | CREATE PROCEDURE FROM CLASS dbos.procedures.TruncateWorkerTable; 35 | 36 | DROP PROCEDURE FinishWorkerTask IF EXISTS; 37 | CREATE PROCEDURE PARTITION ON TABLE Worker COLUMN PKey PARAMETER 2 FROM CLASS dbos.procedures.FinishWorkerTask; 38 | 39 | DROP PROCEDURE ScanPartitionedTaskWorker IF EXISTS; 40 | CREATE PROCEDURE PARTITION ON TABLE Task COLUMN PKey FROM CLASS dbos.procedures.ScanPartitionedTaskWorker; 41 | 42 | DROP PROCEDURE ScanTaskWorker IF EXISTS; 43 | CREATE PROCEDURE FROM CLASS dbos.procedures.ScanTaskWorker; 44 | 45 | DROP PROCEDURE WorkerSelectTask IF EXISTS; 46 | CREATE PROCEDURE PARTITION ON TABLE Task COLUMN PKey FROM CLASS dbos.procedures.WorkerSelectTask; 47 | 48 | DROP PROCEDURE WorkerUpdateTask IF EXISTS; 49 | CREATE PROCEDURE PARTITION ON TABLE Task COLUMN PKey FROM CLASS dbos.procedures.WorkerUpdateTask; 50 | 51 | DROP PROCEDURE PushTask IF EXISTS; 52 | CREATE PROCEDURE PARTITION ON TABLE Worker COLUMN PKey FROM CLASS dbos.procedures.PushTask; 53 | 54 | DROP PROCEDURE SelectDataShardPartition IF EXISTS; 55 | CREATE PROCEDURE FROM CLASS dbos.procedures.SelectDataShardPartition; 56 | 57 | DROP PROCEDURE SendMessage IF EXISTS; 58 | CREATE PROCEDURE PARTITION ON TABLE Message COLUMN ReceiverID FROM CLASS dbos.procedures.SendMessage; 59 | 60 | DROP PROCEDURE ReceiveMessage IF EXISTS; 61 | CREATE PROCEDURE PARTITION ON TABLE Message COLUMN ReceiverID FROM CLASS dbos.procedures.ReceiveMessage; 62 | 63 | DROP PROCEDURE BroadcastMessage IF EXISTS; 64 | CREATE PROCEDURE FROM CLASS dbos.procedures.BroadcastMessage; 65 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "Building DBOS scheduler src") 2 | 3 | # Packages 4 | set(protobuf_MODULE_COMPATIBLE TRUE) 5 | 6 | find_package(Threads REQUIRED) 7 | 8 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 9 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) 10 | 11 | set(_VOLTDB_LIBS_PATH "${CMAKE_SOURCE_DIR}/third_party/voltdb-client-cpp/lib") 12 | 13 | include_directories("${CMAKE_SOURCE_DIR}/third_party") 14 | include_directories(/usr/local/include) 15 | link_directories(/usr/local/lib /usr/local/lib64) 16 | 17 | message(STATUS "Using gRPC ${gRPC_VERSION}") 18 | 19 | set(PROTOS_PATH "${CMAKE_CURRENT_BINARY_DIR}/../protos") 20 | 21 | include_directories(${PROTOS_PATH}) 22 | 23 | # Subdirectories 24 | add_subdirectory(libs) 25 | add_subdirectory(simulation) 26 | -------------------------------------------------------------------------------- /src/libs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(lib_scheduler) 2 | add_subdirectory(lib_worker) 3 | add_subdirectory(lib_util) -------------------------------------------------------------------------------- /src/libs/lib_scheduler/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "Building DBOS scheduler lib/lib_scheduler") 2 | 3 | # Dependencies 4 | # Find boost static libs, statically linked to C++ runtime. 5 | set(Boost_USE_STATIC_LIBS ON) 6 | set(Boost_USE_STATIC_RUNTIME ON) 7 | 8 | find_package(Boost 1.53 COMPONENTS system thread) 9 | message(STATUS "Using Boost ${Boost_VERSION}") 10 | 11 | set(lib_scheduler_SOURCES PartitionedFIFOScheduler.cc PartitionedFIFOTaskScheduler.cc PartitionedLocalFIFOScheduler.cc SinglePartitionedFIFOTaskScheduler.cc VoltdbSchedulerUtil.cc SparkScheduler.cc SchedulerServer.cpp PartitionedScanTask.cc PushFIFOScheduler.cc) 12 | add_library(lib_scheduler STATIC ${lib_scheduler_SOURCES}) 13 | 14 | # For scheduler simulation 15 | target_include_directories(lib_scheduler PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 16 | target_link_libraries(lib_scheduler 17 | dbos-scheduler-protos 18 | ${_VOLTDB_LIBS_PATH}/libvoltdbcpp.a 19 | ${_VOLTDB_LIBS_PATH}/libevent.a 20 | ${_VOLTDB_LIBS_PATH}/libevent_openssl.a 21 | ${_VOLTDB_LIBS_PATH}/libevent_pthreads.a 22 | ${_VOLTDB_LIBS_PATH}/libssl.a 23 | ${_VOLTDB_LIBS_PATH}/libcrypto.a 24 | pthread Boost::system Boost::thread dl 25 | lib_worker 26 | lib_util 27 | ) 28 | 29 | set_target_properties(lib_scheduler 30 | PROPERTIES 31 | ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" 32 | LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" 33 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" 34 | ) 35 | -------------------------------------------------------------------------------- /src/libs/lib_scheduler/PartitionedFIFOScheduler.h: -------------------------------------------------------------------------------- 1 | // This file contains common utils for connecting with VoltDB 2 | #ifndef PARTITIONED_FIFO_SCHEDULER_H 3 | #define PARTITIONED_FIFO_SCHEDULER_H 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "VoltdbSchedulerUtil.h" 10 | #include "voltdb-client-cpp/include/Client.h" 11 | 12 | // Since voltdb::Client only has private constructor, we cannot create a private 13 | // member variable of it. Each thread needs to: 14 | // (1) call static function createVoltdbClient() to get a local VoltDB client. 15 | // (2) pass the pointer to construct PartitionedFIFOScheduler. 16 | class PartitionedFIFOScheduler : public VoltdbSchedulerUtil { 17 | public: 18 | PartitionedFIFOScheduler(voltdb::Client* client, std::string dbAddr, 19 | int workerPartitions, int workerCapacity, 20 | int numWorkers) 21 | : VoltdbSchedulerUtil(client, dbAddr), 22 | workerPartitions_(workerPartitions), 23 | workerCapacity_(workerCapacity), 24 | numWorkers_(numWorkers){}; 25 | 26 | // Truncate the worker table; 27 | void truncateWorkerTable(); 28 | 29 | // Insert a worker into the worker table. 30 | DbosStatus insertWorker(DbosId workerID, DbosId capacity); 31 | 32 | // Select a worker for a task and update worker capacity. 33 | // Return the selected worker id. 34 | DbosId selectWorker(); 35 | 36 | // Update which worker the task is assigned to, and update worker status to 37 | // scheduled. 38 | DbosStatus assignTaskToWorker(DbosId taskId, DbosId workerId); 39 | 40 | // Complete a task, updating the capacity of its worker. 41 | DbosStatus finishTask(DbosId taskId, DbosId workerId); 42 | 43 | // Setup the database. 44 | DbosStatus setup(); 45 | 46 | // Tear down the database after benchmarking. 47 | DbosStatus teardown(); 48 | 49 | // Perform a scheduling act. 50 | DbosStatus schedule(Task* task); 51 | 52 | // Async scheduling. 53 | DbosStatus asyncSchedule( 54 | boost::shared_ptr callback); 55 | 56 | // Destructor 57 | ~PartitionedFIFOScheduler() { /* placeholder for now. */ 58 | } 59 | 60 | private: 61 | int workerCapacity_; 62 | int workerPartitions_; 63 | int numWorkers_; 64 | }; 65 | 66 | #endif // #ifndef PARTITIONED_FIFO_SCHEDULER_H 67 | -------------------------------------------------------------------------------- /src/libs/lib_scheduler/PartitionedFIFOTaskScheduler.h: -------------------------------------------------------------------------------- 1 | #ifndef PARTITIONED_FIFO_TASK_SCHEDULER_H 2 | #define PARTITIONED_FIFO_TASK_SCHEDULER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "VoltdbSchedulerUtil.h" 9 | #include "voltdb-client-cpp/include/Client.h" 10 | 11 | // Since voltdb::Client only has private constructor, we cannot create a private 12 | // member variable of it. Each thread needs to: 13 | // (1) call static function createVoltdbClient() to get a local VoltDB client. 14 | // (2) pass the pointer to construct PartitionedFIFOScheduler. 15 | class PartitionedFIFOTaskScheduler : public VoltdbSchedulerUtil { 16 | public: 17 | PartitionedFIFOTaskScheduler(voltdb::Client* client, std::string dbAddr, 18 | int partitions, int numTasks, int workerCapacity, 19 | int numWorkers, float probMultiTx) 20 | : VoltdbSchedulerUtil(client, dbAddr), 21 | partitions_(partitions), 22 | numTasks_(numTasks), 23 | workerCapacity_(workerCapacity), 24 | numWorkers_(numWorkers), 25 | probMultiTx_(probMultiTx){}; 26 | 27 | // Truncate the worker table; 28 | void truncateWorkerTable(); 29 | 30 | // Truncate the worker table; 31 | void truncateTaskTable(); 32 | 33 | // Insert a worker into the worker table. 34 | DbosStatus insertWorker(DbosId workerID, DbosId capacity); 35 | 36 | // Insert a task into the task table. 37 | DbosStatus insertTask(DbosId taskID); 38 | 39 | // Select a worker for a task and update worker capacity and task workerid. 40 | DbosStatus selectTaskWorker(); 41 | 42 | // Setup the database. 43 | DbosStatus setup(); 44 | 45 | // Tear down the database after benchmarking. 46 | DbosStatus teardown(); 47 | 48 | // Perform a scheduling act. 49 | DbosStatus schedule(Task* task); 50 | 51 | // Destructor 52 | ~PartitionedFIFOTaskScheduler() { /* placeholder for now. */ 53 | } 54 | 55 | private: 56 | int partitions_; 57 | int numTasks_; 58 | int workerCapacity_; 59 | int numWorkers_; 60 | float probMultiTx_; 61 | }; 62 | 63 | #endif // #ifndef PARTITIONED_FIFO_TASK_SCHEDULER_H 64 | -------------------------------------------------------------------------------- /src/libs/lib_scheduler/PartitionedLocalFIFOScheduler.h: -------------------------------------------------------------------------------- 1 | // This file contains common utils for connecting with VoltDB 2 | #ifndef PARTITIONED_LOCAL_FIFO_SCHEDULER_H 3 | #define PARTITIONED_LOCAL_FIFO_SCHEDULER_H 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "VoltdbSchedulerUtil.h" 10 | #include "voltdb-client-cpp/include/Client.h" 11 | 12 | // Since voltdb::Client only has private constructor, we cannot create a private 13 | // member variable of it. Each thread needs to: 14 | // (1) call static function createVoltdbClient() to get a local VoltDB client. 15 | // (2) pass the pointer to construct PartitionedLocalFIFOScheduler. 16 | class PartitionedLocalFIFOScheduler : public VoltdbSchedulerUtil { 17 | public: 18 | PartitionedLocalFIFOScheduler(voltdb::Client* client, std::string dbAddr, 19 | int workerPartitions, int workerCapacity, 20 | int numWorkers) 21 | : VoltdbSchedulerUtil(client, dbAddr), 22 | workerPartitions_(workerPartitions), 23 | workerCapacity_(workerCapacity), 24 | numWorkers_(numWorkers){}; 25 | 26 | // Truncate the worker table; 27 | void truncateWorkerTable(); 28 | 29 | // Truncate the worker table; 30 | void truncateTaskTable(); 31 | 32 | // Insert a worker into the worker table. 33 | DbosStatus insertWorker(DbosId workerID, DbosId capacity); 34 | 35 | // Select a worker for a task and update worker capacity. 36 | // Return the selected worker id. 37 | DbosId selectWorker(DbosId taskID); 38 | 39 | // Update which worker the task is assigned to, and update worker status to 40 | // scheduled. 41 | DbosStatus assignTaskToWorker(DbosId taskId, DbosId workerId); 42 | 43 | // Complete a task, updating the capacity of its worker. 44 | DbosStatus finishTask(DbosId taskId, DbosId workerId); 45 | 46 | // Setup the database. 47 | DbosStatus setup(); 48 | 49 | // Tear down the database after benchmarking. 50 | DbosStatus teardown(); 51 | 52 | // Perform a scheduling act. 53 | DbosStatus schedule(Task* task); 54 | 55 | // Async scheduling. 56 | DbosStatus asyncSchedule( 57 | boost::shared_ptr callback); 58 | 59 | // Destructor 60 | ~PartitionedLocalFIFOScheduler() { /* placeholder for now. */ 61 | } 62 | 63 | private: 64 | int workerCapacity_; 65 | int workerPartitions_; 66 | int numWorkers_; 67 | }; 68 | 69 | #endif // #ifndef PARTITIONED_LOCAL_FIFO_SCHEDULER_H 70 | -------------------------------------------------------------------------------- /src/libs/lib_scheduler/PartitionedScanTask.h: -------------------------------------------------------------------------------- 1 | #ifndef PARTITIONED_SCAN_TASK_H 2 | #define PARTITIONED_SCAN_TASK_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "VoltdbSchedulerUtil.h" 9 | #include "voltdb-client-cpp/include/Client.h" 10 | 11 | // Since voltdb::Client only has private constructor, we cannot create a private 12 | // member variable of it. Each thread needs to: 13 | // (1) call static function createVoltdbClient() to get a local VoltDB client. 14 | // (2) pass the pointer to construct PartitionedScanTask. 15 | class PartitionedScanTask : public VoltdbSchedulerUtil { 16 | public: 17 | PartitionedScanTask(voltdb::Client* client, std::string dbAddr, 18 | int partitions, int numTasks, int numWorkers, 19 | float probMultiTx) 20 | : VoltdbSchedulerUtil(client, dbAddr), 21 | partitions_(partitions), 22 | numTasks_(numTasks), 23 | numWorkers_(numWorkers), 24 | probMultiTx_(probMultiTx){}; 25 | 26 | // Truncate the task table; 27 | void truncateTaskTable(); 28 | 29 | // Insert a task into the task table. 30 | DbosStatus insertTask(DbosId taskID); 31 | 32 | // Select a worker with most tasks. 33 | DbosId selectMostTaskWorker(); 34 | 35 | // Setup the database. 36 | DbosStatus setup(); 37 | 38 | // Tear down the database after benchmarking. 39 | DbosStatus teardown(); 40 | 41 | // Perform a scheduling act. 42 | DbosStatus schedule(Task* task); 43 | 44 | // Destructor 45 | ~PartitionedScanTask() { /* placeholder for now. */ 46 | } 47 | 48 | private: 49 | int partitions_; 50 | int numTasks_; 51 | int numWorkers_; 52 | float probMultiTx_; 53 | }; 54 | 55 | #endif // #ifndef PARTITIONED_SCAN_TASK_H 56 | -------------------------------------------------------------------------------- /src/libs/lib_scheduler/PushFIFOScheduler.cc: -------------------------------------------------------------------------------- 1 | // This file contains common utils for connecting with VoltDB 2 | #define __STDC_CONSTANT_MACROS 3 | #define __STDC_LIMIT_MACROS 4 | 5 | #include 6 | #include "voltdb-client-cpp/include/Client.h" 7 | #include "voltdb-client-cpp/include/ClientConfig.h" 8 | #include "voltdb-client-cpp/include/Parameter.hpp" 9 | #include "voltdb-client-cpp/include/ParameterSet.hpp" 10 | #include "voltdb-client-cpp/include/Row.hpp" 11 | #include "voltdb-client-cpp/include/Table.h" 12 | #include "voltdb-client-cpp/include/TableIterator.h" 13 | #include "voltdb-client-cpp/include/WireType.h" 14 | 15 | #include "PushFIFOScheduler.h" 16 | 17 | #define SUCCESS 0 18 | #define NOWORKER -2 19 | 20 | static std::atomic taskindex; 21 | 22 | void PushFIFOScheduler::truncateTaskTable() { 23 | std::vector parameterTypes(0); 24 | voltdb::Procedure procedure("TruncateTaskTable", parameterTypes); 25 | voltdb::ParameterSet* params = procedure.params(); 26 | voltdb::InvocationResponse r = client_->invoke(procedure); 27 | if (r.failure()) { 28 | std::cout << "TruncateTaskTable procedure failed. " << r.toString(); 29 | } 30 | } 31 | 32 | DbosStatus PushFIFOScheduler::selectTaskWorker(DbosId taskID) { 33 | std::vector parameterTypes(2); 34 | parameterTypes[0] = voltdb::Parameter(voltdb::WIRE_TYPE_INTEGER); 35 | parameterTypes[1] = voltdb::Parameter(voltdb::WIRE_TYPE_INTEGER); 36 | // Actual num partitions. 37 | // TODO: fix this bug. need to use actual number of partitions. 38 | int pkey = rand() % partitions_; 39 | 40 | // Try to find an available worker in the partition. 41 | for (int count = 1; count <= partitions_; ++count) { 42 | voltdb::Procedure procedure("PushTask", parameterTypes); 43 | voltdb::ParameterSet* params = procedure.params(); 44 | params->addInt32(pkey).addInt32(taskID); 45 | voltdb::InvocationResponse r = client_->invoke(procedure); 46 | if (r.failure()) { 47 | std::cout << "PushFIFOTask procedure failed. " << r.toString() 48 | << std::endl; 49 | return false; 50 | } 51 | std::vector results = r.results(); 52 | voltdb::Row row = results[0].iterator().next(); 53 | int status = row.getInt64(0); 54 | if (status == SUCCESS) { 55 | return true; 56 | } else if (status == NOWORKER) { // implementing basic functionality first 57 | // std::cout << "no worker in partition " << count << std::endl; 58 | // TODO: If there is no worker, need to check other partitions for 59 | // available workers. 60 | // TODO: If there are no available workers, put task in a buffer 61 | } 62 | pkey = (pkey + count) % partitions_; 63 | } 64 | std::cout << "went through " << partitions_ << " partitions" << std::endl; 65 | return false; 66 | } 67 | 68 | DbosStatus PushFIFOScheduler::setup() { 69 | // Clean up data from previous run. 70 | truncateTaskTable(); 71 | return true; 72 | } 73 | 74 | DbosStatus PushFIFOScheduler::teardown() { 75 | // Clean up data from previous run. 76 | truncateTaskTable(); 77 | return true; 78 | } 79 | 80 | DbosStatus PushFIFOScheduler::schedule(Task* task) { 81 | // for (int i = 0; i < numTasks_; ++i) { 82 | int taskId = taskindex.fetch_add(1); 83 | DbosStatus status = selectTaskWorker(taskId); 84 | assert(status == true); 85 | //} 86 | return true; 87 | } 88 | -------------------------------------------------------------------------------- /src/libs/lib_scheduler/PushFIFOScheduler.h: -------------------------------------------------------------------------------- 1 | #ifndef PUSH_FIFO_SCHEDULER_H 2 | #define PUSH_FIFO_SCHEDULER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "VoltdbSchedulerUtil.h" 9 | #include "voltdb-client-cpp/include/Client.h" 10 | 11 | // Since voltdb::Client only has private constructor, we cannot create a private 12 | // member variable of it. Each thread needs to: 13 | // (1) call static function createVoltdbClient() to get a local VoltDB client. 14 | // (2) pass the pointer to construct PartitionedFIFOScheduler. 15 | class PushFIFOScheduler : public VoltdbSchedulerUtil { 16 | public: 17 | PushFIFOScheduler(voltdb::Client* client, std::string dbAddr, int partitions, 18 | int numTasks, float probMultiTx) 19 | : VoltdbSchedulerUtil(client, dbAddr), 20 | partitions_(partitions), 21 | numTasks_(numTasks), 22 | probMultiTx_(probMultiTx){}; 23 | 24 | // Truncate the worker table; 25 | void truncateWorkerTable(); 26 | 27 | // Truncate the worker table; 28 | void truncateTaskTable(); 29 | 30 | // Select a worker for a task and update worker capacity and task workerid. 31 | DbosStatus selectTaskWorker(DbosId taskID); 32 | 33 | // Setup the database. 34 | DbosStatus setup(); 35 | 36 | // Tear down the database after benchmarking. 37 | DbosStatus teardown(); 38 | 39 | // Perform a scheduling act. 40 | DbosStatus schedule(Task* task); 41 | 42 | // Destructor 43 | ~PushFIFOScheduler() { /* placeholder for now. */ 44 | } 45 | 46 | private: 47 | int partitions_; 48 | int numTasks_; 49 | float probMultiTx_; 50 | }; 51 | 52 | #endif // #ifndef PUSH_FIFO_SCHEDULER_H 53 | -------------------------------------------------------------------------------- /src/libs/lib_scheduler/SchedulerServer.cpp: -------------------------------------------------------------------------------- 1 | #include "SchedulerServer.h" 2 | 3 | namespace dbos_scheduler { 4 | 5 | // Implement the frontend gRPC service here. 6 | class FrontendServiceServer final : public Frontend::Service { 7 | public: 8 | FrontendServiceServer(VoltdbSchedulerUtil* scheduler) 9 | : scheduler_(scheduler){} 10 | 11 | ~FrontendServiceServer() {} 12 | 13 | private: 14 | Status SubmitTask(ServerContext* context, const SubmitTaskRequest* request, 15 | SubmitTaskResponse* reply) override; 16 | 17 | VoltdbSchedulerUtil* scheduler_; 18 | 19 | }; // class FrontendServiceImpl 20 | 21 | /* 22 | * Receive a submitted task from the client. 23 | */ 24 | Status FrontendServiceServer::SubmitTask(ServerContext* context, const SubmitTaskRequest* request, 25 | SubmitTaskResponse* reply) { 26 | Task task = protobufToTask(request); 27 | scheduler_->schedule(&task); 28 | reply->set_status(DbosStatusEnum::SUCCESS); 29 | return Status::OK; 30 | } 31 | 32 | } // namespace dbos_scheduler 33 | 34 | /* 35 | * Actually start the gRPC server on a port number. 36 | */ 37 | void SchedulerServer::RunServer() { 38 | const std::string& port = std::to_string(port_); 39 | std::string addr = "0.0.0.0:" + port; 40 | 41 | dbos_scheduler::FrontendServiceServer service(scheduler_); 42 | ServerBuilder builder; 43 | 44 | // Listen on the given address without any authentication mechanism. 45 | builder.AddListeningPort(addr, grpc::InsecureServerCredentials()); 46 | // Register "service" as the instance through which we'll communicate with 47 | // clients. In this case it corresponds to an *synchronous* service. 48 | builder.RegisterService(&service); 49 | // Set max message size. 50 | builder.SetMaxMessageSize(INT32_MAX); 51 | 52 | // Finally, assemble the server. 53 | workerServer_ = builder.BuildAndStart(); 54 | // Wait for the server to shutdown. Note that some other thread must be 55 | // responsible for shutting down the server for this call to ever return. 56 | workerServer_->Wait(); 57 | } 58 | -------------------------------------------------------------------------------- /src/libs/lib_scheduler/SchedulerServer.h: -------------------------------------------------------------------------------- 1 | #ifndef DBOS_SCHEDULERSERVER_H 2 | #define DBOS_SCHEDULERSERVER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "VoltdbSchedulerUtil.h" 9 | #include "voltdb-client-cpp/include/Client.h" 10 | 11 | #include "MockGRPCWorker.h" 12 | #include "WorkerManager.h" 13 | 14 | class SchedulerServer { 15 | public: 16 | SchedulerServer(int port, VoltdbSchedulerUtil* scheduler) 17 | : port_(port), scheduler_(scheduler) { 18 | workerThread_ = new std::thread(&SchedulerServer::RunServer, this); 19 | while (workerServer_ == NULL) { ; } // Spin until server is online. 20 | }; 21 | 22 | ~SchedulerServer() { 23 | // Clean up data and threads. 24 | workerServer_->Shutdown(); 25 | workerThread_->join(); 26 | delete workerThread_; 27 | } 28 | 29 | private: 30 | void RunServer(); 31 | int port_; 32 | VoltdbSchedulerUtil* scheduler_; 33 | std::thread* workerThread_; 34 | std::unique_ptr workerServer_ = NULL; 35 | }; 36 | 37 | #endif // DBOS_SCHEDULERSERVER_H 38 | -------------------------------------------------------------------------------- /src/libs/lib_scheduler/SinglePartitionedFIFOTaskScheduler.h: -------------------------------------------------------------------------------- 1 | #ifndef SINGLE_PARTITIONED_FIFO_TASK_SCHEDULER_H 2 | #define SINGLE_PARTITIONED_FIFO_TASK_SCHEDULER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "VoltdbSchedulerUtil.h" 9 | #include "voltdb-client-cpp/include/Client.h" 10 | 11 | // Since voltdb::Client only has private constructor, we cannot create a private 12 | // member variable of it. Each thread needs to: 13 | // (1) call static function createVoltdbClient() to get a local VoltDB client. 14 | // (2) pass the pointer to construct PartitionedFIFOScheduler. 15 | class SinglePartitionedFIFOTaskScheduler : public VoltdbSchedulerUtil { 16 | public: 17 | SinglePartitionedFIFOTaskScheduler(voltdb::Client* client, std::string dbAddr, 18 | int partitions, int numTasks, 19 | int workerCapacity, int numWorkers, 20 | float probMultiTx) 21 | : VoltdbSchedulerUtil(client, dbAddr), 22 | partitions_(partitions), 23 | numTasks_(numTasks), 24 | workerCapacity_(workerCapacity), 25 | numWorkers_(numWorkers), 26 | probMultiTx_(probMultiTx){}; 27 | 28 | // Truncate the worker table; 29 | void truncateWorkerTable(); 30 | 31 | // Truncate the worker table; 32 | void truncateTaskTable(); 33 | 34 | // Insert a worker into the worker table. 35 | DbosStatus insertWorker(DbosId workerID, DbosId capacity); 36 | 37 | // Select a worker for a task and update worker capacity and task workerid. 38 | DbosStatus selectTaskWorker(DbosId taskID); 39 | 40 | // Setup the database. 41 | DbosStatus setup(); 42 | 43 | // Tear down the database after benchmarking. 44 | DbosStatus teardown(); 45 | 46 | // Perform a scheduling act. 47 | DbosStatus schedule(Task* task); 48 | 49 | // Async scheduling. 50 | DbosStatus asyncSchedule( 51 | boost::shared_ptr callback); 52 | 53 | // Destructor 54 | ~SinglePartitionedFIFOTaskScheduler() { /* placeholder for now. */ 55 | } 56 | 57 | private: 58 | int partitions_; 59 | int numTasks_; 60 | int workerCapacity_; 61 | int numWorkers_; 62 | float probMultiTx_; 63 | }; 64 | 65 | #endif // #ifndef SINGLE_PARTITIONED_FIFO_TASK_SCHEDULER_H 66 | -------------------------------------------------------------------------------- /src/libs/lib_scheduler/Task.h: -------------------------------------------------------------------------------- 1 | #ifndef DBOS_SCHEDULER_TASK_H 2 | #define DBOS_SCHEDULER_TASK_H 3 | 4 | #include 5 | 6 | #include "frontend.grpc.pb.h" 7 | 8 | struct Task { 9 | int targetData; 10 | int execTime; 11 | }; 12 | 13 | static dbos_scheduler::SubmitTaskRequest taskToProtobuf(Task* task) { 14 | dbos_scheduler::SubmitTaskRequest st_request; 15 | st_request.set_targetdata(task->targetData); 16 | st_request.set_exectime(task->execTime); 17 | return st_request; 18 | } 19 | 20 | static Task protobufToTask(const dbos_scheduler::SubmitTaskRequest* request) { 21 | Task task; 22 | task.targetData = request->targetdata(); 23 | task.execTime = request->exectime(); 24 | return task; 25 | } 26 | 27 | #endif // DBOS_SCHEDULER_TASK_H 28 | -------------------------------------------------------------------------------- /src/libs/lib_scheduler/VoltdbSchedulerUtil.cc: -------------------------------------------------------------------------------- 1 | // This file contains common utils for connecting with VoltDB 2 | #define __STDC_CONSTANT_MACROS 3 | #define __STDC_LIMIT_MACROS 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "voltdb-client-cpp/include/Client.h" 10 | #include "voltdb-client-cpp/include/ClientConfig.h" 11 | #include "voltdb-client-cpp/include/Parameter.hpp" 12 | #include "voltdb-client-cpp/include/ParameterSet.hpp" 13 | #include "voltdb-client-cpp/include/Row.hpp" 14 | #include "voltdb-client-cpp/include/Table.h" 15 | #include "voltdb-client-cpp/include/TableIterator.h" 16 | #include "voltdb-client-cpp/include/WireType.h" 17 | 18 | #include "VoltdbSchedulerUtil.h" 19 | 20 | VoltdbSchedulerUtil::~VoltdbSchedulerUtil() { 21 | // placeholder. 22 | } 23 | 24 | voltdb::Client VoltdbSchedulerUtil::createVoltdbClient(std::string username, 25 | std::string password) { 26 | // Create a VoltDB client, connect to the DB. 27 | // SHA-256 can be used as of VoltDB5.2 by specifying voltdb::HASH_SHA256 28 | voltdb::ClientConfig config(username, password, voltdb::HASH_SHA1); 29 | voltdb::Client client = voltdb::Client::create(config); 30 | srand(time(NULL)); 31 | return client; 32 | } 33 | 34 | VoltdbSchedulerUtil::VoltdbSchedulerUtil(voltdb::Client* client, 35 | std::string& dbAddr) 36 | : client_(client) { 37 | // Comma-separated list of hostnames or IPs. 38 | std::istringstream addrStream(dbAddr); 39 | std::string host; 40 | char delim = ','; 41 | 42 | // Method 1: Connect to each host, rely on VoltDB query affinity to route to 43 | // the correct host. 44 | // TODO: this is not the best practice. Each thread should connect to a 45 | // subset of hosts. 46 | 47 | while (std::getline(addrStream, host, delim)) { 48 | try { 49 | client_->createConnection(host); 50 | } catch (std::exception& e) { 51 | std::cerr << "An exception occured while connecting to VoltDB " << host 52 | << std::endl; 53 | std::cerr << e.what(); 54 | // TODO: more robust error handling. 55 | throw; 56 | } 57 | std::cout << "=== Connected to VoltDB at " << host << " ===\n"; 58 | } 59 | 60 | // Method 2: Randomly pick one host from the list; this may not be optimal as 61 | // well. We might need some hashing function or a way to figure out locality. 62 | /* 63 | std::vector hostlist; 64 | while (std::getline(addrStream, host, delim)) { 65 | hostlist.push_back(host); 66 | } 67 | int randIndex = rand() % hostlist.size(); 68 | host = hostlist[randIndex]; 69 | try { 70 | client_->createConnection(host); 71 | } catch (std::exception& e) { 72 | std::cerr << "An exception occured while connecting to VoltDB " << host 73 | << std::endl; 74 | std::cerr << e.what(); 75 | // TODO: more robust error handling. 76 | throw; 77 | } 78 | std::cout << "=== Connected to VoltDB at " << host << " ===\n"; 79 | */ 80 | } 81 | -------------------------------------------------------------------------------- /src/libs/lib_scheduler/VoltdbSchedulerUtil.h: -------------------------------------------------------------------------------- 1 | // This file contains common utils for connecting with VoltDB 2 | #ifndef DBOS_VOLTDB_SCHEDULER_UTIL_H 3 | #define DBOS_VOLTDB_SCHEDULER_UTIL_H 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "DbosDefs.h" 11 | #include "Task.h" 12 | #include "voltdb-client-cpp/include/Client.h" 13 | #include "voltdb-client-cpp/include/ProcedureCallback.hpp" 14 | 15 | // Note: this class is not thread safe, because voltDB client is not thread 16 | // safe. Use one instance per thread. 17 | // Since voltdb::Client only has private constructor, we cannot create a private 18 | // member variable of it. Each thread needs to: 19 | // (1) call static function createVoltdbClient() to get a local VoltDB client. 20 | // (2) pass the pointer to construct VoltdbSchedulerUtil. 21 | class VoltdbSchedulerUtil { 22 | public: 23 | VoltdbSchedulerUtil(voltdb::Client* client, std::string& dbAddr); 24 | 25 | // Schedule and execute a task, return its status when complete. 26 | virtual DbosStatus schedule(Task* task) = 0; 27 | 28 | // Async schedule. Will return immediately without waiting for response. 29 | // TODO: turn this into a pure virtual function. 30 | virtual DbosStatus asyncSchedule( 31 | boost::shared_ptr callback) { 32 | std::cerr << "Not implemented\n"; 33 | abort(); 34 | } 35 | 36 | // Send message to DB partitions starting from . 37 | // TODO: use an array of partition numbers as argument. 38 | // TODO: include message content. 39 | virtual DbosStatus asyncSendMessage( 40 | int partition, int num_partitions, 41 | boost::shared_ptr callback) { 42 | for (int i = partition; i < partition + num_partitions; ++i) { 43 | std::vector parameterTypes(1); 44 | parameterTypes[0] = voltdb::Parameter(voltdb::WIRE_TYPE_INTEGER); 45 | voltdb::Procedure procedure("SendMessage", parameterTypes); 46 | voltdb::ParameterSet* params = procedure.params(); 47 | params->addInt32(i); 48 | client_->invoke(procedure, callback); 49 | } 50 | return true; 51 | } 52 | 53 | // Broadcast message to all DB partitions using a replicated table. 54 | // TODO: include message content. 55 | virtual DbosStatus asyncBroadcastMessage( 56 | boost::shared_ptr callback) { 57 | std::vector parameterTypes(1); 58 | parameterTypes[0] = voltdb::Parameter(voltdb::WIRE_TYPE_INTEGER); 59 | voltdb::Procedure procedure("BroadcastMessage", parameterTypes); 60 | voltdb::ParameterSet* params = procedure.params(); 61 | params->addInt32(0); 62 | client_->invoke(procedure, callback); 63 | return true; 64 | } 65 | 66 | // Setup the database to benchmark. 67 | virtual DbosStatus setup() = 0; 68 | 69 | // Tear down the database after benchmarking. 70 | virtual DbosStatus teardown() = 0; 71 | 72 | // Virutal destructor so that derived classes can be freed. 73 | virtual ~VoltdbSchedulerUtil() = 0; 74 | 75 | // Create a VoltDB client and return. 76 | static voltdb::Client createVoltdbClient(std::string username, 77 | std::string password); 78 | 79 | protected: 80 | voltdb::Client* client_; 81 | }; 82 | 83 | #endif // #ifndef DBOS_VOLTDB_SCHEDULER_UTIL_H 84 | -------------------------------------------------------------------------------- /src/libs/lib_util/BenchmarkUtil.h: -------------------------------------------------------------------------------- 1 | // This file contains some common util functions for the benchmark. 2 | #ifndef DBOS_BENCHMARK_UTIL_H 3 | #define DBOS_BENCHMARK_UTIL_H 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | class BenchmarkUtil { 10 | public: 11 | // Latency stats in microseconds. 12 | struct Statistics { 13 | size_t count; 14 | double average; 15 | double stddev; 16 | double min; 17 | double max; 18 | double P50; 19 | double P90; 20 | double P95; 21 | double P99; 22 | }; 23 | 24 | // Calculate stats from rawData array of latencies, consider `count` elements. 25 | static Statistics computeStats(double* rawData, size_t count); 26 | 27 | // Get current timestamp in usec. 28 | static inline uint64_t getCurrTimeUsec() { 29 | struct timespec ts; 30 | clock_gettime(CLOCK_REALTIME, &ts); 31 | return timespecToUsec(ts); 32 | } 33 | 34 | // Post process results and write to the output file. 35 | static bool processResults(double* latencies, 36 | const std::vector& indices, 37 | const std::vector& timeStampsUsec, 38 | const std::string& outputFile, 39 | const std::string& expName, 40 | const bool outputCpuUsage = false); 41 | 42 | // Print the stats with a header. 43 | static void printStats(const Statistics& stats, const std::string& header, 44 | const double throughput); 45 | 46 | private: 47 | // Convert timespec to uint64_t timestamp in usec. 48 | static inline uint64_t timespecToUsec(const struct timespec& a) { 49 | return (uint64_t)a.tv_sec * 1000000 + (uint64_t)a.tv_nsec / 1000; 50 | } 51 | }; 52 | 53 | #endif // #ifndef DBOS_BENCHMARK_UTIL_H 54 | -------------------------------------------------------------------------------- /src/libs/lib_util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "Building DBOS scheduler libs/lib_util") 2 | 3 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 4 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) 5 | 6 | # Dependencies 7 | # Find boost static libs, statically linked to C++ runtime. 8 | set(Boost_USE_STATIC_LIBS ON) 9 | set(Boost_USE_STATIC_RUNTIME ON) 10 | 11 | find_package(Boost 1.53 COMPONENTS system thread) 12 | message(STATUS "Using Boost ${Boost_VERSION}") 13 | 14 | set(lib_util_SOURCES BenchmarkUtil.cc) 15 | add_library(lib_util STATIC ${lib_util_SOURCES}) 16 | 17 | target_include_directories(lib_util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 18 | 19 | set_target_properties(lib_util 20 | PROPERTIES 21 | ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" 22 | LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" 23 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" 24 | ) 25 | -------------------------------------------------------------------------------- /src/libs/lib_util/DbosDefs.h: -------------------------------------------------------------------------------- 1 | // This file contains some common definitions for DBOS. 2 | #ifndef DBOS_DEFS_H 3 | #define DBOS_DEFS_H 4 | 5 | #include 6 | 7 | // Used for task_id, worker_id in DBOS. 8 | // TODO: decide whether to use INT or STRING. 9 | typedef int32_t DbosId; 10 | 11 | // Used for status: true = succeeded, false = failed. 12 | typedef bool DbosStatus; 13 | 14 | 15 | #endif // #ifndef DBOS_DEFS_H 16 | -------------------------------------------------------------------------------- /src/libs/lib_util/RandomGenerator.h: -------------------------------------------------------------------------------- 1 | // Derived from 2 | // https://github.com/PlatformLab/memtier_skewsyn/blob/skewSynthetic/generator.h 3 | #ifndef RANDOM_GENERATOR_H 4 | #define RANDOM_GENERATOR_H 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | // Generator types are based on distribution type. 13 | // Given a request rate, a generator will return the arrival interval in 14 | // seconds. 15 | // Basic class will always return 0 16 | // Now we support Poisson and Uniform, will add more as needed. 17 | class Generator { 18 | public: 19 | Generator() {} 20 | virtual ~Generator() {} 21 | 22 | virtual double generate() = 0; 23 | // Return false if no change is made 24 | virtual bool setreqRate(double lambda) = 0; 25 | virtual double getreqRate() = 0; 26 | 27 | static std::random_device rd_; 28 | }; 29 | 30 | // Fixed interval. Will always return a fixed value based on request rate. 31 | class Fixed : public Generator { 32 | public: 33 | Fixed(double reqRate = 1.0) { updateInterval(reqRate); } 34 | 35 | virtual double generate() override { return interval_; } 36 | 37 | virtual bool setreqRate(double reqRate) override { updateInterval(reqRate); } 38 | 39 | virtual double getreqRate() override { 40 | if (interval_ <= 0.0) { 41 | return -1.0; 42 | } else { 43 | return 1.0 / interval_; 44 | } 45 | } 46 | 47 | private: 48 | inline void updateInterval(double reqRate) { 49 | // If reqRate <= 0, set interval to 0. Basically no delay to send the next 50 | // request. 51 | if (reqRate <= 0.0) { 52 | interval_ = 0.0; 53 | } else { 54 | interval_ = 1.0 / reqRate; 55 | } 56 | return; 57 | } 58 | 59 | double interval_; 60 | }; 61 | 62 | // Poisson distribution, lambda is creations per second 63 | class Poisson : public Generator { 64 | public: 65 | Poisson(double reqRate = 1.0) 66 | : lambda_(reqRate), gen(rd_()), expIG(reqRate) {} 67 | 68 | virtual double generate() override { 69 | if (this->lambda_ <= 0.0) return 86400; // 24 hours! 70 | return this->expIG(gen); 71 | } 72 | 73 | virtual bool setreqRate(double lambda) override { 74 | if (this->lambda_ == lambda_) return false; 75 | this->lambda_ = lambda; 76 | if (lambda > 0.0) { 77 | this->expIG.param( 78 | std::exponential_distribution::param_type(lambda)); 79 | } 80 | return true; 81 | } 82 | 83 | virtual double getreqRate() override { return this->lambda_; } 84 | 85 | private: 86 | double lambda_; 87 | std::mt19937 gen; 88 | std::exponential_distribution expIG; 89 | }; 90 | 91 | // Uniform distribution, lambda is creations per second 92 | // We want the average value to be consistent with the expectation 93 | // So we need to use 2.0 instead of 1.0 when setting max value. 94 | class Uniform : public Generator { 95 | public: 96 | Uniform(double reqRate = 1.0) 97 | : lambda_(reqRate), gen(rd_()), uniformIG(0, 2.0 / reqRate) {} 98 | 99 | virtual double generate() override { 100 | if (this->lambda_ <= 0.0) return 86400; 101 | return this->uniformIG(gen); 102 | } 103 | 104 | virtual bool setreqRate(double lambda) override { 105 | if (this->lambda_ == lambda) return false; 106 | this->lambda_ = lambda; 107 | if (lambda > 0.0) { 108 | this->uniformIG.param( 109 | std::uniform_real_distribution::param_type(0, 2.0 / lambda)); 110 | } 111 | return true; 112 | } 113 | 114 | virtual double getreqRate() override { return this->lambda_; } 115 | 116 | private: 117 | double lambda_; 118 | std::mt19937 gen; 119 | std::uniform_real_distribution uniformIG; 120 | }; 121 | 122 | // A uniformly-distributed int random generator 123 | // Used to seed the mt19937 pseudo-random generator 124 | std::random_device Generator::rd_; 125 | 126 | #endif // #ifndef RANDOM_GENERATOR_H 127 | -------------------------------------------------------------------------------- /src/libs/lib_worker/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "Building DBOS scheduler libs/lib_worker") 2 | 3 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 4 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) 5 | 6 | # Dependencies 7 | # Find boost static libs, statically linked to C++ runtime. 8 | set(Boost_USE_STATIC_LIBS ON) 9 | set(Boost_USE_STATIC_RUNTIME ON) 10 | 11 | find_package(Boost 1.53 COMPONENTS system thread) 12 | message(STATUS "Using Boost ${Boost_VERSION}") 13 | 14 | set(lib_worker_SOURCES Executor.cc WorkerManager.cc MockExecutor.cc MockPollWorker.cc MockHTTPWorker.cc MockGRPCWorker.cc) 15 | add_library(lib_worker STATIC ${lib_worker_SOURCES}) 16 | 17 | # For worker simulation 18 | target_include_directories(lib_worker PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 19 | target_link_libraries(lib_worker 20 | dbos-scheduler-protos 21 | ${_VOLTDB_LIBS_PATH}/libvoltdbcpp.a 22 | ${_VOLTDB_LIBS_PATH}/libevent.a 23 | ${_VOLTDB_LIBS_PATH}/libevent_openssl.a 24 | ${_VOLTDB_LIBS_PATH}/libevent_pthreads.a 25 | ${_VOLTDB_LIBS_PATH}/libssl.a 26 | ${_VOLTDB_LIBS_PATH}/libcrypto.a 27 | pthread Boost::system Boost::thread dl 28 | lib_util 29 | ) 30 | 31 | set_target_properties(lib_worker 32 | PROPERTIES 33 | ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" 34 | LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" 35 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" 36 | ) 37 | -------------------------------------------------------------------------------- /src/libs/lib_worker/Executor.cc: -------------------------------------------------------------------------------- 1 | #include "Executor.h" 2 | 3 | Executor::~Executor(){}; 4 | -------------------------------------------------------------------------------- /src/libs/lib_worker/Executor.h: -------------------------------------------------------------------------------- 1 | #ifndef EXECUTOR_H 2 | #define EXECUTOR_H 3 | 4 | #include "DbosDefs.h" 5 | 6 | class Executor { 7 | public: 8 | // Task state. 9 | Executor(){}; 10 | 11 | // TODO: Use Task as an argument here. 12 | virtual DbosStatus executeTask() = 0; 13 | 14 | // Virtual destructor so that derived classes can be freed. 15 | virtual ~Executor() = 0; 16 | }; 17 | 18 | #endif // #ifndef EXECUTOR_H 19 | -------------------------------------------------------------------------------- /src/libs/lib_worker/MockExecutor.cc: -------------------------------------------------------------------------------- 1 | #include "MockExecutor.h" 2 | 3 | DbosStatus MockExecutor::executeTask() { return true; } 4 | -------------------------------------------------------------------------------- /src/libs/lib_worker/MockExecutor.h: -------------------------------------------------------------------------------- 1 | #ifndef MOCK_EXECUTOR_H 2 | #define MOCK_EXECUTOR_H 3 | 4 | #include "Executor.h" 5 | 6 | class MockExecutor : public Executor { 7 | public: 8 | MockExecutor() : Executor(){}; 9 | 10 | DbosStatus executeTask(); 11 | 12 | ~MockExecutor(){ 13 | /* placeholder for now. */ 14 | }; 15 | 16 | private: 17 | }; 18 | 19 | #endif // #ifndef MOCK_EXECUTOR_H 20 | -------------------------------------------------------------------------------- /src/libs/lib_worker/MockGRPCWorker.h: -------------------------------------------------------------------------------- 1 | #ifndef MOCK_GRPC_WORKER_H 2 | #define MOCK_GRPC_WORKER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "MockExecutor.h" 13 | #include "WorkerManager.h" 14 | #include "voltdb-client-cpp/include/Client.h" 15 | 16 | #include 17 | 18 | #include "frontend.grpc.pb.h" 19 | 20 | using grpc::Server; 21 | using grpc::ServerBuilder; 22 | using grpc::ServerContext; 23 | using grpc::Status; 24 | using grpc::Channel; 25 | using grpc::ClientContext; 26 | using grpc::Status; 27 | 28 | class MockGRPCWorker : public WorkerManager { 29 | public: 30 | MockGRPCWorker(voltdb::Client* voltdbClient, int workerId, 31 | int workerPartitions, int capacity, 32 | std::vector workerData) 33 | : client_(voltdbClient), 34 | WorkerManager(workerId, "example"), 35 | workerData_(workerData), 36 | capacity_(capacity), 37 | workerPartitions_(workerPartitions){}; 38 | 39 | // Setup the worker. 40 | // E.g., setup dispatch thread, and multiple executor threads. 41 | DbosStatus startServing(); 42 | 43 | // Stop the worker (all executor and dispatch threads) and free up resources. 44 | DbosStatus endServing(); 45 | 46 | void RunServer(const std::string& port); 47 | 48 | // Destructor 49 | ~MockGRPCWorker() { /* placeholder for now. */ 50 | } 51 | 52 | private: 53 | voltdb::Client* client_; 54 | int workerPartitions_; 55 | int capacity_; 56 | std::vector workerData_; 57 | std::unique_ptr executor_; 58 | std::vector 59 | threads_; // including dispatch and executor threads 60 | bool stopDispatch_ = false; 61 | std::thread* workerThread_; 62 | std::unique_ptr workerServer_ = NULL; 63 | }; 64 | 65 | #endif // #ifndef MOCK_GRPC_WORKER_H 66 | -------------------------------------------------------------------------------- /src/libs/lib_worker/MockHTTPWorker.cc: -------------------------------------------------------------------------------- 1 | // This file contains common utils for connecting with VoltDB 2 | #define __STDC_CONSTANT_MACROS 3 | #define __STDC_LIMIT_MACROS 4 | 5 | #include 6 | #include 7 | #include 8 | #include "voltdb-client-cpp/include/Client.h" 9 | #include "voltdb-client-cpp/include/ClientConfig.h" 10 | #include "voltdb-client-cpp/include/Parameter.hpp" 11 | #include "voltdb-client-cpp/include/ParameterSet.hpp" 12 | #include "voltdb-client-cpp/include/Row.hpp" 13 | #include "voltdb-client-cpp/include/Table.h" 14 | #include "voltdb-client-cpp/include/TableIterator.h" 15 | #include "voltdb-client-cpp/include/WireType.h" 16 | 17 | #include "MockHTTPWorker.h" 18 | 19 | #define HTTPSERVER_IMPL 20 | #include "httpserver.h" 21 | 22 | thread_local MockHTTPWorker* worker; 23 | 24 | DbosStatus MockHTTPWorker::startServing() { 25 | std::cout << "Setup worker " << workerId_ << std::endl; 26 | 27 | // Add the Worker to the database. 28 | std::vector parameterTypes(4); 29 | parameterTypes[0] = voltdb::Parameter(voltdb::WIRE_TYPE_INTEGER); 30 | parameterTypes[1] = voltdb::Parameter(voltdb::WIRE_TYPE_INTEGER); 31 | parameterTypes[2] = voltdb::Parameter(voltdb::WIRE_TYPE_INTEGER); 32 | parameterTypes[3] = voltdb::Parameter(voltdb::WIRE_TYPE_STRING); 33 | 34 | voltdb::Procedure procedure("InsertWorker", parameterTypes); 35 | voltdb::ParameterSet* params = procedure.params(); 36 | params->addInt32(workerId_) 37 | .addInt32(999999999 /*capacity*/) 38 | .addInt32(pkey_) 39 | .addString("http://localhost:" + std::to_string(9090 + workerId_)); 40 | voltdb::InvocationResponse r = client_->invoke(procedure); 41 | if (r.failure()) { 42 | std::cout << "InsertWorker procedure failed. " << r.toString(); 43 | return false; 44 | } 45 | 46 | // Start dispatch thread. 47 | threads_.push_back(new std::thread(&MockHTTPWorker::dispatch, this)); 48 | return true; 49 | } 50 | 51 | DbosStatus MockHTTPWorker::endServing() { 52 | // Clean up data and threads. 53 | std::cout << "Stop worker " << workerId_ << std::endl; 54 | stopDispatch_ = true; 55 | return true; 56 | } 57 | 58 | #define RESPONSE "Hello, World!" 59 | void MockHTTPWorker::handle_request(struct http_request_s* request) { 60 | struct http_string_s taskIdRaw = http_request_header(request, "taskID"); 61 | std::string taskIdStr(taskIdRaw.buf, taskIdRaw.len); 62 | int taskId = std::stoi(taskIdStr); 63 | 64 | struct http_response_s* response = http_response_init(); 65 | http_response_status(response, 200); 66 | http_response_header(response, "Content-Type", "text/plain"); 67 | http_response_body(response, RESPONSE, sizeof(RESPONSE) - 1); 68 | http_respond(request, response); 69 | 70 | // TODO Do some work or sleep here... 71 | WorkerManager::totalTasks_.fetch_add(1); 72 | 73 | // Signal completion to the database. 74 | std::vector parameterTypes(4); 75 | parameterTypes[0] = voltdb::Parameter(voltdb::WIRE_TYPE_INTEGER); 76 | parameterTypes[1] = voltdb::Parameter(voltdb::WIRE_TYPE_INTEGER); 77 | parameterTypes[2] = voltdb::Parameter(voltdb::WIRE_TYPE_INTEGER); 78 | parameterTypes[3] = voltdb::Parameter(voltdb::WIRE_TYPE_INTEGER); 79 | 80 | voltdb::Procedure procedure("WorkerUpdateTask", parameterTypes); 81 | voltdb::ParameterSet* params = procedure.params(); 82 | params->addInt32(worker->pkey_) 83 | .addInt32(worker->workerId_) 84 | .addInt32(taskId) 85 | .addInt32(COMPLETE); 86 | voltdb::InvocationResponse r = worker->client_->invoke(procedure); 87 | if (r.failure()) { 88 | std::cout << "WorkerUpdateTask procedure failed. " << r.toString(); 89 | } 90 | } 91 | 92 | void MockHTTPWorker::dispatch() { 93 | // Store worker pointer to access it from the request handling function. 94 | worker = this; 95 | 96 | std::cout << "Listen for HTTP requests for worker " << workerId_ << "\n"; 97 | struct http_server_s* server = 98 | http_server_init(9090 + workerId_, handle_request); 99 | http_server_listen_poll(server); 100 | do { http_server_poll(server); } while (!stopDispatch_); 101 | } 102 | 103 | void MockHTTPWorker::execute(int execId) { 104 | // No-op for HTTP server. 105 | } 106 | -------------------------------------------------------------------------------- /src/libs/lib_worker/MockHTTPWorker.h: -------------------------------------------------------------------------------- 1 | #ifndef MOCK_HTTP_WORKER_H 2 | #define MOCK_HTTP_WORKER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "MockExecutor.h" 13 | #include "WorkerManager.h" 14 | #include "httpserver.h" 15 | #include "voltdb-client-cpp/include/Client.h" 16 | 17 | class MockHTTPWorker : public WorkerManager { 18 | public: 19 | MockHTTPWorker(voltdb::Client* voltdbClient, int workerId, int pkey, 20 | std::string dbAddr) 21 | : client_(voltdbClient), WorkerManager(workerId, dbAddr), pkey_(pkey) { 22 | executor_ = new MockExecutor(); 23 | }; 24 | 25 | // Dispatch tasks that are assigned to this worker. 26 | // Potentially run in a dedicated dispatch thread. 27 | void dispatch(); 28 | static void handle_request(struct http_request_s* request); 29 | 30 | // Execute tasks. Potentially run in dedicated executor thread pool. 31 | // Borrow ideas from: 32 | // https://github.com/embeddedartistry/embedded-resources/blob/master/examples/cpp/dispatch.cpp 33 | void execute(int execId); 34 | 35 | // Setup the worker. 36 | // E.g., setup dispatch thread, and multiple executor threads. 37 | DbosStatus startServing(); 38 | 39 | // Stop the worker (all executor and dispatch threads) and free up resources. 40 | DbosStatus endServing(); 41 | 42 | // Destructor 43 | ~MockHTTPWorker() { delete executor_; } 44 | 45 | private: 46 | voltdb::Client* client_; 47 | MockExecutor* executor_; 48 | int pkey_; 49 | std::vector 50 | threads_; // including dispatch and executor threads 51 | bool stopDispatch_ = false; 52 | }; 53 | 54 | #endif // #ifndef MOCK_HTTP_WORKER_H 55 | -------------------------------------------------------------------------------- /src/libs/lib_worker/MockPollWorker.h: -------------------------------------------------------------------------------- 1 | #ifndef MOCK_POLL_WORKER_H 2 | #define MOCK_POLL_WORKER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "WorkerManager.h" 13 | #include "voltdb-client-cpp/include/Client.h" 14 | 15 | class MockPollWorker : public WorkerManager { 16 | public: 17 | MockPollWorker(int workerId, int pkey, std::string dbAddr, int numExecutors, 18 | int topk) 19 | : WorkerManager(workerId, dbAddr), 20 | pkey_(pkey), 21 | numExecutors_(numExecutors), 22 | topk_(topk){}; 23 | 24 | // Dispatch tasks that are assigned to this worker. 25 | // Potentially run in a dedicated dispatch thread. 26 | void dispatch(); 27 | 28 | // Execute tasks. Potentially run in dedicated executor thread pool. 29 | // Borrow ideas from: 30 | // https://github.com/embeddedartistry/embedded-resources/blob/master/examples/cpp/dispatch.cpp 31 | void execute(int execId); 32 | 33 | // Setup the worker. 34 | // E.g., setup dispatch thread, and multiple executor threads. 35 | DbosStatus startServing(); 36 | 37 | // Stop the worker (all executor and dispatch threads) and free up resources. 38 | DbosStatus endServing(); 39 | 40 | // Destructor 41 | ~MockPollWorker() { /* placeholder for now. */ 42 | } 43 | 44 | private: 45 | int pkey_; 46 | int numExecutors_; 47 | std::mutex lock_; // protect the access to shared taskQueue_ 48 | std::vector 49 | threads_; // including dispatch and executor threads 50 | std::queue taskQueue_; // queue of task Ids 51 | std::condition_variable cv_; // used to sync dispatch queue and executors 52 | bool stopDispatch_ = false; 53 | int topk_; // Select top-K tasks in a batch 54 | }; 55 | 56 | #endif // #ifndef MOCK_POLL_WORKER_H 57 | -------------------------------------------------------------------------------- /src/libs/lib_worker/WorkerManager.cc: -------------------------------------------------------------------------------- 1 | // This file contains common utils for connecting with VoltDB 2 | #define __STDC_CONSTANT_MACROS 3 | #define __STDC_LIMIT_MACROS 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "voltdb-client-cpp/include/Client.h" 10 | #include "voltdb-client-cpp/include/ClientConfig.h" 11 | #include "voltdb-client-cpp/include/Parameter.hpp" 12 | #include "voltdb-client-cpp/include/ParameterSet.hpp" 13 | #include "voltdb-client-cpp/include/Row.hpp" 14 | #include "voltdb-client-cpp/include/Table.h" 15 | #include "voltdb-client-cpp/include/TableIterator.h" 16 | #include "voltdb-client-cpp/include/WireType.h" 17 | 18 | #include "WorkerManager.h" 19 | 20 | // Synthetic username, passwd. 21 | static const std::string kTestUser = "testuser"; 22 | static const std::string kTestPwd = "testpassword"; 23 | 24 | std::atomic WorkerManager::totalTasks_; 25 | std::atomic WorkerManager::totalFinishedTasks_; 26 | 27 | WorkerManager::~WorkerManager() { 28 | // placeholder. 29 | } 30 | 31 | voltdb::Client WorkerManager::createVoltdbClient(std::string dbAddr) { 32 | // Create a VoltDB client, connect to the DB. 33 | // SHA-256 can be used as of VoltDB5.2 by specifying voltdb::HASH_SHA256 34 | voltdb::ClientConfig config(kTestUser, kTestPwd, voltdb::HASH_SHA1); 35 | voltdb::Client client = voltdb::Client::create(config); 36 | srand(time(NULL)); 37 | 38 | // Comma-separated list of hostnames or IPs. 39 | std::istringstream addrStream(dbAddr); 40 | std::string host; 41 | char delim = ','; 42 | 43 | // TODO:for now every scheduler/worker would randomly connect to one host and 44 | // all queries will go through that host. We may develop some 45 | // locality/affinity, or hashing methods, to improve the locality. 46 | // Method 2: Randomly pick one host from the list; this may not be optimal as 47 | // well. We might need some hashing function or a way to figure out locality. 48 | std::vector hostlist; 49 | while (std::getline(addrStream, host, delim)) { hostlist.push_back(host); } 50 | int randIndex = rand() % hostlist.size(); 51 | host = hostlist[randIndex]; 52 | try { 53 | client.createConnection(host); 54 | } catch (std::exception& e) { 55 | std::cerr << "An exception occured while connecting to VoltDB " << host 56 | << std::endl; 57 | std::cerr << e.what(); 58 | // TODO: more robust error handling. 59 | throw; 60 | } 61 | 62 | return client; 63 | } 64 | 65 | WorkerManager::WorkerManager(DbosId workerId, std::string dbAddr) 66 | : workerId_(workerId), dbAddr_(dbAddr), stop_(false) {} 67 | -------------------------------------------------------------------------------- /src/libs/lib_worker/WorkerManager.h: -------------------------------------------------------------------------------- 1 | // This file contains common utils for connecting with VoltDB 2 | #ifndef DBOS_WORKER_MANAGER_H 3 | #define DBOS_WORKER_MANAGER_H 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "DbosDefs.h" 10 | #include "voltdb-client-cpp/include/Client.h" 11 | 12 | // Note: Because voltDB client is not thread safe, use one VoltDB client 13 | // instance per thread. 14 | // Since voltdb::Client only has private constructor, we cannot create a private 15 | // member variable of it. Each thread needs to: 16 | // Call static function createVoltdbClient() to get a local VoltDB client. 17 | class WorkerManager { 18 | public: 19 | // Task state. 20 | enum TaskState { UNKNOWN = 0, PENDING, RUNNING, COMPLETE }; 21 | WorkerManager(DbosId workerId, std::string dbAddr); 22 | 23 | // Setup the worker. 24 | // E.g., setup dispatch thread, and multiple executor threads. 25 | virtual DbosStatus startServing() = 0; 26 | 27 | // Stop the worker and free up resources. 28 | virtual DbosStatus endServing() = 0; 29 | 30 | // Virutal destructor so that derived classes can be freed. 31 | virtual ~WorkerManager() = 0; 32 | 33 | // Create a VoltDB client and return. 34 | static voltdb::Client createVoltdbClient(std::string dbAddr); 35 | 36 | static std::atomic totalTasks_; 37 | static std::atomic totalFinishedTasks_; 38 | std::string workerAddr; 39 | 40 | protected: 41 | std::string dbAddr_; // Address to VoltDB server. 42 | DbosId workerId_; // DBOS worker id. 43 | bool stop_; // If true, stop all threads. 44 | }; 45 | 46 | #endif // #ifndef DBOS_WORKER_MANAGER_H 47 | -------------------------------------------------------------------------------- /src/simulation/TestPartitionedFIFOScheduler.cc: -------------------------------------------------------------------------------- 1 | // Test functionality of VoltdbClientUtil. 2 | 3 | #include 4 | #include 5 | 6 | #include "PartitionedFIFOScheduler.h" 7 | #include "voltdb-client-cpp/include/Client.h" 8 | 9 | int main(int argc, char** argv) { 10 | voltdb::Client voltdbClient = 11 | PartitionedFIFOScheduler::createVoltdbClient("testuser", "testpwd"); 12 | PartitionedFIFOScheduler scheduler(&voltdbClient, "localhost", 8, 2, 2); 13 | 14 | // Insert then Select a worker. 15 | scheduler.truncateWorkerTable(); 16 | DbosStatus ret = scheduler.setup(); 17 | auto workerId = scheduler.selectWorker(); 18 | std::cout << "Selected: " << workerId << std::endl; 19 | 20 | // Assign the task to worker. 21 | DbosId taskId(1); 22 | ret = scheduler.assignTaskToWorker(taskId, workerId); 23 | 24 | ret = scheduler.finishTask(taskId, workerId); 25 | 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /src/simulation/TestPartitionedScanTask.cc: -------------------------------------------------------------------------------- 1 | // Test functionality of PartitionedScanTask. 2 | 3 | #include 4 | #include 5 | 6 | #include "PartitionedScanTask.h" 7 | #include "VoltdbSchedulerUtil.h" 8 | #include "voltdb-client-cpp/include/Client.h" 9 | 10 | int main(int argc, char** argv) { 11 | voltdb::Client voltdbClient = 12 | VoltdbSchedulerUtil::createVoltdbClient("testuser", "testpwd"); 13 | PartitionedScanTask scheduler(&voltdbClient, "localhost", 8, 2, 2, 1.0); 14 | 15 | // Insert then Select a worker. 16 | DbosStatus ret = scheduler.setup(); 17 | DbosId workerId; 18 | workerId = scheduler.selectMostTaskWorker(); 19 | std::cout << "Selected: " << workerId << std::endl; 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /src/simulation/TestSparkScheduler.cc: -------------------------------------------------------------------------------- 1 | // Test functionality of SparkScheduler. 2 | 3 | #include 4 | #include 5 | 6 | #include "SparkScheduler.h" 7 | #include "voltdb-client-cpp/include/Client.h" 8 | 9 | int main(int argc, char** argv) { 10 | voltdb::Client voltdbClient = 11 | SparkScheduler::createVoltdbClient("testuser", "testpwd"); 12 | // Client - Host - Partitions - Capacity - numWorkers 13 | SparkScheduler scheduler(&voltdbClient, "localhost", 1, 1, 2); 14 | 15 | // Insert then Select a worker. 16 | DbosStatus ret = scheduler.setup(); 17 | assert(ret); 18 | DbosId workerId; 19 | 20 | Task* task = new Task; 21 | task->execTime = 1000; 22 | 23 | task->targetData = 1; 24 | scheduler.schedule(task); 25 | 26 | task->targetData = 0; 27 | scheduler.schedule(task); 28 | 29 | task->targetData = 1; 30 | scheduler.schedule(task); 31 | 32 | task->targetData = 0; 33 | scheduler.schedule(task); 34 | 35 | task->targetData = 0; 36 | scheduler.schedule(task); 37 | 38 | delete task; 39 | 40 | scheduler.teardown(); 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/AuthenticationRequest.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of VoltDB. 2 | * Copyright (C) 2008-2018 VoltDB Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 | * OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef VOLTDB_AUTHENTICATIONMESSAGE_HPP_ 25 | #define VOLTDB_AUTHENTICATIONMESSAGE_HPP_ 26 | #include "ByteBuffer.hpp" 27 | 28 | namespace voltdb { 29 | class AuthenticationRequest { 30 | public: 31 | AuthenticationRequest(const std::string &username, 32 | const std::string &service, 33 | unsigned char* passwordHash, 34 | ClientAuthHashScheme hashScheme) : m_username(username), 35 | m_service(service), 36 | m_passwordHash(passwordHash), 37 | m_hashScheme(hashScheme) { 38 | } 39 | 40 | int32_t getSerializedSize() { 41 | int sz = 8 //String length prefixes 42 | + (m_hashScheme == HASH_SHA256 ? 32 : 20) //SHA-1 hash of PW 43 | + static_cast (m_username.size()) 44 | + static_cast (m_service.size()) 45 | + 4 //length prefix 46 | + 1 //version number 47 | + 1; //scheme 48 | return sz; 49 | } 50 | 51 | void serializeTo(ByteBuffer *buffer) { 52 | buffer->position(4); 53 | buffer->putInt8(1); // Always version 1. 54 | buffer->putInt8(m_hashScheme); //scheme. 55 | buffer->putString(m_service); 56 | buffer->putString(m_username); 57 | buffer->put(reinterpret_cast (m_passwordHash), (m_hashScheme == HASH_SHA1 ? 20 : 32)); 58 | buffer->flip(); 59 | buffer->putInt32(0, buffer->limit() - 4); 60 | } 61 | private: 62 | const std::string m_username; 63 | const std::string m_service; 64 | unsigned char* m_passwordHash; 65 | ClientAuthHashScheme m_hashScheme; 66 | }; 67 | } 68 | 69 | #endif /* VOLTDB_AUTHENTICATIONMESSAGE_HPP_ */ 70 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/AuthenticationResponse.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of VoltDB. 2 | * Copyright (C) 2008-2018 VoltDB Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 | * OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef VOLTDB_AUTHENTICATIONRESPONSE_HPP_ 25 | #define VOLTDB_AUTHENTICATIONRESPONSE_HPP_ 26 | #include "ByteBuffer.hpp" 27 | namespace voltdb { 28 | class AuthenticationResponse { 29 | public: 30 | AuthenticationResponse() {} 31 | AuthenticationResponse(ByteBuffer &buf) { 32 | char version = buf.getInt8(); 33 | assert(version == 0); 34 | m_resultCode = buf.getInt8(); 35 | if (m_resultCode != 0) { 36 | return; 37 | } 38 | m_hostId = buf.getInt32(); 39 | m_connectionId = buf.getInt64(); 40 | m_clusterStartTime = buf.getInt64(); 41 | m_leaderAddress = buf.getInt32(); 42 | bool wasNull = false; 43 | m_buildString = buf.getString(wasNull); 44 | assert(!wasNull); 45 | } 46 | 47 | bool success() { 48 | return m_resultCode == 0; 49 | } 50 | 51 | int32_t getHostId() const { return m_hostId; } 52 | int32_t getConnectionId() const { return m_connectionId; } 53 | int64_t getClusterStartTime() const { return m_clusterStartTime; } 54 | int32_t getLeaderAddress() const { return m_leaderAddress; } 55 | std::string getBuildString() const { return m_buildString; } 56 | 57 | private: 58 | int8_t m_resultCode; 59 | int32_t m_hostId; 60 | int64_t m_connectionId; 61 | int64_t m_clusterStartTime; 62 | int32_t m_leaderAddress; 63 | std::string m_buildString; 64 | }; 65 | } 66 | 67 | #endif /* VOLTDB_AUTHENTICATIONRESPONSE_HPP_ */ 68 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/ClientConfig.h: -------------------------------------------------------------------------------- 1 | /* This file is part of VoltDB. 2 | * Copyright (C) 2008-2018 VoltDB Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 | * OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef VOLTDB_CLIENTCONFIG_H_ 25 | #define VOLTDB_CLIENTCONFIG_H_ 26 | #include 27 | #include "StatusListener.h" 28 | #include 29 | 30 | namespace voltdb { 31 | 32 | enum ClientAuthHashScheme { HASH_SHA1, HASH_SHA256 }; 33 | 34 | class ClientConfig { 35 | public: 36 | ClientConfig( 37 | std::string username = std::string(""), 38 | std::string password = std::string(""), 39 | ClientAuthHashScheme scheme = HASH_SHA1, bool enableAbandon = false, 40 | bool enableQueryTimeout = false, int timeoutInSec = DEFAULT_QUERY_TIMEOUT_SEC, 41 | bool useSSL = false); 42 | 43 | ClientConfig( 44 | std::string username, 45 | std::string password, 46 | boost::shared_ptr listener, 47 | ClientAuthHashScheme scheme = HASH_SHA1, bool enableAbandon = false, 48 | bool enableQueryTimeout = false, int timeoutInSec = DEFAULT_QUERY_TIMEOUT_SEC, 49 | bool useSSL = false); 50 | 51 | ClientConfig( 52 | std::string username, 53 | std::string password, 54 | StatusListener *listener, 55 | ClientAuthHashScheme scheme = HASH_SHA1, bool enableAbandon = false, 56 | bool enableQueryTimeout = false, int timeoutInSec = DEFAULT_QUERY_TIMEOUT_SEC, 57 | bool useSSL = false); 58 | std::string m_username; 59 | std::string m_password; 60 | boost::shared_ptr m_listener; 61 | int32_t m_maxOutstandingRequests; 62 | ClientAuthHashScheme m_hashScheme; 63 | bool m_enableAbandon; 64 | bool m_enableQueryTimeout; 65 | timeval m_queryTimeout; 66 | timeval m_scanIntervalForTimedoutQuery; 67 | bool m_useSSL; 68 | private: 69 | static const int8_t DEFAULT_QUERY_TIMEOUT_SEC = 10; 70 | static const int8_t DEFAULT_SCAN_INTERVAL_FOR_EXPIRED_REQUESTS_SEC = 2; 71 | }; 72 | } 73 | 74 | #endif /* VOLTDB_CLIENTCONFIG_H_ */ 75 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/ClientLogger.h: -------------------------------------------------------------------------------- 1 | /* This file is part of VoltDB. 2 | * Copyright (C) 2008-2018 VoltDB Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 | * OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef VOLT_CLIENTLOGGER_H_ 25 | #define VOLT_CLIENTLOGGER_H_ 26 | #include 27 | 28 | 29 | namespace voltdb { 30 | /* 31 | * A Client logger is the callback interface for recieving log messages from VoltClient component 32 | */ 33 | 34 | class ClientLogger { 35 | public: 36 | /* 37 | * @brief Values that represent logging levels. 38 | */ 39 | enum CLIENT_LOG_LEVEL { 40 | ERROR = 1, 41 | WARNING = 2, 42 | INFO = 4, 43 | DEBUG = 8, 44 | }; 45 | 46 | /* 47 | * Log a message with it's severity level. No Client API must called from that callback callback 48 | * 49 | * @param severity Logging level. See ::CLIENT_LOG_LEVEL for possible values 50 | * @param message A message to be logged 51 | */ 52 | virtual void log(const CLIENT_LOG_LEVEL severity, const std::string &message) = 0; 53 | 54 | virtual ~ClientLogger() {} 55 | }; 56 | 57 | } 58 | 59 | #endif /* VOLT_CLIENTLOGGER_H_ */ 60 | 61 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/Column.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of VoltDB. 2 | * Copyright (C) 2008-2018 VoltDB Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 | * OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef VOLTDB_COLUMN_HPP_ 25 | #define VOLTDB_COLUMN_HPP_ 26 | #include "Column.hpp" 27 | #include "WireType.h" 28 | #include 29 | namespace voltdb { 30 | class Column { 31 | public: 32 | Column() : m_name(""), m_type(WIRE_TYPE_INVALID) {} 33 | Column(std::string name, WireType type) : m_name(name), m_type(type) {} 34 | Column(WireType type) : m_name(""), m_type(type) {} 35 | std::string m_name; 36 | WireType m_type; 37 | 38 | const std::string& name() const { 39 | return m_name; 40 | } 41 | 42 | WireType type() const { 43 | return m_type; 44 | } 45 | 46 | bool operator==(const Column& rhs) const { 47 | if (this == &rhs) return true; 48 | return (m_type == rhs.m_type && m_name == rhs.m_name); 49 | } 50 | 51 | bool operator!=(const Column& rhs) const { 52 | if (this == &rhs) return false; 53 | return (m_type != rhs.m_type || m_name != rhs.m_name); 54 | } 55 | 56 | }; 57 | } 58 | #endif /* COLUMN_HPP_ */ 59 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/ConnectionPool.h: -------------------------------------------------------------------------------- 1 | /* This file is part of VoltDB. 2 | * Copyright (C) 2008-2018 VoltDB Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 | * OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef VOLT_CONNECTION_POOL_H_ 25 | #define VOLT_CONNECTION_POOL_H_ 26 | #include "Client.h" 27 | #include "StatusListener.h" 28 | #include 29 | #include 30 | #include 31 | 32 | namespace voltdb { 33 | 34 | class ConnectionPool; 35 | class ClientStuff; 36 | typedef std::vector > ClientSet; 37 | typedef std::map > > ClientMap; 38 | 39 | void cleanupOnScriptEnd(ClientSet *clients); 40 | 41 | /* 42 | * A VoltDB connection pool. Geared towards invocation from scripting languages 43 | * where a script will run, acquire several client instances, and then terminate. 44 | */ 45 | class ConnectionPool { 46 | friend void cleanupOnScriptEnd(void *); 47 | public: 48 | ConnectionPool(); 49 | virtual ~ConnectionPool(); 50 | 51 | /* 52 | * Retrieve a client that connects to the specified hostname and port using the provided username and password 53 | */ 54 | voltdb::Client acquireClient(std::string hostname, std::string username, std::string password, unsigned short port = 21212, ClientAuthHashScheme sha = HASH_SHA1) throw (voltdb::ConnectException, voltdb::LibEventException, voltdb::Exception); 55 | 56 | /* 57 | * Retrieve a client that connects to the specified hostname and port using the provided username and password 58 | */ 59 | voltdb::Client acquireClient(std::string hostname, std::string username, std::string password, StatusListener *listener, unsigned short port = 21212, ClientAuthHashScheme sha = HASH_SHA1) throw (voltdb::ConnectException, voltdb::LibEventException, voltdb::Exception); 60 | 61 | void returnClient(Client client) throw (voltdb::Exception); 62 | 63 | void closeClientConnection(Client client) throw (voltdb::Exception); 64 | 65 | /* 66 | * Return the number of clients held by this thread 67 | */ 68 | int numClientsBorrowed(); 69 | 70 | /* 71 | * Release any unreleased clients associated with this thread/script 72 | */ 73 | void onScriptEnd(); 74 | 75 | /* 76 | * Retrieve the global connection pool 77 | */ 78 | static voltdb::ConnectionPool* pool(); 79 | 80 | private: 81 | /** 82 | * Thread local key for storing clients 83 | */ 84 | pthread_key_t m_borrowedClients; 85 | ClientMap m_clients; 86 | pthread_mutex_t m_lock; 87 | }; 88 | 89 | /** 90 | * Instantiate the global connection pool 91 | * Should be invoked once at startup 92 | */ 93 | void onLoad(); 94 | 95 | /** 96 | * Free the global connection pool 97 | * Should be invoked before shutdown to ensure all txns are flushed 98 | * and things run valgrind clean 99 | */ 100 | void onUnload(); 101 | 102 | /** 103 | * Releases all clients that have been borrowed from the pool by the current thread 104 | */ 105 | void onScriptEnd(); 106 | 107 | } 108 | #endif /* VOLT_CONNECTION_POOL_H_ */ 109 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/Distributer.h: -------------------------------------------------------------------------------- 1 | /* This file is part of VoltDB. 2 | * Copyright (C) 2008-2018 VoltDB Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 | * OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef DISTRIBUTER_H_ 25 | #define DISTRIBUTER_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | #include "TheHashinator.h" 31 | #include "Table.h" 32 | #include "ByteBuffer.hpp" 33 | #include "Exception.hpp" 34 | #include 35 | #include 36 | 37 | 38 | 39 | namespace voltdb { 40 | 41 | /* 42 | * Class for saving procedure information obtained by invoke ("@SystemCatalog", "PROCEDURES") procedure 43 | */ 44 | class ProcedureInfo { 45 | public: 46 | ProcedureInfo(const std::string &jsonText); 47 | ProcedureInfo():PARAMETER_NONE(-1){} 48 | ProcedureInfo(const ProcedureInfo &proc):PARAMETER_NONE(proc.PARAMETER_NONE){ 49 | m_multiPart = proc.m_multiPart; 50 | m_readOnly = proc.m_readOnly; 51 | m_partitionParameter = proc.m_partitionParameter; 52 | m_partitionParameterType = proc.m_partitionParameterType; 53 | } 54 | virtual ~ProcedureInfo(){} 55 | bool m_multiPart; 56 | bool m_readOnly; 57 | int m_partitionParameter; 58 | int m_partitionParameterType; 59 | 60 | private: 61 | const int PARAMETER_NONE; 62 | }; 63 | 64 | class Distributer{ 65 | public: 66 | void startUpdate(){m_isUpdating = true;} 67 | bool isUpdating(){return m_isUpdating;} 68 | bool isElastic(){return m_isElastic;} 69 | 70 | void updateAffinityTopology(const std::vector& topoTable); 71 | void updateProcedurePartitioning(const std::vector& procInfoTable); 72 | 73 | Distributer(): m_isUpdating(false), m_isElastic(true){} 74 | 75 | virtual ~Distributer(){ 76 | m_procedureInfo.clear(); 77 | m_PartitionToHostId.clear(); 78 | } 79 | 80 | ProcedureInfo* getProcedure(const std::string& procName) throw (UnknownProcedureException); 81 | int getHashedPartitionForParameter(ByteBuffer ¶mBuffer, int parameterId); 82 | int getHostIdByPartitionId(int partitionId); 83 | void handleTopologyNotification(const std::vector& t); 84 | static const int MP_INIT_PID; 85 | 86 | private: 87 | int parseParameter(ByteBuffer ¶mBuffer, int &index); 88 | 89 | std::map m_procedureInfo; 90 | std::map m_PartitionToHostId; 91 | bool m_isUpdating; 92 | bool m_isElastic; 93 | boost::scoped_ptr m_hashinator; 94 | 95 | static boost::shared_mutex m_procInfoLock; 96 | 97 | voltdb::Table m_savedTopoTable; 98 | }; 99 | 100 | } 101 | 102 | #endif /* HASHINATOR_H_ */ 103 | 104 | 105 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/MurmurHash3.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // MurmurHash3 was written by Austin Appleby, and is placed in the public 3 | // domain. The author hereby disclaims copyright to this source code. 4 | 5 | #ifndef _MURMURHASH3_H_ 6 | #define _MURMURHASH3_H_ 7 | 8 | namespace voltdb { 9 | 10 | //----------------------------------------------------------------------------- 11 | // Platform-specific functions and macros 12 | 13 | // Microsoft Visual Studio 14 | 15 | #if defined(_MSC_VER) 16 | 17 | typedef unsigned char uint8_t; 18 | typedef unsigned long uint32_t; 19 | typedef unsigned __int64 uint64_t; 20 | 21 | // Other compilers 22 | 23 | #else // defined(_MSC_VER) 24 | 25 | #include 26 | 27 | #endif // !defined(_MSC_VER) 28 | 29 | //----------------------------------------------------------------------------- 30 | 31 | int32_t MurmurHash3_x64_128 ( const void * key, int len, uint32_t seed ); 32 | 33 | inline int32_t MurmurHash3_x64_128 ( int64_t value, uint32_t seed) { 34 | return MurmurHash3_x64_128( &value, 8, seed); 35 | } 36 | 37 | inline int32_t MurmurHash3_x64_128 ( int64_t value) { 38 | return MurmurHash3_x64_128(value, 0); 39 | } 40 | 41 | //----------------------------------------------------------------------------- 42 | 43 | } 44 | #endif // _MURMURHASH3_H_ 45 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/Parameter.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of VoltDB. 2 | * Copyright (C) 2008-2018 VoltDB Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 | * OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef VOLTDB_PARAMETER_HPP_ 25 | #define VOLTDB_PARAMETER_HPP_ 26 | #include "WireType.h" 27 | namespace voltdb { 28 | /* 29 | * Class describing a single parameter specifying its type and whether it is an array 30 | * of values 31 | */ 32 | class Parameter { 33 | public: 34 | /* 35 | * Default construct for compatablity with std::vector 36 | */ 37 | Parameter() : m_type(WIRE_TYPE_INVALID), m_array(false) {} 38 | 39 | /* 40 | * Constructor for setting both type and arrayedness 41 | */ 42 | Parameter(WireType type, bool array) : m_type(type), m_array(array) {} 43 | 44 | /* 45 | * Constructor for setting just the type. Assumes the value is not an array 46 | */ 47 | Parameter(WireType type) : m_type(type), m_array(false) {} 48 | 49 | /* 50 | * Copy constructor for compatablity with std::vector 51 | */ 52 | Parameter(const Parameter &other) : m_type(other.m_type), m_array(other.m_array) {} 53 | 54 | WireType m_type; 55 | bool m_array; 56 | }; 57 | } 58 | #endif /* VOLTDB_PARAMETER_HPP_ */ 59 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/Procedure.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of VoltDB. 2 | * Copyright (C) 2008-2018 VoltDB Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 | * OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef VOLTDB_PROCEDURE_HPP_ 25 | #define VOLTDB_PROCEDURE_HPP_ 26 | #include 27 | #include 28 | #include "ParameterSet.hpp" 29 | #include "ByteBuffer.hpp" 30 | 31 | namespace voltdb { 32 | 33 | /* 34 | * Description of a stored procedure and its parameters that must be provided to the API 35 | * in order to invoke a stored procedure 36 | */ 37 | class Procedure { 38 | public: 39 | /* 40 | * Construct a Procedure with the specified name and specified signature (parameters) 41 | */ 42 | Procedure(const std::string& name, std::vector parameters) : m_name(name), m_params(parameters) {} 43 | Procedure(const std::string& name) : m_name(name) {} 44 | 45 | /** 46 | * Retrieve the parameter set associated with the procedure so that the parameters can be set 47 | * with actual values. The pointer to the parameter set can be retained 48 | * as long as the Procedure itself is still valid, and can be reused after each invocation. 49 | */ 50 | ParameterSet* params() { 51 | m_params.reset(); 52 | return &m_params; 53 | } 54 | 55 | int32_t getSerializedSize() { 56 | return 57 | 5 // length prefix and wire protocol version 58 | + 4 // proc size 59 | + static_cast(m_name.size()) // proc name 60 | + 8 // client data 61 | + m_params.getSerializedSize() // parameters 62 | ; 63 | } 64 | 65 | const std::string& getName()const {return m_name;} 66 | 67 | #ifdef SWIG 68 | %ignore serializeTo; 69 | #endif 70 | void serializeTo(ByteBuffer *buffer, int64_t clientData) { 71 | buffer->position(4); 72 | buffer->putInt8(0); 73 | buffer->putString(m_name); 74 | buffer->putInt64(clientData); 75 | m_params.serializeTo(buffer); 76 | buffer->flip(); 77 | buffer->putInt32( 0, buffer->limit() - 4); 78 | } 79 | private: 80 | const std::string m_name; 81 | ParameterSet m_params; 82 | }; 83 | 84 | } 85 | 86 | #endif /* VOLTDB_PROCEDURE_HPP_ */ 87 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/ProcedureCallback.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of VoltDB. 2 | * Copyright (C) 2008-2018 VoltDB Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 | * OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef VOLTDB_PROCEDURECALLBACK_HPP_ 25 | #define VOLTDB_PROCEDURECALLBACK_HPP_ 26 | #include "InvocationResponse.hpp" 27 | #include 28 | namespace voltdb { 29 | 30 | /* 31 | * Abstract base class for callbacks to provide to the 32 | * API with procedure invocations 33 | */ 34 | class ProcedureCallback { 35 | public: 36 | 37 | enum AbandonReason { NOT_ABANDONED, TOO_BUSY }; 38 | 39 | /* 40 | * Invoked when a response to an invocation is available or 41 | * the connection to the node the invocation was sent to was lost. 42 | * Callbacks should not throw user exceptions. 43 | * 44 | * The API surrounds the callback in a try catch for std::exception 45 | * and passes any caught exceptions to the status listener. 46 | * @return true if the event loop should break after invoking this callback, false otherwise 47 | */ 48 | virtual bool callback(InvocationResponse response) throw (voltdb::Exception) = 0; 49 | virtual void abandon(AbandonReason reason) {} 50 | // Mechanism for procedure to over-ride abandon property set in client in event of backpressure. 51 | // @return true: allow abandoning of requests in case of back pressure 52 | // false: don't abandon the requests in back pressure scenario. 53 | virtual bool allowAbandon() const {return true;} 54 | virtual ~ProcedureCallback() {} 55 | }; 56 | } 57 | 58 | #endif /* VOLTDB_PROCEDURECALLBACK_HPP_ */ 59 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/StatusListener.h: -------------------------------------------------------------------------------- 1 | /* This file is part of VoltDB. 2 | * Copyright (C) 2008-2018 VoltDB Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 | * OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef VOLT_STATUSLISTENER_H_ 25 | #define VOLT_STATUSLISTENER_H_ 26 | #include 27 | #include "InvocationResponse.hpp" 28 | namespace voltdb { 29 | class ProcedureCallback; 30 | /* 31 | * A status listener that an application should provide to a Client instance so 32 | * that the application can be notified of important events. 33 | */ 34 | class StatusListener { 35 | public: 36 | /* 37 | * Handle exceptions thrown by a Client's callback. All exceptions (std::exception) are caught 38 | * but a client should only throw exceptions that are instances or subclasses of 39 | * voltdb::ClientCallbackException. 40 | * @param exception The exception thrown by the callback 41 | * @param callback Instance of the callback that threw the exception 42 | * @param The response from the server that caused the exception 43 | * @return true if the event loop should terminate and false otherwise 44 | */ 45 | virtual bool uncaughtException( 46 | std::exception exception, 47 | boost::shared_ptr callback, 48 | voltdb::InvocationResponse response) = 0; 49 | 50 | /* 51 | * Notify the client application that a connection to the database was lost 52 | * @param hostname Name of the host that the connection was lost to 53 | * @param connectionsLeft Number of connections to the database remaining 54 | * @return true if the event loop should terminate and false otherwise 55 | */ 56 | virtual bool connectionLost(std::string hostname, int32_t connectionsLeft) = 0; 57 | 58 | /* 59 | * Notify the client application that a connection to the database was established 60 | * @param hostname Name of the host that the connection was established to 61 | * @param connectionsActive Number of connections to the database remaining 62 | * @return true if the event loop should terminate and false otherwise 63 | */ 64 | virtual bool connectionActive(std::string hostname, int32_t connectionsActive) = 0; 65 | 66 | /* 67 | * Notify the client application that backpressure occured 68 | * @param hasBackpressure True if backpressure is beginning and false if it is ending 69 | * @return true, in backpressure environment, if the client library to queue the invocation and 70 | * return from invoke() 71 | * false, in backpressure environment, if the library should wait until there is a 72 | * connection without backpressure and then queue it. 73 | */ 74 | virtual bool backpressure(bool hasBackpressure) = 0; 75 | 76 | virtual ~StatusListener() {} 77 | }; 78 | } 79 | 80 | #endif /* STATUSLISTENER_H_ */ 81 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/TableIterator.h: -------------------------------------------------------------------------------- 1 | /* This file is part of VoltDB. 2 | * Copyright (C) 2008-2018 VoltDB Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 | * OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef VOLTDB_TABLEITERATOR_H_ 25 | #define VOLTDB_TABLEITERATOR_H_ 26 | 27 | #include "ByteBuffer.hpp" 28 | #include "Column.hpp" 29 | #include 30 | #include "Row.hpp" 31 | #include "Exception.hpp" 32 | 33 | namespace voltdb { 34 | class Table; 35 | 36 | /* 37 | * Iterator for retrieving rows from a table. Retains a shared pointer to the buffer backing the table. Watch out 38 | * for unwanted memory retention. 39 | */ 40 | class TableIterator { 41 | public: 42 | 43 | /* 44 | * Construct an iterator for the table rows with the specified column schema and row count 45 | */ 46 | #ifdef SWIG 47 | %ignore TableIterator(voltdb::SharedByteBuffer rows, 48 | boost::shared_ptr > columns, 49 | int32_t rowCount); 50 | #endif 51 | TableIterator( 52 | voltdb::SharedByteBuffer rows, 53 | boost::shared_ptr > columns, 54 | int32_t rowCount) : 55 | m_buffer(rows), m_columns(columns), m_rowCount(rowCount), m_currentRow(0) {} 56 | 57 | /* 58 | * Returns true if the table has more rows that can be retrieved via invoking next and false otherwise. 59 | */ 60 | bool hasNext() { 61 | if (m_currentRow < m_rowCount) { 62 | assert(m_buffer.hasRemaining()); 63 | return true; 64 | } 65 | return false; 66 | } 67 | 68 | /* 69 | * Returns the next row in the table if there are more rows or NoMoreRowsException if there are no 70 | * more rows. OverflowUnderflowException and IndexOutOfBoundsException only result if there are bugs 71 | * and are not expected normally. 72 | */ 73 | voltdb::Row next() throw (NoMoreRowsException, OverflowUnderflowException, IndexOutOfBoundsException) { 74 | if (m_rowCount <= m_currentRow) { 75 | throw NoMoreRowsException(); 76 | } 77 | int32_t rowLength = m_buffer.getInt32(); 78 | int32_t oldLimit = m_buffer.limit(); 79 | m_buffer.limit(m_buffer.position() + rowLength); 80 | SharedByteBuffer buffer = m_buffer.slice(); 81 | m_buffer.limit(oldLimit); 82 | m_currentRow++; 83 | return voltdb::Row(buffer, m_columns); 84 | } 85 | 86 | private: 87 | voltdb::SharedByteBuffer m_buffer; 88 | boost::shared_ptr > m_columns; 89 | int32_t m_rowCount; 90 | int32_t m_currentRow; 91 | }; 92 | } 93 | #endif /* VOLTDB_TABLEITERATOR_H_ */ 94 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/TheHashinator.h: -------------------------------------------------------------------------------- 1 | /* This file is part of VoltDB. 2 | * Copyright (C) 2008-2018 VoltDB Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 | * OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef THEHASHINATOR_H_ 25 | #define THEHASHINATOR_H_ 26 | 27 | //DEBUG ONLY 28 | //#define __DEBUG 29 | 30 | #ifdef __DEBUG 31 | #include 32 | #include 33 | 34 | #define debug_msg(text)\ 35 | {\ 36 | std::fstream fs;\ 37 | fs.open ("/tmp/hashinator.log", std::fstream::out | std::fstream::app);\ 38 | fs << __FILE__ << ":" << __LINE__ << " " << text << std::endl;\ 39 | fs.close();\ 40 | } 41 | 42 | #else 43 | 44 | #define debug_msg(text) 45 | 46 | #endif 47 | 48 | 49 | #include 50 | namespace voltdb { 51 | 52 | 53 | /** 54 | * Abstract base class for hashing SQL values to partition ids 55 | */ 56 | class TheHashinator { 57 | public: 58 | 59 | virtual ~TheHashinator() {} 60 | 61 | TheHashinator() {} 62 | 63 | public: 64 | 65 | /** 66 | * Given a long value, pick a partition to store the data. 67 | * 68 | * @param value The value to hash. 69 | * @return A value between 0 and partitionCount-1, hopefully pretty evenly 70 | * distributed. 71 | */ 72 | virtual int32_t hashinate(int64_t value) const = 0; 73 | 74 | /* 75 | * Given a piece of UTF-8 encoded character data OR binary data 76 | * pick a partition to store the data 77 | */ 78 | virtual int32_t hashinate(const char *string, int32_t length) const = 0; 79 | }; 80 | 81 | } // namespace voltdb 82 | 83 | #endif // THEHASHINATOR_H_ 84 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/WireType.h: -------------------------------------------------------------------------------- 1 | /* This file is part of VoltDB. 2 | * Copyright (C) 2008-2018 VoltDB Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 | * OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef VOLTDB_WIRETYPE_H_ 25 | #define VOLTDB_WIRETYPE_H_ 26 | 27 | #include 28 | 29 | namespace voltdb { 30 | /* 31 | * Note: these constants must be the same as those in: 32 | * frontend/org/voltdb/VoltType.java 33 | * ee/common/types.h 34 | */ 35 | enum WireType { 36 | WIRE_TYPE_INVALID = -98, 37 | WIRE_TYPE_ARRAY = -99, 38 | WIRE_TYPE_NULL = 1, 39 | WIRE_TYPE_TINYINT = 3, 40 | WIRE_TYPE_SMALLINT = 4, 41 | WIRE_TYPE_INTEGER = 5, 42 | WIRE_TYPE_BIGINT = 6, 43 | WIRE_TYPE_FLOAT = 8, 44 | WIRE_TYPE_STRING = 9, 45 | WIRE_TYPE_TIMESTAMP = 11, 46 | WIRE_TYPE_VOLTTABLE = 21, 47 | WIRE_TYPE_DECIMAL = 22, 48 | WIRE_TYPE_VARBINARY = 25, 49 | WIRE_TYPE_GEOGRAPHY_POINT = 26, 50 | WIRE_TYPE_GEOGRAPHY = 27, 51 | }; 52 | 53 | inline bool isVariableSized(WireType type) { 54 | return ((type == WIRE_TYPE_VARBINARY) 55 | || (type == WIRE_TYPE_STRING) 56 | || (type == WIRE_TYPE_GEOGRAPHY)); 57 | } 58 | 59 | std::string wireTypeToString(WireType type); 60 | 61 | } 62 | #endif /* VOLTDB_WIRETYPE_H_ */ 63 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/event2/dns_struct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef EVENT2_DNS_STRUCT_H_INCLUDED_ 28 | #define EVENT2_DNS_STRUCT_H_INCLUDED_ 29 | 30 | /** @file event2/dns_struct.h 31 | 32 | Data structures for dns. Using these structures may hurt forward 33 | compatibility with later versions of Libevent: be careful! 34 | 35 | */ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | #include 42 | #ifdef EVENT__HAVE_SYS_TYPES_H 43 | #include 44 | #endif 45 | #ifdef EVENT__HAVE_SYS_TIME_H 46 | #include 47 | #endif 48 | 49 | /* For int types. */ 50 | #include 51 | 52 | /* 53 | * Structures used to implement a DNS server. 54 | */ 55 | 56 | struct evdns_server_request { 57 | int flags; 58 | int nquestions; 59 | struct evdns_server_question **questions; 60 | }; 61 | struct evdns_server_question { 62 | int type; 63 | #ifdef __cplusplus 64 | int dns_question_class; 65 | #else 66 | /* You should refer to this field as "dns_question_class". The 67 | * name "class" works in C for backward compatibility, and will be 68 | * removed in a future version. (1.5 or later). */ 69 | int class; 70 | #define dns_question_class class 71 | #endif 72 | char name[1]; 73 | }; 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | #endif /* EVENT2_DNS_STRUCT_H_INCLUDED_ */ 80 | 81 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/event2/http_compat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef EVENT2_HTTP_COMPAT_H_INCLUDED_ 28 | #define EVENT2_HTTP_COMPAT_H_INCLUDED_ 29 | 30 | /** @file event2/http_compat.h 31 | 32 | Potentially non-threadsafe versions of the functions in http.h: provided 33 | only for backwards compatibility. 34 | 35 | */ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | #include 42 | #ifdef EVENT__HAVE_SYS_TYPES_H 43 | #include 44 | #endif 45 | #ifdef EVENT__HAVE_SYS_TIME_H 46 | #include 47 | #endif 48 | 49 | /* For int types. */ 50 | #include 51 | 52 | /** 53 | * Start an HTTP server on the specified address and port 54 | * 55 | * @deprecated It does not allow an event base to be specified 56 | * 57 | * @param address the address to which the HTTP server should be bound 58 | * @param port the port number on which the HTTP server should listen 59 | * @return an struct evhttp object 60 | */ 61 | struct evhttp *evhttp_start(const char *address, ev_uint16_t port); 62 | 63 | /** 64 | * A connection object that can be used to for making HTTP requests. The 65 | * connection object tries to establish the connection when it is given an 66 | * http request object. 67 | * 68 | * @deprecated It does not allow an event base to be specified 69 | */ 70 | struct evhttp_connection *evhttp_connection_new( 71 | const char *address, ev_uint16_t port); 72 | 73 | /** 74 | * Associates an event base with the connection - can only be called 75 | * on a freshly created connection object that has not been used yet. 76 | * 77 | * @deprecated XXXX Why? 78 | */ 79 | void evhttp_connection_set_base(struct evhttp_connection *evcon, 80 | struct event_base *base); 81 | 82 | 83 | /** Returns the request URI */ 84 | #define evhttp_request_uri evhttp_request_get_uri 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */ 91 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/event2/keyvalq_struct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef EVENT2_KEYVALQ_STRUCT_H_INCLUDED_ 28 | #define EVENT2_KEYVALQ_STRUCT_H_INCLUDED_ 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | /* Fix so that people don't have to run with */ 35 | /* XXXX This code is duplicated with event_struct.h */ 36 | #ifndef TAILQ_ENTRY 37 | #define EVENT_DEFINED_TQENTRY_ 38 | #define TAILQ_ENTRY(type) \ 39 | struct { \ 40 | struct type *tqe_next; /* next element */ \ 41 | struct type **tqe_prev; /* address of previous next element */ \ 42 | } 43 | #endif /* !TAILQ_ENTRY */ 44 | 45 | #ifndef TAILQ_HEAD 46 | #define EVENT_DEFINED_TQHEAD_ 47 | #define TAILQ_HEAD(name, type) \ 48 | struct name { \ 49 | struct type *tqh_first; \ 50 | struct type **tqh_last; \ 51 | } 52 | #endif 53 | 54 | /* 55 | * Key-Value pairs. Can be used for HTTP headers but also for 56 | * query argument parsing. 57 | */ 58 | struct evkeyval { 59 | TAILQ_ENTRY(evkeyval) next; 60 | 61 | char *key; 62 | char *value; 63 | }; 64 | 65 | TAILQ_HEAD (evkeyvalq, evkeyval); 66 | 67 | /* XXXX This code is duplicated with event_struct.h */ 68 | #ifdef EVENT_DEFINED_TQENTRY_ 69 | #undef TAILQ_ENTRY 70 | #endif 71 | 72 | #ifdef EVENT_DEFINED_TQHEAD_ 73 | #undef TAILQ_HEAD 74 | #endif 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/event2/rpc_compat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef EVENT2_RPC_COMPAT_H_INCLUDED_ 28 | #define EVENT2_RPC_COMPAT_H_INCLUDED_ 29 | 30 | /** @file event2/rpc_compat.h 31 | 32 | Deprecated versions of the functions in rpc.h: provided only for 33 | backwards compatibility. 34 | 35 | */ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** backwards compatible accessors that work only with gcc */ 42 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) 43 | 44 | #undef EVTAG_ASSIGN 45 | #undef EVTAG_GET 46 | #undef EVTAG_ADD 47 | 48 | #define EVTAG_ASSIGN(msg, member, args...) \ 49 | (*(msg)->base->member##_assign)(msg, ## args) 50 | #define EVTAG_GET(msg, member, args...) \ 51 | (*(msg)->base->member##_get)(msg, ## args) 52 | #define EVTAG_ADD(msg, member, args...) \ 53 | (*(msg)->base->member##_add)(msg, ## args) 54 | #endif 55 | #define EVTAG_LEN(msg, member) ((msg)->member##_length) 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */ 62 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/event2/rpc_struct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef EVENT2_RPC_STRUCT_H_INCLUDED_ 28 | #define EVENT2_RPC_STRUCT_H_INCLUDED_ 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | /** @file event2/rpc_struct.h 35 | 36 | Structures used by rpc.h. Using these structures directly may harm 37 | forward compatibility: be careful! 38 | 39 | */ 40 | 41 | /** 42 | * provides information about the completed RPC request. 43 | */ 44 | struct evrpc_status { 45 | #define EVRPC_STATUS_ERR_NONE 0 46 | #define EVRPC_STATUS_ERR_TIMEOUT 1 47 | #define EVRPC_STATUS_ERR_BADPAYLOAD 2 48 | #define EVRPC_STATUS_ERR_UNSTARTED 3 49 | #define EVRPC_STATUS_ERR_HOOKABORTED 4 50 | int error; 51 | 52 | /* for looking at headers or other information */ 53 | struct evhttp_request *http_req; 54 | }; 55 | 56 | /* the structure below needs to be synchronized with evrpc_req_generic */ 57 | 58 | /* Encapsulates a request */ 59 | struct evrpc { 60 | TAILQ_ENTRY(evrpc) next; 61 | 62 | /* the URI at which the request handler lives */ 63 | const char* uri; 64 | 65 | /* creates a new request structure */ 66 | void *(*request_new)(void *); 67 | void *request_new_arg; 68 | 69 | /* frees the request structure */ 70 | void (*request_free)(void *); 71 | 72 | /* unmarshals the buffer into the proper request structure */ 73 | int (*request_unmarshal)(void *, struct evbuffer *); 74 | 75 | /* creates a new reply structure */ 76 | void *(*reply_new)(void *); 77 | void *reply_new_arg; 78 | 79 | /* frees the reply structure */ 80 | void (*reply_free)(void *); 81 | 82 | /* verifies that the reply is valid */ 83 | int (*reply_complete)(void *); 84 | 85 | /* marshals the reply into a buffer */ 86 | void (*reply_marshal)(struct evbuffer*, void *); 87 | 88 | /* the callback invoked for each received rpc */ 89 | void (*cb)(struct evrpc_req_generic *, void *); 90 | void *cb_arg; 91 | 92 | /* reference for further configuration */ 93 | struct evrpc_base *base; 94 | }; 95 | 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | 100 | #endif /* EVENT2_RPC_STRUCT_H_INCLUDED_ */ 101 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/event2/tag_compat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef EVENT2_TAG_COMPAT_H_INCLUDED_ 28 | #define EVENT2_TAG_COMPAT_H_INCLUDED_ 29 | 30 | /** @file event2/tag_compat.h 31 | 32 | Obsolete/deprecated functions from tag.h; provided only for backwards 33 | compatibility. 34 | */ 35 | 36 | /** 37 | @name Misnamed functions 38 | 39 | @deprecated These macros are deprecated because their names don't follow 40 | Libevent's naming conventions. Use evtag_encode_int and 41 | evtag_encode_int64 instead. 42 | 43 | @{ 44 | */ 45 | #define encode_int(evbuf, number) evtag_encode_int((evbuf), (number)) 46 | #define encode_int64(evbuf, number) evtag_encode_int64((evbuf), (number)) 47 | /**@}*/ 48 | 49 | #endif /* EVENT2_TAG_H_INCLUDED_ */ 50 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/event2/visibility.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef EVENT2_VISIBILITY_H_INCLUDED_ 28 | #define EVENT2_VISIBILITY_H_INCLUDED_ 29 | 30 | #include 31 | 32 | #if defined(event_EXPORTS) || defined(event_extra_EXPORTS) || defined(event_core_EXPORTS) 33 | # if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550) 34 | # define EVENT2_EXPORT_SYMBOL __global 35 | # elif defined __GNUC__ 36 | # define EVENT2_EXPORT_SYMBOL __attribute__ ((visibility("default"))) 37 | # elif defined(_MSC_VER) 38 | # define EVENT2_EXPORT_SYMBOL extern __declspec(dllexport) 39 | # else 40 | # define EVENT2_EXPORT_SYMBOL /* unknown compiler */ 41 | # endif 42 | #else 43 | # if defined(EVENT__NEED_DLLIMPORT) && defined(_MSC_VER) && !defined(EVENT_BUILDING_REGRESS_TEST) 44 | # define EVENT2_EXPORT_SYMBOL extern __declspec(dllimport) 45 | # else 46 | # define EVENT2_EXPORT_SYMBOL 47 | # endif 48 | #endif 49 | 50 | #endif /* EVENT2_VISIBILITY_H_INCLUDED_ */ 51 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/openssl/cmac.h: -------------------------------------------------------------------------------- 1 | /* crypto/cmac/cmac.h */ 2 | /* 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 4 | * project. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | */ 54 | 55 | #ifndef HEADER_CMAC_H 56 | # define HEADER_CMAC_H 57 | 58 | #ifdef __cplusplus 59 | extern "C" { 60 | #endif 61 | 62 | # include 63 | 64 | /* Opaque */ 65 | typedef struct CMAC_CTX_st CMAC_CTX; 66 | 67 | CMAC_CTX *CMAC_CTX_new(void); 68 | void CMAC_CTX_cleanup(CMAC_CTX *ctx); 69 | void CMAC_CTX_free(CMAC_CTX *ctx); 70 | EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); 71 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); 72 | 73 | int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, 74 | const EVP_CIPHER *cipher, ENGINE *impl); 75 | int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); 76 | int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); 77 | int CMAC_resume(CMAC_CTX *ctx); 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | #endif 83 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/openssl/comp.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HEADER_COMP_H 3 | # define HEADER_COMP_H 4 | 5 | # include 6 | 7 | # ifdef OPENSSL_NO_COMP 8 | # error COMP is disabled. 9 | # endif 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct comp_ctx_st COMP_CTX; 16 | 17 | struct comp_method_st { 18 | int type; /* NID for compression library */ 19 | const char *name; /* A text string to identify the library */ 20 | int (*init) (COMP_CTX *ctx); 21 | void (*finish) (COMP_CTX *ctx); 22 | int (*compress) (COMP_CTX *ctx, 23 | unsigned char *out, unsigned int olen, 24 | unsigned char *in, unsigned int ilen); 25 | int (*expand) (COMP_CTX *ctx, 26 | unsigned char *out, unsigned int olen, 27 | unsigned char *in, unsigned int ilen); 28 | /* 29 | * The following two do NOTHING, but are kept for backward compatibility 30 | */ 31 | long (*ctrl) (void); 32 | long (*callback_ctrl) (void); 33 | }; 34 | 35 | struct comp_ctx_st { 36 | COMP_METHOD *meth; 37 | unsigned long compress_in; 38 | unsigned long compress_out; 39 | unsigned long expand_in; 40 | unsigned long expand_out; 41 | CRYPTO_EX_DATA ex_data; 42 | }; 43 | 44 | COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); 45 | void COMP_CTX_free(COMP_CTX *ctx); 46 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, 47 | unsigned char *in, int ilen); 48 | int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, 49 | unsigned char *in, int ilen); 50 | COMP_METHOD *COMP_rle(void); 51 | COMP_METHOD *COMP_zlib(void); 52 | void COMP_zlib_cleanup(void); 53 | 54 | # ifdef HEADER_BIO_H 55 | # ifdef ZLIB 56 | BIO_METHOD *BIO_f_zlib(void); 57 | # endif 58 | # endif 59 | 60 | /* BEGIN ERROR CODES */ 61 | /* 62 | * The following lines are auto generated by the script mkerr.pl. Any changes 63 | * made after this point may be overwritten when the script is next run. 64 | */ 65 | void ERR_load_COMP_strings(void); 66 | 67 | /* Error codes for the COMP functions. */ 68 | 69 | /* Function codes. */ 70 | # define COMP_F_BIO_ZLIB_FLUSH 99 71 | # define COMP_F_BIO_ZLIB_NEW 100 72 | # define COMP_F_BIO_ZLIB_READ 101 73 | # define COMP_F_BIO_ZLIB_WRITE 102 74 | 75 | /* Reason codes. */ 76 | # define COMP_R_ZLIB_DEFLATE_ERROR 99 77 | # define COMP_R_ZLIB_INFLATE_ERROR 100 78 | # define COMP_R_ZLIB_NOT_SUPPORTED 101 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | #endif 84 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/openssl/ebcdic.h: -------------------------------------------------------------------------------- 1 | /* crypto/ebcdic.h */ 2 | 3 | #ifndef HEADER_EBCDIC_H 4 | # define HEADER_EBCDIC_H 5 | 6 | # include 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | /* Avoid name clashes with other applications */ 13 | # define os_toascii _openssl_os_toascii 14 | # define os_toebcdic _openssl_os_toebcdic 15 | # define ebcdic2ascii _openssl_ebcdic2ascii 16 | # define ascii2ebcdic _openssl_ascii2ebcdic 17 | 18 | extern const unsigned char os_toascii[256]; 19 | extern const unsigned char os_toebcdic[256]; 20 | void *ebcdic2ascii(void *dest, const void *srce, size_t count); 21 | void *ascii2ebcdic(void *dest, const void *srce, size_t count); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif 27 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/openssl/mdc2.h: -------------------------------------------------------------------------------- 1 | /* crypto/mdc2/mdc2.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_MDC2_H 60 | # define HEADER_MDC2_H 61 | 62 | # include 63 | 64 | #ifdef __cplusplus 65 | extern "C" { 66 | #endif 67 | 68 | # ifdef OPENSSL_NO_MDC2 69 | # error MDC2 is disabled. 70 | # endif 71 | 72 | # define MDC2_BLOCK 8 73 | # define MDC2_DIGEST_LENGTH 16 74 | 75 | typedef struct mdc2_ctx_st { 76 | unsigned int num; 77 | unsigned char data[MDC2_BLOCK]; 78 | DES_cblock h, hh; 79 | int pad_type; /* either 1 or 2, default 1 */ 80 | } MDC2_CTX; 81 | 82 | # ifdef OPENSSL_FIPS 83 | int private_MDC2_Init(MDC2_CTX *c); 84 | # endif 85 | int MDC2_Init(MDC2_CTX *c); 86 | int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); 87 | int MDC2_Final(unsigned char *md, MDC2_CTX *c); 88 | unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/openssl/opensslv.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_OPENSSLV_H 2 | # define HEADER_OPENSSLV_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /*- 9 | * Numeric release version identifier: 10 | * MNNFFPPS: major minor fix patch status 11 | * The status nibble has one of the values 0 for development, 1 to e for betas 12 | * 1 to 14, and f for release. The patch level is exactly that. 13 | * For example: 14 | * 0.9.3-dev 0x00903000 15 | * 0.9.3-beta1 0x00903001 16 | * 0.9.3-beta2-dev 0x00903002 17 | * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) 18 | * 0.9.3 0x0090300f 19 | * 0.9.3a 0x0090301f 20 | * 0.9.4 0x0090400f 21 | * 1.2.3z 0x102031af 22 | * 23 | * For continuity reasons (because 0.9.5 is already out, and is coded 24 | * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level 25 | * part is slightly different, by setting the highest bit. This means 26 | * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start 27 | * with 0x0090600S... 28 | * 29 | * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) 30 | * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for 31 | * major minor fix final patch/beta) 32 | */ 33 | # define OPENSSL_VERSION_NUMBER 0x100020bfL 34 | # ifdef OPENSSL_FIPS 35 | # define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2k-fips 26 Jan 2017" 36 | # else 37 | # define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2k 26 Jan 2017" 38 | # endif 39 | # define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT 40 | 41 | /*- 42 | * The macros below are to be used for shared library (.so, .dll, ...) 43 | * versioning. That kind of versioning works a bit differently between 44 | * operating systems. The most usual scheme is to set a major and a minor 45 | * number, and have the runtime loader check that the major number is equal 46 | * to what it was at application link time, while the minor number has to 47 | * be greater or equal to what it was at application link time. With this 48 | * scheme, the version number is usually part of the file name, like this: 49 | * 50 | * libcrypto.so.0.9 51 | * 52 | * Some unixen also make a softlink with the major verson number only: 53 | * 54 | * libcrypto.so.0 55 | * 56 | * On Tru64 and IRIX 6.x it works a little bit differently. There, the 57 | * shared library version is stored in the file, and is actually a series 58 | * of versions, separated by colons. The rightmost version present in the 59 | * library when linking an application is stored in the application to be 60 | * matched at run time. When the application is run, a check is done to 61 | * see if the library version stored in the application matches any of the 62 | * versions in the version string of the library itself. 63 | * This version string can be constructed in any way, depending on what 64 | * kind of matching is desired. However, to implement the same scheme as 65 | * the one used in the other unixen, all compatible versions, from lowest 66 | * to highest, should be part of the string. Consecutive builds would 67 | * give the following versions strings: 68 | * 69 | * 3.0 70 | * 3.0:3.1 71 | * 3.0:3.1:3.2 72 | * 4.0 73 | * 4.0:4.1 74 | * 75 | * Notice how version 4 is completely incompatible with version, and 76 | * therefore give the breach you can see. 77 | * 78 | * There may be other schemes as well that I haven't yet discovered. 79 | * 80 | * So, here's the way it works here: first of all, the library version 81 | * number doesn't need at all to match the overall OpenSSL version. 82 | * However, it's nice and more understandable if it actually does. 83 | * The current library version is stored in the macro SHLIB_VERSION_NUMBER, 84 | * which is just a piece of text in the format "M.m.e" (Major, minor, edit). 85 | * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, 86 | * we need to keep a history of version numbers, which is done in the 87 | * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and 88 | * should only keep the versions that are binary compatible with the current. 89 | */ 90 | # define SHLIB_VERSION_HISTORY "" 91 | # define SHLIB_VERSION_NUMBER "1.0.0" 92 | 93 | 94 | #ifdef __cplusplus 95 | } 96 | #endif 97 | #endif /* HEADER_OPENSSLV_H */ 98 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/openssl/pem2.h: -------------------------------------------------------------------------------- 1 | /* ==================================================================== 2 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * 3. All advertising materials mentioning features or use of this 17 | * software must display the following acknowledgment: 18 | * "This product includes software developed by the OpenSSL Project 19 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 20 | * 21 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 22 | * endorse or promote products derived from this software without 23 | * prior written permission. For written permission, please contact 24 | * licensing@OpenSSL.org. 25 | * 26 | * 5. Products derived from this software may not be called "OpenSSL" 27 | * nor may "OpenSSL" appear in their names without prior written 28 | * permission of the OpenSSL Project. 29 | * 30 | * 6. Redistributions of any form whatsoever must retain the following 31 | * acknowledgment: 32 | * "This product includes software developed by the OpenSSL Project 33 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 34 | * 35 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 36 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 37 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 38 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 41 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 42 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 43 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 44 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 45 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 46 | * OF THE POSSIBILITY OF SUCH DAMAGE. 47 | * ==================================================================== 48 | * 49 | * This product includes cryptographic software written by Eric Young 50 | * (eay@cryptsoft.com). This product includes software written by Tim 51 | * Hudson (tjh@cryptsoft.com). 52 | * 53 | */ 54 | 55 | /* 56 | * This header only exists to break a circular dependency between pem and err 57 | * Ben 30 Jan 1999. 58 | */ 59 | 60 | #ifdef __cplusplus 61 | extern "C" { 62 | #endif 63 | 64 | #ifndef HEADER_PEM_H 65 | void ERR_load_PEM_strings(void); 66 | #endif 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/openssl/pqueue.h: -------------------------------------------------------------------------------- 1 | /* crypto/pqueue/pqueue.h */ 2 | /* 3 | * DTLS implementation written by Nagendra Modadugu 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * openssl-core@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #ifndef HEADER_PQUEUE_H 61 | # define HEADER_PQUEUE_H 62 | 63 | # include 64 | # include 65 | # include 66 | 67 | #ifdef __cplusplus 68 | extern "C" { 69 | #endif 70 | typedef struct _pqueue *pqueue; 71 | 72 | typedef struct _pitem { 73 | unsigned char priority[8]; /* 64-bit value in big-endian encoding */ 74 | void *data; 75 | struct _pitem *next; 76 | } pitem; 77 | 78 | typedef struct _pitem *piterator; 79 | 80 | pitem *pitem_new(unsigned char *prio64be, void *data); 81 | void pitem_free(pitem *item); 82 | 83 | pqueue pqueue_new(void); 84 | void pqueue_free(pqueue pq); 85 | 86 | pitem *pqueue_insert(pqueue pq, pitem *item); 87 | pitem *pqueue_peek(pqueue pq); 88 | pitem *pqueue_pop(pqueue pq); 89 | pitem *pqueue_find(pqueue pq, unsigned char *prio64be); 90 | pitem *pqueue_iterator(pqueue pq); 91 | pitem *pqueue_next(piterator *iter); 92 | 93 | void pqueue_print(pqueue pq); 94 | int pqueue_size(pqueue pq); 95 | 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | #endif /* ! HEADER_PQUEUE_H */ 100 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/openssl/rc4.h: -------------------------------------------------------------------------------- 1 | /* crypto/rc4/rc4.h */ 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_RC4_H 60 | # define HEADER_RC4_H 61 | 62 | # include /* OPENSSL_NO_RC4, RC4_INT */ 63 | # ifdef OPENSSL_NO_RC4 64 | # error RC4 is disabled. 65 | # endif 66 | 67 | # include 68 | 69 | #ifdef __cplusplus 70 | extern "C" { 71 | #endif 72 | 73 | typedef struct rc4_key_st { 74 | RC4_INT x, y; 75 | RC4_INT data[256]; 76 | } RC4_KEY; 77 | 78 | const char *RC4_options(void); 79 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 80 | void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 81 | void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, 82 | unsigned char *outdata); 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/openssl/ssl23.h: -------------------------------------------------------------------------------- 1 | /* ssl/ssl23.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_SSL23_H 60 | # define HEADER_SSL23_H 61 | 62 | #ifdef __cplusplus 63 | extern "C" { 64 | #endif 65 | 66 | /* 67 | * client 68 | */ 69 | /* write to server */ 70 | # define SSL23_ST_CW_CLNT_HELLO_A (0x210|SSL_ST_CONNECT) 71 | # define SSL23_ST_CW_CLNT_HELLO_B (0x211|SSL_ST_CONNECT) 72 | /* read from server */ 73 | # define SSL23_ST_CR_SRVR_HELLO_A (0x220|SSL_ST_CONNECT) 74 | # define SSL23_ST_CR_SRVR_HELLO_B (0x221|SSL_ST_CONNECT) 75 | 76 | /* server */ 77 | /* read from client */ 78 | # define SSL23_ST_SR_CLNT_HELLO_A (0x210|SSL_ST_ACCEPT) 79 | # define SSL23_ST_SR_CLNT_HELLO_B (0x211|SSL_ST_ACCEPT) 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | #endif 85 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/openssl/ui_compat.h: -------------------------------------------------------------------------------- 1 | /* crypto/ui/ui.h */ 2 | /* 3 | * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project 4 | * 2001. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * openssl-core@openssl.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #ifndef HEADER_UI_COMPAT_H 61 | # define HEADER_UI_COMPAT_H 62 | 63 | # include 64 | # include 65 | 66 | #ifdef __cplusplus 67 | extern "C" { 68 | #endif 69 | 70 | /* 71 | * The following functions were previously part of the DES section, and are 72 | * provided here for backward compatibility reasons. 73 | */ 74 | 75 | # define des_read_pw_string(b,l,p,v) \ 76 | _ossl_old_des_read_pw_string((b),(l),(p),(v)) 77 | # define des_read_pw(b,bf,s,p,v) \ 78 | _ossl_old_des_read_pw((b),(bf),(s),(p),(v)) 79 | 80 | int _ossl_old_des_read_pw_string(char *buf, int length, const char *prompt, 81 | int verify); 82 | int _ossl_old_des_read_pw(char *buf, char *buff, int size, const char *prompt, 83 | int verify); 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | #endif 89 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/openssl/whrlpool.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_WHRLPOOL_H 2 | # define HEADER_WHRLPOOL_H 3 | 4 | # include 5 | # include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | # define WHIRLPOOL_DIGEST_LENGTH (512/8) 12 | # define WHIRLPOOL_BBLOCK 512 13 | # define WHIRLPOOL_COUNTER (256/8) 14 | 15 | typedef struct { 16 | union { 17 | unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; 18 | /* double q is here to ensure 64-bit alignment */ 19 | double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; 20 | } H; 21 | unsigned char data[WHIRLPOOL_BBLOCK / 8]; 22 | unsigned int bitoff; 23 | size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; 24 | } WHIRLPOOL_CTX; 25 | 26 | # ifndef OPENSSL_NO_WHIRLPOOL 27 | # ifdef OPENSSL_FIPS 28 | int private_WHIRLPOOL_Init(WHIRLPOOL_CTX *c); 29 | # endif 30 | int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); 31 | int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes); 32 | void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits); 33 | int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); 34 | unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md); 35 | # endif 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/include/ttmath/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006-2010, Tomasz Sowa 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | * Neither the name Tomasz Sowa nor the names of contributors to this 15 | project may be used to endorse or promote products derived 16 | from this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 | THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/lib/libcrypto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DBOS-project/dbos-scheduler/8f315fc6431908d84086b9cc138aed2e8486a3a0/third_party/voltdb-client-cpp/lib/libcrypto.a -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/lib/libevent.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DBOS-project/dbos-scheduler/8f315fc6431908d84086b9cc138aed2e8486a3a0/third_party/voltdb-client-cpp/lib/libevent.a -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/lib/libevent_openssl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DBOS-project/dbos-scheduler/8f315fc6431908d84086b9cc138aed2e8486a3a0/third_party/voltdb-client-cpp/lib/libevent_openssl.a -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/lib/libevent_pthreads.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DBOS-project/dbos-scheduler/8f315fc6431908d84086b9cc138aed2e8486a3a0/third_party/voltdb-client-cpp/lib/libevent_pthreads.a -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/lib/libssl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DBOS-project/dbos-scheduler/8f315fc6431908d84086b9cc138aed2e8486a3a0/third_party/voltdb-client-cpp/lib/libssl.a -------------------------------------------------------------------------------- /third_party/voltdb-client-cpp/lib/libvoltdbcpp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DBOS-project/dbos-scheduler/8f315fc6431908d84086b9cc138aed2e8486a3a0/third_party/voltdb-client-cpp/lib/libvoltdbcpp.a --------------------------------------------------------------------------------