├── .build.linux.sh ├── .build.osx.sh ├── .build.sh ├── .clang-format ├── .github ├── dependabot.yml └── workflows │ ├── docs-pages.yaml │ └── docs-pr.yaml ├── .gitignore ├── .nav ├── CHANGELOG.md ├── CMakeLists.txt ├── CONTRIBUTING.md ├── Doxyfile.in ├── Jenkinsfile ├── README-dev.md ├── README.md ├── appveyor.ps1 ├── appveyor.yml ├── cmake ├── ClangFormat.cmake ├── Dependencies.cmake ├── ExternalProject-OpenSSL.cmake ├── ExternalProject-libssh2.cmake ├── ExternalProject-libuv.cmake ├── ExternalProject-zlib.cmake ├── FindKerberos.cmake ├── FindLibssh2.cmake ├── FindLibuv.cmake ├── FindOpenSSL.cmake └── Windows-Environment.cmake ├── cmake_uninstall.cmake.in ├── docs.yaml ├── docs ├── Makefile ├── _utils │ ├── deploy.sh │ ├── multiversion.sh │ └── redirects.yaml ├── poetry.lock ├── pyproject.toml └── source │ ├── api │ └── index.rst │ ├── conf.py │ ├── contents.rst │ ├── index.md │ └── topics ├── driver_config.hpp.in ├── examples ├── CMakeLists.txt ├── async │ ├── .gitignore │ ├── CMakeLists.txt │ └── async.c ├── auth │ ├── .gitignore │ ├── CMakeLists.txt │ └── auth.c ├── basic │ ├── .gitignore │ ├── CMakeLists.txt │ └── basic.c ├── batch │ ├── .gitignore │ ├── CMakeLists.txt │ └── batch.c ├── bind_by_name │ ├── .gitignore │ ├── CMakeLists.txt │ └── bind_by_name.c ├── callbacks │ ├── .gitignore │ ├── CMakeLists.txt │ └── callbacks.c ├── cloud │ ├── .gitignore │ ├── CMakeLists.txt │ └── cloud.c ├── collections │ ├── .gitignore │ ├── CMakeLists.txt │ └── collections.c ├── concurrent_executions │ ├── .gitignore │ ├── CMakeLists.txt │ └── concurrent_executions.c ├── date_time │ ├── .gitignore │ ├── CMakeLists.txt │ └── data_time.c ├── dse │ ├── date_range │ │ ├── CMakeLists.txt │ │ └── date_range.c │ ├── geotypes │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ └── geotypes.c │ ├── gssapi │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── gssapi.c │ │ └── gssapi_proxy.c │ ├── plaintext │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── plaintext.c │ │ └── plaintext_proxy.c │ └── proxy_execution │ │ ├── CMakeLists.txt │ │ └── proxy_execution.c ├── duration │ ├── CMakeLists.txt │ └── duration.c ├── execution_profiles │ ├── .gitignore │ ├── CMakeLists.txt │ └── execution_profiles.c ├── host_listener │ ├── .gitignore │ ├── CMakeLists.txt │ └── host_listener.c ├── logging │ ├── .gitignore │ ├── CMakeLists.txt │ └── logging.c ├── maps │ ├── .gitignore │ ├── CMakeLists.txt │ └── maps.c ├── named_parameters │ ├── .gitignore │ ├── CMakeLists.txt │ └── named_parameters.c ├── paging │ ├── .gitignore │ ├── CMakeLists.txt │ └── paging.c ├── perf │ ├── .gitignore │ ├── CMakeLists.txt │ └── perf.c ├── prepared │ ├── .gitignore │ ├── CMakeLists.txt │ └── prepared.c ├── schema_meta │ ├── .gitignore │ ├── CMakeLists.txt │ └── schema_meta.c ├── simple │ ├── .gitignore │ ├── CMakeLists.txt │ └── simple.c ├── ssl │ ├── .gitignore │ ├── CMakeLists.txt │ └── ssl.c ├── tracing │ ├── .gitignore │ ├── CMakeLists.txt │ └── tracing.c ├── tuple │ ├── .gitignore │ ├── CMakeLists.txt │ └── tuple.c ├── udt │ ├── .gitignore │ ├── CMakeLists.txt │ └── udt.c └── uuids │ ├── .gitignore │ ├── CMakeLists.txt │ └── uuids.c ├── include ├── cassandra.h └── dse.h ├── licenses ├── apache-2.0.txt └── boost-1.0.txt ├── packaging ├── README.md ├── build_deb.sh ├── build_rpm.sh ├── debian │ ├── changelog │ ├── compat │ ├── control │ ├── copyright │ ├── rules │ ├── scylla-cpp-driver-dev.install │ ├── scylla-cpp-driver.install │ ├── scylla-cpp-driver.links │ ├── scylla-cpp-driver.pc │ ├── scylla-cpp-driver_static.pc │ └── source │ │ └── format ├── homebrew │ └── cassandra-cpp-driver.rb ├── scylla-cpp-driver.pc.in ├── scylla-cpp-driver.spec └── scylla-cpp-driver_static.pc.in ├── src ├── CMakeLists.txt ├── abstract_data.cpp ├── abstract_data.hpp ├── address.cpp ├── address.hpp ├── address_factory.cpp ├── address_factory.hpp ├── aligned_storage.hpp ├── allocated.cpp ├── allocated.hpp ├── allocator.hpp ├── async.cpp ├── async.hpp ├── atomic.hpp ├── atomic │ ├── atomic_boost.hpp │ ├── atomic_intrinsics.hpp │ ├── atomic_intrinsics_gcc.hpp │ ├── atomic_intrinsics_msvc.hpp │ └── atomic_std.hpp ├── auth.cpp ├── auth.hpp ├── auth_requests.cpp ├── auth_requests.hpp ├── auth_responses.cpp ├── auth_responses.hpp ├── batch_request.cpp ├── batch_request.hpp ├── blacklist_dc_policy.cpp ├── blacklist_dc_policy.hpp ├── blacklist_policy.cpp ├── blacklist_policy.hpp ├── buffer.hpp ├── callback.hpp ├── client_insights.cpp ├── client_insights.hpp ├── cloud_secure_connection_config.cpp ├── cloud_secure_connection_config.hpp ├── cluster.cpp ├── cluster.hpp ├── cluster_config.cpp ├── cluster_config.hpp ├── cluster_connector.cpp ├── cluster_connector.hpp ├── cluster_metadata_resolver.cpp ├── cluster_metadata_resolver.hpp ├── collection.cpp ├── collection.hpp ├── collection_iterator.cpp ├── collection_iterator.hpp ├── config.cpp ├── config.hpp ├── connection.cpp ├── connection.hpp ├── connection_pool.cpp ├── connection_pool.hpp ├── connection_pool_connector.cpp ├── connection_pool_connector.hpp ├── connection_pool_manager.cpp ├── connection_pool_manager.hpp ├── connection_pool_manager_initializer.cpp ├── connection_pool_manager_initializer.hpp ├── connector.cpp ├── connector.hpp ├── constants.hpp ├── control_connection.cpp ├── control_connection.hpp ├── control_connector.cpp ├── control_connector.hpp ├── copy_on_write_ptr.hpp ├── data_type.cpp ├── data_type.hpp ├── data_type_parser.cpp ├── data_type_parser.hpp ├── dc_aware_policy.cpp ├── dc_aware_policy.hpp ├── decoder.cpp ├── decoder.hpp ├── delayed_connector.cpp ├── delayed_connector.hpp ├── dense_hash_map.hpp ├── dense_hash_set.hpp ├── deque.hpp ├── driver_info.cpp ├── driver_info.hpp ├── dse_auth.cpp ├── dse_auth.hpp ├── dse_batch_request.cpp ├── dse_cluster_config.cpp ├── dse_collection.cpp ├── dse_date_range.cpp ├── dse_date_range.hpp ├── dse_line_string.cpp ├── dse_line_string.hpp ├── dse_point.cpp ├── dse_point.hpp ├── dse_polygon.cpp ├── dse_polygon.hpp ├── dse_serialization.hpp ├── dse_statement.cpp ├── dse_tuple.cpp ├── dse_user_type_value.cpp ├── dse_validate.hpp ├── dse_value.cpp ├── encode.cpp ├── encode.hpp ├── error_response.cpp ├── error_response.hpp ├── event_loop.cpp ├── event_loop.hpp ├── event_response.cpp ├── event_response.hpp ├── execute_request.cpp ├── execute_request.hpp ├── execution_profile.cpp ├── execution_profile.hpp ├── exported_connection.cpp ├── exported_connection.hpp ├── external.cpp ├── external.hpp ├── fixed_allocator.hpp ├── fixnl.sh ├── future.cpp ├── future.hpp ├── get_time-mac.cpp ├── get_time-unix.cpp ├── get_time-win.cpp ├── get_time.hpp ├── gssapi │ ├── dse_auth_gssapi.cpp │ └── dse_auth_gssapi.hpp ├── hash.hpp ├── hash_table.hpp ├── histogram_wrapper.hpp ├── host.cpp ├── host.hpp ├── http_client.cpp ├── http_client.hpp ├── iterator.cpp ├── iterator.hpp ├── json.hpp ├── latency_aware_policy.cpp ├── latency_aware_policy.hpp ├── list.hpp ├── list_policy.cpp ├── list_policy.hpp ├── load_balancing.hpp ├── logger.cpp ├── logger.hpp ├── loop_watcher.hpp ├── macros.hpp ├── map.hpp ├── map_iterator.cpp ├── map_iterator.hpp ├── md5.cpp ├── md5.hpp ├── memory.cpp ├── memory.hpp ├── metadata.cpp ├── metadata.hpp ├── metrics.hpp ├── micro_timer.cpp ├── micro_timer.hpp ├── monitor_reporting.hpp ├── mpmc_queue.hpp ├── murmur3.cpp ├── murmur3.hpp ├── name_resolver.hpp ├── optional.hpp ├── optional │ ├── optional_akrzemi.hpp │ └── optional_std.hpp ├── options_request.hpp ├── pooled_connection.cpp ├── pooled_connection.hpp ├── prepare_all_handler.cpp ├── prepare_all_handler.hpp ├── prepare_host_handler.cpp ├── prepare_host_handler.hpp ├── prepare_request.cpp ├── prepare_request.hpp ├── prepared.cpp ├── prepared.hpp ├── protocol.cpp ├── protocol.hpp ├── query_request.cpp ├── query_request.hpp ├── rack_aware_policy.cpp ├── rack_aware_policy.hpp ├── random.cpp ├── random.hpp ├── ready_response.hpp ├── reconnection_policy.cpp ├── reconnection_policy.hpp ├── ref_counted.hpp ├── register_request.cpp ├── register_request.hpp ├── request.cpp ├── request.hpp ├── request_callback.cpp ├── request_callback.hpp ├── request_handler.cpp ├── request_handler.hpp ├── request_processor.cpp ├── request_processor.hpp ├── request_processor_initializer.cpp ├── request_processor_initializer.hpp ├── resolver.hpp ├── response.cpp ├── response.hpp ├── result_iterator.hpp ├── result_metadata.cpp ├── result_metadata.hpp ├── result_response.cpp ├── result_response.hpp ├── retry_policy.cpp ├── retry_policy.hpp ├── ring_buffer.cpp ├── ring_buffer.hpp ├── round_robin_policy.cpp ├── round_robin_policy.hpp ├── row.cpp ├── row.hpp ├── row_iterator.hpp ├── schema_agreement_handler.cpp ├── schema_agreement_handler.hpp ├── scoped_lock.hpp ├── scoped_ptr.hpp ├── serialization.hpp ├── session.cpp ├── session.hpp ├── session_base.cpp ├── session_base.hpp ├── set.hpp ├── shard_port_calculator.cpp ├── shard_port_calculator.hpp ├── sharding_info.cpp ├── sharding_info.hpp ├── small_dense_hash_map.hpp ├── small_vector.hpp ├── socket.cpp ├── socket.hpp ├── socket_connector.cpp ├── socket_connector.hpp ├── speculative_execution.hpp ├── spin_lock.hpp ├── spsc_queue.hpp ├── ssl.cpp ├── ssl.hpp ├── ssl │ ├── ring_buffer_bio.cpp │ ├── ring_buffer_bio.hpp │ ├── ssl_no_impl.cpp │ ├── ssl_no_impl.hpp │ ├── ssl_openssl_impl.cpp │ └── ssl_openssl_impl.hpp ├── stack.hpp ├── startup_request.cpp ├── startup_request.hpp ├── statement.cpp ├── statement.hpp ├── stream_manager.hpp ├── string.hpp ├── string_ref.cpp ├── string_ref.hpp ├── supported_response.cpp ├── supported_response.hpp ├── tcp_connector.hpp ├── testing.cpp ├── testing.hpp ├── third_party │ ├── curl │ │ ├── CMakeLists.txt │ │ ├── COPYING │ │ ├── hostcheck.cpp │ │ └── hostcheck.hpp │ ├── hdr_histogram │ │ ├── CMakeLists.txt │ │ ├── LICENSE.txt │ │ ├── hdr_histogram.cpp │ │ └── hdr_histogram.hpp │ ├── http-parser │ │ ├── AUTHORS │ │ ├── CMakeLists.txt │ │ ├── LICENSE-MIT │ │ ├── README │ │ ├── README.md │ │ ├── bench.c │ │ ├── contrib │ │ │ ├── parsertrace.c │ │ │ └── url_parser.c │ │ ├── http_parser.c │ │ ├── http_parser.gyp │ │ ├── http_parser.h │ │ └── test.c │ ├── minizip │ │ ├── CMakeLists.txt │ │ ├── Makefile.am │ │ ├── MiniZip64_Changes.txt │ │ ├── MiniZip64_info.txt │ │ ├── README │ │ ├── c90_patch.diff │ │ ├── configure.ac │ │ ├── crypt.h │ │ ├── ioapi.c │ │ ├── ioapi.h │ │ ├── iowin32.c │ │ ├── iowin32.h │ │ ├── make_vms.com │ │ ├── miniunz.c │ │ ├── miniunzip.1 │ │ ├── minizip.1 │ │ ├── minizip.c │ │ ├── minizip.pc.in │ │ ├── mztools.c │ │ ├── mztools.h │ │ ├── unzip.c │ │ ├── unzip.h │ │ ├── zip.c │ │ └── zip.h │ ├── mt19937_64 │ │ ├── CMakeLists.txt │ │ └── mt19937_64.hpp │ ├── rapidjson │ │ ├── CMakeLists.txt │ │ ├── README │ │ ├── license.txt │ │ └── rapidjson │ │ │ ├── allocators.h │ │ │ ├── cursorstreamwrapper.h │ │ │ ├── document.h │ │ │ ├── encodedstream.h │ │ │ ├── encodings.h │ │ │ ├── error │ │ │ ├── en.h │ │ │ └── error.h │ │ │ ├── filereadstream.h │ │ │ ├── filewritestream.h │ │ │ ├── fwd.h │ │ │ ├── internal │ │ │ ├── biginteger.h │ │ │ ├── diyfp.h │ │ │ ├── dtoa.h │ │ │ ├── ieee754.h │ │ │ ├── itoa.h │ │ │ ├── meta.h │ │ │ ├── pow10.h │ │ │ ├── regex.h │ │ │ ├── stack.h │ │ │ ├── strfunc.h │ │ │ ├── strtod.h │ │ │ └── swap.h │ │ │ ├── istreamwrapper.h │ │ │ ├── memorybuffer.h │ │ │ ├── memorystream.h │ │ │ ├── msinttypes │ │ │ ├── inttypes.h │ │ │ └── stdint.h │ │ │ ├── ostreamwrapper.h │ │ │ ├── pointer.h │ │ │ ├── prettywriter.h │ │ │ ├── rapidjson.h │ │ │ ├── reader.h │ │ │ ├── schema.h │ │ │ ├── stream.h │ │ │ ├── stringbuffer.h │ │ │ └── writer.h │ └── sparsehash │ │ ├── AUTHORS │ │ ├── CMakeLists.txt │ │ ├── COPYING │ │ ├── config.h.cmake │ │ └── src │ │ └── sparsehash │ │ ├── dense_hash_map │ │ ├── dense_hash_set │ │ ├── internal │ │ ├── densehashtable.h │ │ ├── hashtable-common.h │ │ └── libc_allocator_with_realloc.h │ │ ├── template_util.h │ │ └── type_traits.h ├── timer.cpp ├── timer.hpp ├── timestamp_generator.cpp ├── timestamp_generator.hpp ├── token_aware_policy.cpp ├── token_aware_policy.hpp ├── token_map.cpp ├── token_map.hpp ├── token_map_impl.cpp ├── token_map_impl.hpp ├── tracing_data_handler.cpp ├── tracing_data_handler.hpp ├── tuple.cpp ├── tuple.hpp ├── types.hpp ├── user_type_field_iterator.cpp ├── user_type_field_iterator.hpp ├── user_type_value.cpp ├── user_type_value.hpp ├── utils.cpp ├── utils.hpp ├── uuids.cpp ├── uuids.hpp ├── value.cpp ├── value.hpp ├── vector.hpp ├── wait_for_handler.cpp ├── wait_for_handler.hpp ├── whitelist_dc_policy.cpp ├── whitelist_dc_policy.hpp ├── whitelist_policy.cpp ├── whitelist_policy.hpp ├── wkt.cpp ├── wkt.hpp ├── wkt.rl └── wktgen.sh ├── tests ├── CMakeLists.txt ├── embedded-ads.jar └── src │ ├── integration │ ├── CMakeLists.txt │ ├── bignumber.hpp │ ├── ccm │ │ ├── authentication_type.hpp │ │ ├── bridge.cpp │ │ ├── bridge.hpp │ │ ├── bridge_exception.hpp │ │ ├── cass_version.hpp │ │ ├── deployment_type.hpp │ │ ├── dse_credentials_type.hpp │ │ ├── process.cpp │ │ ├── process.hpp │ │ ├── server_type.hpp │ │ ├── socket_exception.hpp │ │ ├── tsocket.cpp │ │ └── tsocket.hpp │ ├── dse_integration.cpp │ ├── dse_integration.hpp │ ├── dse_nullable_value.hpp │ ├── dse_objects.hpp │ ├── dse_values.hpp │ ├── embedded_ads.cpp │ ├── embedded_ads.hpp │ ├── exception.hpp │ ├── integration.cpp │ ├── integration.hpp │ ├── logger.cpp │ ├── logger.hpp │ ├── main.cpp │ ├── nullable_value.hpp │ ├── objects.hpp │ ├── objects │ │ ├── cluster.hpp │ │ ├── collection.hpp │ │ ├── custom_payload.hpp │ │ ├── dse_cluster.hpp │ │ ├── dse_session.hpp │ │ ├── dse_statement.hpp │ │ ├── error_result.hpp │ │ ├── execution_profile.hpp │ │ ├── future.hpp │ │ ├── iterator.hpp │ │ ├── object_base.hpp │ │ ├── prepared.hpp │ │ ├── result.hpp │ │ ├── retry_policy.cpp │ │ ├── retry_policy.hpp │ │ ├── schema.hpp │ │ ├── session.hpp │ │ ├── ssl.hpp │ │ ├── statement.cpp │ │ ├── statement.hpp │ │ ├── timestamp_generator.hpp │ │ ├── tuple.hpp │ │ ├── user_type.hpp │ │ └── uuid_gen.hpp │ ├── options.cpp │ ├── options.hpp │ ├── policies.hpp │ ├── policies │ │ ├── ignore_retry_policy.hpp │ │ └── next_host_retry_policy.hpp │ ├── pretty_print.cpp │ ├── pretty_print.hpp │ ├── rest_client.cpp │ ├── rest_client.hpp │ ├── shared_ptr.hpp │ ├── ssl_certificates.hpp │ ├── strptime.cpp │ ├── strptime.hpp │ ├── test_category.cpp │ ├── test_category.hpp │ ├── test_utils.cpp │ ├── test_utils.hpp │ ├── tests │ │ ├── test_async.cpp │ │ ├── test_auth.cpp │ │ ├── test_basics.cpp │ │ ├── test_batch.cpp │ │ ├── test_by_name.cpp │ │ ├── test_cassandra_types.cpp │ │ ├── test_cluster.cpp │ │ ├── test_config.cpp │ │ ├── test_consistency.cpp │ │ ├── test_control_connection.cpp │ │ ├── test_custom_payload.cpp │ │ ├── test_dbaas.cpp │ │ ├── test_dc_aware_policy.cpp │ │ ├── test_dse_auth.cpp │ │ ├── test_dse_proxy_auth.cpp │ │ ├── test_dse_types.cpp │ │ ├── test_exec_profile.cpp │ │ ├── test_heartbeat.cpp │ │ ├── test_latency_aware_policy.cpp │ │ ├── test_logging.cpp │ │ ├── test_metrics.cpp │ │ ├── test_named_parameters.cpp │ │ ├── test_null_string_params.cpp │ │ ├── test_prepare_on.cpp │ │ ├── test_prepared.cpp │ │ ├── test_prepared_metadata.cpp │ │ ├── test_schema_agreement.cpp │ │ ├── test_schema_metadata.cpp │ │ ├── test_server_side_failure.cpp │ │ ├── test_session.cpp │ │ ├── test_set_keyspace.cpp │ │ ├── test_speculative_execution.cpp │ │ ├── test_ssl.cpp │ │ ├── test_startup_options.cpp │ │ ├── test_statement.cpp │ │ ├── test_timestamp.cpp │ │ ├── test_tracing.cpp │ │ └── test_use_keyspace.cpp │ ├── tlog.hpp │ ├── values.hpp │ ├── values │ │ ├── ascii.hpp │ │ ├── blob.hpp │ │ ├── boolean.hpp │ │ ├── date.hpp │ │ ├── decimal.hpp │ │ ├── double.hpp │ │ ├── dse_date_range.hpp │ │ ├── dse_line_string.hpp │ │ ├── dse_point.hpp │ │ ├── dse_polygon.hpp │ │ ├── duration.hpp │ │ ├── float.hpp │ │ ├── inet.hpp │ │ ├── integer.hpp │ │ ├── list.hpp │ │ ├── map.hpp │ │ ├── set.hpp │ │ ├── time.hpp │ │ ├── timestamp.hpp │ │ ├── uuid.hpp │ │ ├── varchar.hpp │ │ └── varint.hpp │ ├── win_debug.cpp │ └── win_debug.hpp │ ├── unit │ ├── CMakeLists.txt │ ├── event_loop_test.hpp │ ├── http_server.cpp │ ├── http_server.hpp │ ├── http_test.cpp │ ├── http_test.hpp │ ├── loop_test.hpp │ ├── main.cpp │ ├── mockssandra.cpp │ ├── mockssandra.hpp │ ├── test_token_map_utils.hpp │ ├── tests │ │ ├── test_address.cpp │ │ ├── test_async.cpp │ │ ├── test_atomic.cpp │ │ ├── test_class_type_parser.cpp │ │ ├── test_client_insights.cpp │ │ ├── test_cloud_secure_connect_config.cpp │ │ ├── test_cluster.cpp │ │ ├── test_connection.cpp │ │ ├── test_control_connection.cpp │ │ ├── test_copy_on_write.cpp │ │ ├── test_cql_type_parser.cpp │ │ ├── test_custom_allocator.cpp │ │ ├── test_data_type.cpp │ │ ├── test_date_time.cpp │ │ ├── test_decoder.cpp │ │ ├── test_dse_line_string.cpp │ │ ├── test_dse_point.cpp │ │ ├── test_dse_polygon.cpp │ │ ├── test_encode.cpp │ │ ├── test_event_loop.cpp │ │ ├── test_exec_profile.cpp │ │ ├── test_future.cpp │ │ ├── test_get_time.cpp │ │ ├── test_hash_table.cpp │ │ ├── test_http_client.cpp │ │ ├── test_inet.cpp │ │ ├── test_load_balancing.cpp │ │ ├── test_logging.cpp │ │ ├── test_loop_watcher.cpp │ │ ├── test_md5.cpp │ │ ├── test_metadata.cpp │ │ ├── test_metrics.cpp │ │ ├── test_micro_timer.cpp │ │ ├── test_name_resolver.cpp │ │ ├── test_pool.cpp │ │ ├── test_prepared.cpp │ │ ├── test_protocol_version.cpp │ │ ├── test_random.cpp │ │ ├── test_reconnection_policy.cpp │ │ ├── test_replication_strategy.cpp │ │ ├── test_request_processor.cpp │ │ ├── test_resolver.cpp │ │ ├── test_retry_policies.cpp │ │ ├── test_routing_key.cpp │ │ ├── test_schema_agreement.cpp │ │ ├── test_scoped_lock.cpp │ │ ├── test_serialization.cpp │ │ ├── test_session.cpp │ │ ├── test_session_base.cpp │ │ ├── test_small_vector.cpp │ │ ├── test_socket.cpp │ │ ├── test_startup_options.cpp │ │ ├── test_statement.cpp │ │ ├── test_stream_manager.cpp │ │ ├── test_string_ref.cpp │ │ ├── test_supported_response.cpp │ │ ├── test_tcp_connector.cpp │ │ ├── test_timer.cpp │ │ ├── test_timestamp_gen.cpp │ │ ├── test_token.cpp │ │ ├── test_token_map.cpp │ │ ├── test_tracing.cpp │ │ ├── test_utils.cpp │ │ ├── test_uuids.cpp │ │ ├── test_value.cpp │ │ └── test_wait_for_handler.cpp │ ├── uint128.hpp │ ├── unit.cpp │ └── unit.hpp │ └── vendor │ └── gtest │ ├── LICENSE │ ├── gtest-all.cc │ ├── gtest.h │ └── vendor.info ├── tools └── alloc-linter-tool │ ├── .gitignore │ ├── CMakeLists.txt │ ├── README.md │ └── alloc_linter_tool.cpp └── topics ├── README.md ├── basics ├── README.md ├── batches │ └── README.md ├── binding_parameters │ └── README.md ├── client_side_timestamps │ └── README.md ├── consistency │ └── README.md ├── data_types │ └── README.md ├── date_and_time │ └── README.md ├── futures │ └── README.md ├── handling_results │ └── README.md ├── keyspaces │ └── README.md ├── prepared_statements │ └── README.md ├── schema_metadata │ └── README.md ├── tuples │ └── README.md ├── user_defined_types │ └── README.md └── uuids │ └── README.md ├── building └── README.md ├── client_configuration └── README.md ├── cloud └── README.md ├── configuration ├── README.md └── retry_policies │ └── README.md ├── dse_features ├── README.md ├── authentication │ └── README.md └── geotypes │ └── README.md ├── execution_profiles └── README.md ├── faq └── README.md ├── installation └── README.md ├── logging └── README.md ├── metrics └── README.md ├── scylla_specific └── README.md ├── security ├── README.md └── ssl │ └── README.md ├── testing ├── README.md └── ccm │ └── README.md └── tracing └── README.md /.build.osx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## 3 | # Copyright (c) DataStax, Inc. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | ## 17 | 18 | configure_testing_environment() { 19 | true 20 | } 21 | 22 | install_libuv() { 23 | if brew ls --versions libuv > /dev/null; then 24 | if ! brew outdated libuv; then 25 | brew upgrade libuv 26 | fi 27 | else 28 | brew install libuv 29 | fi 30 | } 31 | 32 | install_openssl() { 33 | if brew ls --versions openssl > /dev/null; then 34 | if ! brew outdated openssl; then 35 | brew upgrade openssl 36 | fi 37 | else 38 | brew install openssl 39 | fi 40 | } 41 | 42 | install_zlib() { 43 | if brew ls --versions zlib > /dev/null; then 44 | if ! brew outdated zlib; then 45 | brew upgrade zlib 46 | fi 47 | else 48 | brew install zlib 49 | fi 50 | } 51 | 52 | install_driver() { 53 | true 54 | } 55 | 56 | test_installed_driver() { 57 | true 58 | } 59 | 60 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: LLVM 3 | Language: Cpp 4 | Standard: Cpp03 5 | AccessModifierOffset: -2 6 | IndentWidth: 2 7 | TabWidth: 8 8 | ColumnLimit: 100 9 | UseTab: Never 10 | IndentCaseLabels: true 11 | AlignAfterOpenBracket: true 12 | AlignEscapedNewlines: Left 13 | BreakConstructorInitializers: BeforeComma 14 | AllowShortBlocksOnASingleLine: false 15 | DerivePointerAlignment: false 16 | PointerAlignment: Left 17 | BinPackParameters: true 18 | BinPackArguments: true 19 | AllowShortIfStatementsOnASingleLine: true 20 | CompactNamespaces: true 21 | AlignOperands: true 22 | SpacesInContainerLiterals: true 23 | ConstructorInitializerAllOnOneLineOrOnePerLine: false 24 | Cpp11BracedListStyle: false 25 | AlwaysBreakTemplateDeclarations: true 26 | BreakBeforeInheritanceComma: true 27 | ... 28 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "pip" 4 | directory: "/docs" 5 | schedule: 6 | interval: "daily" 7 | allow: 8 | - dependency-name: "sphinx-scylladb-theme" 9 | - dependency-name: "sphinx-multiversion-scylla" 10 | -------------------------------------------------------------------------------- /.github/workflows/docs-pages.yaml: -------------------------------------------------------------------------------- 1 | name: "Docs / Publish" 2 | # For more information, 3 | # see https://sphinx-theme.scylladb.com/stable/deployment/production.html#available-workflows 4 | 5 | on: 6 | push: 7 | branches: 8 | - master 9 | - 'branch-**' 10 | paths: 11 | - "docs/**" 12 | - "topics/**" 13 | workflow_dispatch: 14 | 15 | jobs: 16 | release: 17 | runs-on: ubuntu-latest 18 | steps: 19 | - name: Checkout 20 | uses: actions/checkout@v4 21 | with: 22 | ref: ${{ github.event.repository.default_branch }} 23 | persist-credentials: false 24 | fetch-depth: 0 25 | - name: Set up Python 26 | uses: actions/setup-python@v5 27 | with: 28 | python-version: '3.10' 29 | - name: Set up env 30 | run: make -C docs setupenv 31 | - name: Build docs 32 | run: make -C docs multiversion 33 | - name: Build redirects 34 | run: make -C docs redirects 35 | - name: Deploy docs to GitHub Pages 36 | run: ./docs/_utils/deploy.sh 37 | env: 38 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 39 | -------------------------------------------------------------------------------- /.github/workflows/docs-pr.yaml: -------------------------------------------------------------------------------- 1 | name: "Docs / Build PR" 2 | # For more information, 3 | # see https://sphinx-theme.scylladb.com/stable/deployment/production.html#available-workflows 4 | 5 | on: 6 | pull_request: 7 | branches: 8 | - master 9 | paths: 10 | - "docs/**" 11 | - "topics/**" 12 | 13 | jobs: 14 | build: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v4 19 | with: 20 | persist-credentials: false 21 | fetch-depth: 0 22 | - name: Set up Python 23 | uses: actions/setup-python@v5 24 | with: 25 | python-version: '3.10' 26 | - name: Set up env 27 | run: make -C docs setupenv 28 | - name: Build docs 29 | run: make -C docs test 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.0 6 | 7 | # Compiled Dynamic libraries 8 | libscylla-cpp-driver.so* 9 | *.dylib 10 | 11 | # Compiled Static libraries 12 | *.lai 13 | *.la 14 | *.a 15 | 16 | # cmake output 17 | src/third_party/sparsehash/src/sparsehash/internal/sparseconfig.h 18 | cmake_*.cmake 19 | !Find*.cmake 20 | *.build 21 | *.xcodeproj 22 | CMakeFiles 23 | CMakeCache.txt 24 | CMakeScripts 25 | install_manifest.txt 26 | 27 | # library files 28 | lib/boost/include/** 29 | lib/boost/lib/** 30 | lib/libuv/include/** 31 | lib/libuv/lib/** 32 | lib/libssh2/include/** 33 | lib/libssh2/lib/** 34 | lib/openssl/include/** 35 | lib/openssl/lib/** 36 | # Excluded library files from ignore 37 | !lib/boost/include/README 38 | !lib/boost/lib/README 39 | !lib/libuv/include/README 40 | !lib/libuv/lib/README 41 | !lib/libssh2/include/README 42 | !lib/libssh2/lib/README 43 | !lib/openssl/include/README 44 | !lib/openssl/lib/README 45 | 46 | # build files 47 | build 48 | Testing 49 | Debug 50 | demo/cassandra_demo 51 | test/unit_tests/cassandra_test 52 | src/driver_config.hpp 53 | 54 | # API docs files 55 | Doxyfile 56 | docs/_build 57 | docs/source/.doctrees 58 | docs/_source 59 | docs/source/api 60 | doxygen 61 | # editor 62 | *.swp 63 | *~ 64 | .#* 65 | #* 66 | .clang_complete 67 | 68 | # OSX 69 | .DS_Store 70 | 71 | # Eclipse 72 | .cproject 73 | .project 74 | 75 | # AStyle backup 76 | *.orig 77 | 78 | # QT Creator 79 | *.config 80 | *.creator* 81 | *.files 82 | *.includes 83 | 84 | # MSVC 85 | *.vcxproj 86 | *.vcxproj.filters 87 | *.sdf 88 | *.sln 89 | *.suo 90 | *.opensdf 91 | 92 | # Travis Build Dependencies 93 | libuv-v* 94 | lib/libuv/include/** 95 | !lib/libuv/include/README 96 | lib/libuv/lib/** 97 | !lib/libuv/lib/README 98 | boost_1_* 99 | 100 | # Integration test configuration 101 | config*.txt 102 | -------------------------------------------------------------------------------- /.nav: -------------------------------------------------------------------------------- 1 | topics 2 | dse_features 3 | changelog 4 | api 5 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scylladb/cpp-driver/5909fefba1a6aa28ba1bb22ad92de839b34bd028/Jenkinsfile -------------------------------------------------------------------------------- /README-dev.md: -------------------------------------------------------------------------------- 1 | # Building the docs 2 | 3 | ## Prerequisites 4 | 5 | To build the documentation of this project, you need a UNIX-based operating system. Windows is not fully supported as it does not support symlinks. 6 | 7 | You also need the following software installed `doxygen` to generate the reference documentation of the driver. You can install it using the following command: 8 | 9 | **Ubuntu** 10 | 11 | ```bash 12 | sudo apt-get install doxygen 13 | ``` 14 | 15 | **MacOS** 16 | 17 | ```bash 18 | brew install doxygen 19 | ``` 20 | 21 | Once you have installed the above software, you can build and preview the documentation by following the steps outlined in the [Quickstart guide](https://sphinx-theme.scylladb.com/stable/getting-started/quickstart.html). 22 | 23 | ## Custom commands 24 | 25 | To generate the reference documentation of the driver, run the command `make javadoc`. This command generates the reference documentation using the Javadoc tool in the `_build/dirhtml//api` directory. 26 | -------------------------------------------------------------------------------- /cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | 2 | cmake_policy(SET CMP0007 OLD) 3 | 4 | if (NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") 5 | message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"") 6 | endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") 7 | 8 | file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) 9 | string(REGEX REPLACE "\n" ";" files "${files}") 10 | list(REVERSE files) 11 | foreach (file ${files}) 12 | message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 13 | if (EXISTS "$ENV{DESTDIR}${file}") 14 | execute_process( 15 | COMMAND "@CMAKE_COMMAND@" -E remove "$ENV{DESTDIR}${file}" 16 | OUTPUT_VARIABLE rm_out 17 | RESULT_VARIABLE rm_retval 18 | ) 19 | if(NOT ${rm_retval} EQUAL 0) 20 | message("Problem when removing \"$ENV{DESTDIR}${file}\"") 21 | endif (NOT ${rm_retval} EQUAL 0) 22 | else (EXISTS "$ENV{DESTDIR}${file}") 23 | message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 24 | endif (EXISTS "$ENV{DESTDIR}${file}") 25 | endforeach(file) 26 | -------------------------------------------------------------------------------- /docs/_utils/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copy contents 4 | mkdir gh-pages 5 | cp -r ./docs/_build/dirhtml/. gh-pages 6 | 7 | # Create gh-pages branch 8 | cd gh-pages 9 | git init 10 | git config --local user.email "action@scylladb.com" 11 | git config --local user.name "GitHub Action" 12 | git remote add origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" 13 | git checkout -b gh-pages 14 | 15 | # Deploy 16 | git add . 17 | git commit -m "Publish docs" || true 18 | git push origin gh-pages --force 19 | -------------------------------------------------------------------------------- /docs/_utils/multiversion.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | cd .. && sphinx-multiversion docs/source docs/_build/dirhtml \ 4 | --pre-build 'doxygen Doxyfile.in' \ 5 | --pre-build "find . -mindepth 2 -name README.md -execdir mv '{}' index.md ';'" 6 | -------------------------------------------------------------------------------- /docs/_utils/redirects.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scylladb/cpp-driver/5909fefba1a6aa28ba1bb22ad92de839b34bd028/docs/_utils/redirects.yaml -------------------------------------------------------------------------------- /docs/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "cpp-driver" 3 | description = "Scylla C/C++ Driver" 4 | version = "0.1" 5 | authors = ["ScyllaDB Documentation Contributors"] 6 | package-mode = false 7 | 8 | [tool.poetry.dependencies] 9 | breathe="4.35.0" 10 | python = "^3.10" 11 | pygments = "^2.18.0" 12 | redirects_cli ="^0.1.3" 13 | sphinx-scylladb-theme = "^1.8.5" 14 | sphinx-sitemap = "^2.6.0" 15 | sphinx-autobuild = "^2024.4.19" 16 | Sphinx = "^7.3.7" 17 | sphinx-multiversion-scylla = "^0.3.1" 18 | sphinx-scylladb-markdown = "^0.1.2" 19 | [tool.poetry.dev-dependencies] 20 | pytest = "5.2" 21 | 22 | [build-system] 23 | requires = ["poetry>=1.8.0"] 24 | build-backend = "poetry.masonry.api" 25 | -------------------------------------------------------------------------------- /docs/source/api/index.rst: -------------------------------------------------------------------------------- 1 | API Documentation 2 | ================= 3 | 4 | Classes implementing the C/C++ Driver for ScyllaDB. 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | :glob: 9 | 10 | * -------------------------------------------------------------------------------- /docs/source/contents.rst: -------------------------------------------------------------------------------- 1 | Contents 2 | ======== 3 | 4 | .. toctree:: 5 | :hidden: 6 | :glob: 7 | :titlesonly: 8 | 9 | index 10 | api/index 11 | topics/* 12 | topics/dse_features/* -------------------------------------------------------------------------------- /docs/source/topics: -------------------------------------------------------------------------------- 1 | ../../topics/ -------------------------------------------------------------------------------- /driver_config.hpp.in: -------------------------------------------------------------------------------- 1 | #ifndef DATASTAX_INTERNAL_DRIVER_CONFIG_HPP 2 | #define DATASTAX_INTERNAL_DRIVER_CONFIG_HPP 3 | 4 | #cmakedefine HAVE_KERBEROS 5 | #cmakedefine HAVE_OPENSSL 6 | #cmakedefine HAVE_STD_ATOMIC 7 | #cmakedefine CASS_CPP_STANDARD @CASS_CPP_STANDARD@ 8 | #cmakedefine HAVE_BOOST_ATOMIC 9 | #cmakedefine HAVE_NOSIGPIPE 10 | #cmakedefine HAVE_SIGTIMEDWAIT 11 | #cmakedefine HASH_IN_TR1 12 | #cmakedefine HAVE_BUILTIN_BSWAP32 13 | #cmakedefine HAVE_BUILTIN_BSWAP64 14 | #cmakedefine HAVE_ARC4RANDOM 15 | #cmakedefine HAVE_GETRANDOM 16 | #cmakedefine HAVE_TIMERFD 17 | #cmakedefine HAVE_ZLIB 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(INCLUDES ${CASS_INCLUDE_DIR}) 2 | 3 | file(GLOB_RECURSE EXAMPLES_TO_BUILD "*/CMakeLists.txt") 4 | 5 | #------------------------------ 6 | # Compiler flags 7 | #------------------------------ 8 | 9 | if(CASS_USE_STATIC_LIBS) 10 | add_definitions(-DCASS_STATIC) 11 | endif() 12 | 13 | #------------------------ 14 | # Subdirectories 15 | #------------------------ 16 | 17 | list(APPEND INCLUDES ${CASS_INCLUDES}) 18 | 19 | foreach(example ${EXAMPLES_TO_BUILD}) 20 | get_filename_component(exdir ${example} PATH) 21 | add_subdirectory(${exdir}) 22 | endforeach() 23 | -------------------------------------------------------------------------------- /examples/async/.gitignore: -------------------------------------------------------------------------------- 1 | async 2 | -------------------------------------------------------------------------------- /examples/async/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME async) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/auth/.gitignore: -------------------------------------------------------------------------------- 1 | auth 2 | -------------------------------------------------------------------------------- /examples/auth/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME auth) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/basic/.gitignore: -------------------------------------------------------------------------------- 1 | basic 2 | -------------------------------------------------------------------------------- /examples/basic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME basic) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/batch/.gitignore: -------------------------------------------------------------------------------- 1 | batch 2 | -------------------------------------------------------------------------------- /examples/batch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME batch) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/bind_by_name/.gitignore: -------------------------------------------------------------------------------- 1 | bind_by_name 2 | -------------------------------------------------------------------------------- /examples/bind_by_name/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME bind_by_name) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/callbacks/.gitignore: -------------------------------------------------------------------------------- 1 | callbacks 2 | -------------------------------------------------------------------------------- /examples/callbacks/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME callbacks) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/cloud/.gitignore: -------------------------------------------------------------------------------- 1 | cloud 2 | -------------------------------------------------------------------------------- /examples/cloud/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME cloud) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/collections/.gitignore: -------------------------------------------------------------------------------- 1 | collections 2 | -------------------------------------------------------------------------------- /examples/collections/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME collections) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/concurrent_executions/.gitignore: -------------------------------------------------------------------------------- 1 | concurrent_executions 2 | -------------------------------------------------------------------------------- /examples/concurrent_executions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME concurrent_executions) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/date_time/.gitignore: -------------------------------------------------------------------------------- 1 | date_time 2 | -------------------------------------------------------------------------------- /examples/date_time/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME date_time) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/dse/date_range/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME date_range) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${DSE_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/dse/geotypes/.gitignore: -------------------------------------------------------------------------------- 1 | geotypes 2 | -------------------------------------------------------------------------------- /examples/dse/geotypes/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME geotypes) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${DSE_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/dse/gssapi/.gitignore: -------------------------------------------------------------------------------- 1 | gssapi 2 | -------------------------------------------------------------------------------- /examples/dse/gssapi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | 5 | # Set up rules/commands for building gssapi example 6 | set(PROJECT_EXAMPLE_NAME gssapi) 7 | set(EXAMPLE_SRC_FILES gssapi.c) 8 | include_directories(${INCLUDES}) 9 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 10 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${DSE_LIBS}) 11 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 12 | 13 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 14 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 15 | 16 | # Set up rules/commands for building gssapi_proxy example 17 | set(PROJECT_EXAMPLE_NAME gssapi_proxy) 18 | set(EXAMPLE_SRC_FILES gssapi_proxy.c) 19 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 20 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${DSE_LIBS}) 21 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 22 | 23 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 24 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 25 | -------------------------------------------------------------------------------- /examples/dse/plaintext/.gitignore: -------------------------------------------------------------------------------- 1 | plaintext 2 | -------------------------------------------------------------------------------- /examples/dse/plaintext/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | 5 | # Set up rules/commands for building plaintext example 6 | set(PROJECT_EXAMPLE_NAME plaintext) 7 | set(EXAMPLE_SRC_FILES plaintext.c) 8 | include_directories(${INCLUDES}) 9 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 10 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${DSE_LIBS}) 11 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 12 | 13 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 14 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 15 | 16 | # Set up rules/commands for building plaintext_proxy example 17 | set(PROJECT_EXAMPLE_NAME plaintext_proxy) 18 | set(EXAMPLE_SRC_FILES plaintext_proxy.c) 19 | include_directories(${INCLUDES}) 20 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 21 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${DSE_LIBS}) 22 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 23 | 24 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 25 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 26 | -------------------------------------------------------------------------------- /examples/dse/proxy_execution/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME proxy_execution) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${DSE_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/duration/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME duration) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/execution_profiles/.gitignore: -------------------------------------------------------------------------------- 1 | execution_profiles 2 | -------------------------------------------------------------------------------- /examples/execution_profiles/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME execution_profiles) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/host_listener/.gitignore: -------------------------------------------------------------------------------- 1 | host_listener 2 | -------------------------------------------------------------------------------- /examples/host_listener/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME host_listener) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/logging/.gitignore: -------------------------------------------------------------------------------- 1 | logging 2 | -------------------------------------------------------------------------------- /examples/logging/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME logging) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/maps/.gitignore: -------------------------------------------------------------------------------- 1 | maps 2 | -------------------------------------------------------------------------------- /examples/maps/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME maps) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/named_parameters/.gitignore: -------------------------------------------------------------------------------- 1 | named_parameters 2 | -------------------------------------------------------------------------------- /examples/named_parameters/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME named_parameters) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/paging/.gitignore: -------------------------------------------------------------------------------- 1 | paging 2 | -------------------------------------------------------------------------------- /examples/paging/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME paging) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/perf/.gitignore: -------------------------------------------------------------------------------- 1 | perf 2 | -------------------------------------------------------------------------------- /examples/perf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME perf) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/prepared/.gitignore: -------------------------------------------------------------------------------- 1 | prepared 2 | -------------------------------------------------------------------------------- /examples/prepared/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME prepared) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/schema_meta/.gitignore: -------------------------------------------------------------------------------- 1 | schema_meta 2 | -------------------------------------------------------------------------------- /examples/schema_meta/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME schema_meta) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/simple/.gitignore: -------------------------------------------------------------------------------- 1 | simple 2 | -------------------------------------------------------------------------------- /examples/simple/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME simple) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/ssl/.gitignore: -------------------------------------------------------------------------------- 1 | ssl 2 | -------------------------------------------------------------------------------- /examples/ssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME ssl) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/tracing/.gitignore: -------------------------------------------------------------------------------- 1 | tracing 2 | -------------------------------------------------------------------------------- /examples/tracing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME tracing) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/tuple/.gitignore: -------------------------------------------------------------------------------- 1 | tuple 2 | -------------------------------------------------------------------------------- /examples/tuple/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME tuple) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/udt/.gitignore: -------------------------------------------------------------------------------- 1 | udt 2 | -------------------------------------------------------------------------------- /examples/udt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME udt) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /examples/uuids/.gitignore: -------------------------------------------------------------------------------- 1 | uuids 2 | -------------------------------------------------------------------------------- /examples/uuids/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6.4) 2 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") 4 | set(PROJECT_EXAMPLE_NAME uuids) 5 | 6 | file(GLOB EXAMPLE_SRC_FILES *.c) 7 | include_directories(${INCLUDES}) 8 | add_executable(${PROJECT_EXAMPLE_NAME} ${EXAMPLE_SRC_FILES}) 9 | target_link_libraries(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET} ${CASS_LIBS}) 10 | add_dependencies(${PROJECT_EXAMPLE_NAME} ${PROJECT_LIB_NAME_TARGET}) 11 | 12 | set_target_properties(${PROJECT_EXAMPLE_NAME} PROPERTIES FOLDER "Examples" 13 | COMPILE_FLAGS "${EXAMPLE_CMAKE_C_FLAGS}") 14 | -------------------------------------------------------------------------------- /licenses/boost-1.0.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /packaging/README.md: -------------------------------------------------------------------------------- 1 | ## On a clean CentOS 7 2 | 3 | Set up the EPEL, install the toolchain and `libuv`: 4 | ``` 5 | wget https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-13.noarch.rpm 6 | sudo rpm -Uvh epel-release*rpm 7 | sudo yum install -y libuv-devel openssl-devel cmake3 make g++ git 8 | ``` 9 | 10 | Now clone the source code, checkout particular revision if needed: 11 | ``` 12 | git clone https://github.com/scylladb/cpp-driver.git 13 | cd cpp-driver/ 14 | ``` 15 | 16 | Packaging: 17 | ``` 18 | cat licenses/* > LICENSE.txt 19 | cd packaging/ 20 | ./build_rpm.sh 21 | ``` 22 | 23 | ## On a clean Ubuntu 18 24 | 25 | ``` 26 | sudo apt-get update 27 | sudo apt-get install -y libuv1-dev openssl cmake make g++ git devscripts debhelper dh-exec libssl-dev zlib1g-dev 28 | git clone https://github.com/scylladb/cpp-driver.git 29 | cd cpp-driver/packaging 30 | ./build_deb.sh 31 | ``` 32 | -------------------------------------------------------------------------------- /packaging/debian/changelog: -------------------------------------------------------------------------------- 1 | scylla-cpp-driver (1.0.0-1) stable; urgency=low 2 | 3 | * Initial release 4 | 5 | -- Michael Penick Tue, 20 Jan 2015 20:20:27 -0700 6 | -------------------------------------------------------------------------------- /packaging/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /packaging/debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://dep.debian.net/deps/dep5 2 | Upstream-Name: scylla-cpp-driver 3 | Source: https://github.com/scylladb/cpp-driver 4 | 5 | Files: * 6 | Copyright: Copyright (c) DataStax, Inc. 7 | License: Apache-2.0 8 | On Debian systems, the complete text of the Apache License Version 2.0 9 | can be found in `/usr/share/common-licenses/Apache-2.0'. 10 | 11 | Files: src/third_party/hdr_histogram/* 12 | Copyright: Copyright (c) 2012, 2013, 2014 Gil Tene 13 | Copyright (c) 2014 Michael Barker 14 | Copyright (c) 2014 Matt Warren 15 | License: BSD-2-clause 16 | 17 | Files: src/third_party/mt19937_64/* 18 | Copyright: Copyright (C) 2004, Makoto Matsumoto and Takuji Nishimura 19 | License: BSD-3-clause 20 | 21 | Files: src/third_party/rapidjson/* 22 | Copyright: Copyright (C) 2011 Milo Yip 23 | License: MIT 24 | 25 | Files: src/third_party/curl/* 26 | Copyright: Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. 27 | License: MIT 28 | 29 | Files: src/optional/optional_akrzemi.hpp 30 | Copyright: Copyright (C) 2011 - 2012 Andrzej Krzemienski 31 | License: Boost Software License 1.0 32 | -------------------------------------------------------------------------------- /packaging/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | 4 | include /usr/share/dpkg/default.mk 5 | 6 | # Uncomment this to turn on verbose mode. 7 | #export DH_VERBOSE=1 8 | 9 | NUMJOBS=1 10 | ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) 11 | NUMJOBS=$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) 12 | endif 13 | 14 | export SOVER ?= $(shell dpkg-parsechangelog \ 15 | | sed -rne 's/^Version: ([0-9.]+)([-+~][[:alpha:]][[:alnum:]]*)?([-+~][[:digit:]])?$$/\1\2/p' \ 16 | | sed 's/[+~]/-/') 17 | export SONAME=libscylla-cpp-driver.so.$(SOVER) 18 | 19 | %: 20 | dh $@ 21 | 22 | override_dh_auto_install: 23 | dh_auto_install 24 | 25 | override_dh_auto_configure: 26 | dh_auto_configure -- -DCMAKE_BUILD_TYPE=RELEASE -DCASS_BUILD_STATIC=ON -DCASS_INSTALL_PKG_CONFIG=OFF -DCMAKE_INSTALL_LIBDIR=/usr/lib 27 | 28 | override_dh_auto_build: 29 | dh_auto_build -- -j$(NUMJOBS) 30 | 31 | override_dh_strip: 32 | dh_strip --dbg-package=scylla-cpp-driver-dbg 33 | sed -i s/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/ debian/scylla-cpp-driver-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/*.pc 34 | sed -i s/@DEB_VERSION_UPSTREAM@/$(DEB_VERSION_UPSTREAM)/ debian/scylla-cpp-driver-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/*.pc 35 | 36 | override_dh_makeshlibs: 37 | dh_makeshlibs -V 38 | 39 | override_dh_auto_test: 40 | override_dh_auto_clean: 41 | -------------------------------------------------------------------------------- /packaging/debian/scylla-cpp-driver-dev.install: -------------------------------------------------------------------------------- 1 | #! /usr/bin/dh-exec 2 | 3 | usr/include/*.h 4 | usr/lib/*.a usr/lib/${DEB_HOST_MULTIARCH} 5 | debian/scylla-cpp-driver.pc usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig 6 | debian/scylla-cpp-driver_static.pc usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig 7 | -------------------------------------------------------------------------------- /packaging/debian/scylla-cpp-driver.install: -------------------------------------------------------------------------------- 1 | #! /usr/bin/dh-exec 2 | 3 | usr/lib/lib*.so.* usr/lib/${DEB_HOST_MULTIARCH} 4 | -------------------------------------------------------------------------------- /packaging/debian/scylla-cpp-driver.links: -------------------------------------------------------------------------------- 1 | #!/usr/bin/dh-exec 2 | 3 | usr/lib/${DEB_HOST_MULTIARCH}/${SONAME} usr/lib/${DEB_HOST_MULTIARCH}/libscylla-cpp-driver.so 4 | usr/lib/${DEB_HOST_MULTIARCH}/libscylla-cpp-driver.so usr/lib/${DEB_HOST_MULTIARCH}/libcassandra.so 5 | -------------------------------------------------------------------------------- /packaging/debian/scylla-cpp-driver.pc: -------------------------------------------------------------------------------- 1 | prefix=/usr 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/lib/@DEB_HOST_MULTIARCH@ 4 | includedir=${prefix}/include 5 | 6 | Name: scylla-cpp-driver 7 | Description: A C/C++ client driver for Scylla, Apache Cassandra and DataStax Products 8 | Version: @DEB_VERSION_UPSTREAM@ 9 | Libs: -L${libdir} -lscylla-cpp-driver 10 | Cflags: 11 | URL: https://github.com/scylladb/cpp-driver/ 12 | -------------------------------------------------------------------------------- /packaging/debian/scylla-cpp-driver_static.pc: -------------------------------------------------------------------------------- 1 | prefix=/usr 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/lib/@DEB_HOST_MULTIARCH@ 4 | includedir=${prefix}/include 5 | 6 | Name: scylla-cpp-driver_static 7 | Description: A C/C++ client driver for Scylla, Apache Cassandra and DataStax Products 8 | Version: @DEB_VERSION_UPSTREAM@ 9 | Requires: libuv 10 | Requires: openssl 11 | Libs: -L${libdir} -lscylla-cpp-driver_static -lstdc++ 12 | Cflags: 13 | URL: https://github.com/scylladb/cpp-driver/ 14 | -------------------------------------------------------------------------------- /packaging/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /packaging/homebrew/cassandra-cpp-driver.rb: -------------------------------------------------------------------------------- 1 | require "formula" 2 | 3 | class CassandraCppDriver < Formula 4 | homepage "http://datastax.github.io/cpp-driver/" 5 | url "https://github.com/datastax/cpp-driver/archive/2.7.0.tar.gz" 6 | sha256 "44a97679e719b2b046ef90323beab4fe3a491ae79396e7f28e6a9677b618a0e4" 7 | version "2.7.0" 8 | 9 | head "git://github.com:datastax/cpp-driver.git", :branch => "master" 10 | 11 | depends_on "cmake" => :build 12 | depends_on "libuv" 13 | depends_on "openssl" 14 | 15 | def install 16 | mkdir 'build' do 17 | system "cmake", "-DCMAKE_BUILD_TYPE=RELEASE", "-DCASS_BUILD_STATIC=ON", "-DCASS_INSTALL_PKG_CONFIG=OFF", "-DCMAKE_INSTALL_PREFIX:PATH=#{prefix}", "-DCMAKE_INSTALL_LIBDIR=#{lib}", ".." 18 | system "make", "install" 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /packaging/scylla-cpp-driver.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: scylla-cpp-driver 7 | Description: A C/C++ client driver for Scylla, Apache Cassandra and DataStax Products 8 | Version: @version@ 9 | Libs: -L${libdir} -lscylla-cpp-driver 10 | Cflags: -I${includedir} 11 | URL: https://github.com/scylladb/cpp-driver/ 12 | -------------------------------------------------------------------------------- /packaging/scylla-cpp-driver_static.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: scylla-cpp-driver 7 | Description: A C/C++ client driver for Scylla, Apache Cassandra and DataStax Products 8 | Version: @version@ 9 | Requires: libuv 10 | Requires: openssl 11 | Libs: -L${libdir} -lscylla-cpp-driver_static -lstdc++ 12 | Cflags: -I${includedir} 13 | URL: https://github.com/scylladb/cpp-driver/ 14 | -------------------------------------------------------------------------------- /src/allocated.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "allocated.hpp" 18 | #include "memory.hpp" 19 | #include 20 | 21 | using namespace datastax::internal; 22 | 23 | void* Allocated::operator new(size_t size) { return Memory::malloc(size); } 24 | 25 | void* Allocated::operator new[](size_t size) { return Memory::malloc(size); } 26 | 27 | void Allocated::operator delete(void* ptr) { Memory::free(ptr); } 28 | 29 | void Allocated::operator delete[](void* ptr) { Memory::free(ptr); } 30 | -------------------------------------------------------------------------------- /src/allocated.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_ALLOCATED_HPP 18 | #define DATASTAX_INTERNAL_ALLOCATED_HPP 19 | 20 | #include 21 | 22 | namespace datastax { namespace internal { 23 | 24 | class Allocated { 25 | public: 26 | void* operator new(size_t size); 27 | void* operator new[](size_t size); 28 | void operator delete(void* ptr); 29 | void operator delete[](void* ptr); 30 | 31 | void* operator new(size_t, void* p) { return p; } 32 | void* operator new[](size_t, void* p) { return p; } 33 | void operator delete(void* ptr, void* p) {} 34 | void operator delete[](void* ptr, void* p) {} 35 | }; 36 | 37 | template 38 | struct AllocatedT 39 | : public Allocated 40 | , public T {}; 41 | 42 | }} // namespace datastax::internal 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/async.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "async.hpp" 18 | 19 | using namespace datastax::internal::core; 20 | 21 | Async::Async() 22 | : handle_(NULL) {} 23 | 24 | Async::~Async() { close_handle(); } 25 | 26 | int Async::start(uv_loop_t* loop, const Async::Callback& callback) { 27 | if (handle_ == NULL) { 28 | handle_ = new AllocatedT(); 29 | handle_->data = this; 30 | int rc = uv_async_init(loop, handle_, on_async); 31 | if (rc != 0) return rc; 32 | } 33 | callback_ = callback; 34 | return 0; 35 | } 36 | 37 | void Async::send() { 38 | if (handle_ == NULL) return; 39 | uv_async_send(handle_); 40 | } 41 | 42 | void Async::close_handle() { 43 | if (handle_ == NULL) return; 44 | uv_close(reinterpret_cast(handle_), on_close); 45 | handle_ = NULL; 46 | } 47 | 48 | bool Async::is_running() const { 49 | if (handle_ == NULL) return false; 50 | return uv_is_active(reinterpret_cast(handle_)) != 0; 51 | } 52 | 53 | void Async::on_async(uv_async_t* handle) { 54 | Async* async = static_cast(handle->data); 55 | async->callback_(async); 56 | } 57 | 58 | void Async::on_close(uv_handle_t* handle) { 59 | delete reinterpret_cast*>(handle); 60 | } 61 | -------------------------------------------------------------------------------- /src/atomic.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_ATOMIC_HPP 18 | #define DATASTAX_INTERNAL_ATOMIC_HPP 19 | 20 | #include "driver_config.hpp" 21 | 22 | #if !defined(THREAD_SANITIZER) 23 | #if defined(__has_feature) 24 | #if __has_feature(thread_sanitizer) 25 | #define THREAD_SANITIZER 1 26 | #endif 27 | #elif defined(__SANITIZE_THREAD__) 28 | #define THREAD_SANITIZER 1 29 | #endif 30 | #endif 31 | 32 | // Annotations for atomic_thread_fence, see https://github.com/google/sanitizers/issues/1352 33 | #ifdef THREAD_SANITIZER 34 | extern "C" { 35 | void __tsan_acquire(void* addr); 36 | void __tsan_release(void* addr); 37 | } 38 | #endif 39 | 40 | #if defined(HAVE_BOOST_ATOMIC) 41 | #include "atomic/atomic_boost.hpp" 42 | #elif defined(HAVE_STD_ATOMIC) 43 | #include "atomic/atomic_std.hpp" 44 | #else 45 | #include "atomic/atomic_intrinsics.hpp" 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/auth_requests.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "auth_requests.hpp" 18 | 19 | using namespace datastax::internal::core; 20 | 21 | int AuthResponseRequest::encode(ProtocolVersion version, RequestCallback* callback, 22 | BufferVec* bufs) const { 23 | // [bytes] 24 | size_t length = sizeof(int32_t) + token_.size(); 25 | 26 | Buffer buf(length); 27 | buf.encode_long_string(0, token_.data(), token_.size()); 28 | bufs->push_back(buf); 29 | 30 | return length; 31 | } 32 | -------------------------------------------------------------------------------- /src/auth_requests.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_AUTH_REQUESTS_HPP 18 | #define DATASTAX_INTERNAL_AUTH_REQUESTS_HPP 19 | 20 | #include "auth.hpp" 21 | #include "constants.hpp" 22 | #include "ref_counted.hpp" 23 | #include "request.hpp" 24 | 25 | namespace datastax { namespace internal { namespace core { 26 | 27 | class AuthResponseRequest : public Request { 28 | public: 29 | AuthResponseRequest(const String& token, const Authenticator::Ptr& auth) 30 | : Request(CQL_OPCODE_AUTH_RESPONSE) 31 | , token_(token) 32 | , auth_(auth) {} 33 | 34 | const Authenticator::Ptr& auth() const { return auth_; } 35 | 36 | private: 37 | int encode(ProtocolVersion version, RequestCallback* callback, BufferVec* bufs) const; 38 | 39 | private: 40 | String token_; 41 | Authenticator::Ptr auth_; 42 | }; 43 | 44 | }}} // namespace datastax::internal::core 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/auth_responses.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "auth_responses.hpp" 18 | 19 | #include "serialization.hpp" 20 | 21 | using namespace datastax::internal::core; 22 | 23 | bool AuthenticateResponse::decode(Decoder& decoder) { 24 | decoder.set_type("authentication"); 25 | StringRef class_name; 26 | 27 | CHECK_RESULT(decoder.decode_string(&class_name)); 28 | class_name_ = class_name.to_string(); 29 | decoder.maybe_log_remaining(); 30 | return true; 31 | } 32 | 33 | bool AuthChallengeResponse::decode(Decoder& decoder) { 34 | decoder.set_type("authentication challenge"); 35 | StringRef token; 36 | 37 | CHECK_RESULT(decoder.decode_bytes(&token)); 38 | token_ = token.to_string(); 39 | decoder.maybe_log_remaining(); 40 | return true; 41 | } 42 | 43 | bool AuthSuccessResponse::decode(Decoder& decoder) { 44 | decoder.set_type("authentication success"); 45 | StringRef token; 46 | 47 | CHECK_RESULT(decoder.decode_bytes(&token)); 48 | token_ = token.to_string(); 49 | decoder.maybe_log_remaining(); 50 | return true; 51 | } 52 | -------------------------------------------------------------------------------- /src/auth_responses.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_AUTH_RESPONSES_HPP 18 | #define DATASTAX_INTERNAL_AUTH_RESPONSES_HPP 19 | 20 | #include "constants.hpp" 21 | #include "response.hpp" 22 | #include "string.hpp" 23 | #include "string_ref.hpp" 24 | 25 | namespace datastax { namespace internal { namespace core { 26 | 27 | class AuthenticateResponse : public Response { 28 | public: 29 | AuthenticateResponse() 30 | : Response(CQL_OPCODE_AUTHENTICATE) {} 31 | 32 | const String& class_name() const { return class_name_; } 33 | 34 | virtual bool decode(Decoder& decoder); 35 | 36 | private: 37 | String class_name_; 38 | }; 39 | 40 | class AuthChallengeResponse : public Response { 41 | public: 42 | AuthChallengeResponse() 43 | : Response(CQL_OPCODE_AUTH_CHALLENGE) {} 44 | 45 | const String& token() const { return token_; } 46 | 47 | virtual bool decode(Decoder& decoder); 48 | 49 | private: 50 | String token_; 51 | }; 52 | 53 | class AuthSuccessResponse : public Response { 54 | public: 55 | AuthSuccessResponse() 56 | : Response(CQL_OPCODE_AUTH_SUCCESS) {} 57 | 58 | const String& token() const { return token_; } 59 | 60 | virtual bool decode(Decoder& decoder); 61 | 62 | private: 63 | String token_; 64 | }; 65 | 66 | }}} // namespace datastax::internal::core 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/blacklist_dc_policy.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "blacklist_dc_policy.hpp" 18 | 19 | using namespace datastax::internal::core; 20 | 21 | bool BlacklistDCPolicy::is_valid_host(const Host::Ptr& host) const { 22 | const String& host_dc = host->dc(); 23 | for (DcList::const_iterator it = dcs_.begin(), end = dcs_.end(); it != end; ++it) { 24 | if (host_dc.compare(*it) == 0) { 25 | return false; 26 | } 27 | } 28 | return true; 29 | } 30 | -------------------------------------------------------------------------------- /src/blacklist_dc_policy.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_BLACKLIST_DC_POLICY_HPP 18 | #define DATASTAX_INTERNAL_BLACKLIST_DC_POLICY_HPP 19 | 20 | #include "host.hpp" 21 | #include "list_policy.hpp" 22 | #include "load_balancing.hpp" 23 | #include "scoped_ptr.hpp" 24 | 25 | namespace datastax { namespace internal { namespace core { 26 | 27 | class BlacklistDCPolicy : public ListPolicy { 28 | public: 29 | BlacklistDCPolicy(LoadBalancingPolicy* child_policy, const DcList& dcs) 30 | : ListPolicy(child_policy) 31 | , dcs_(dcs) {} 32 | 33 | virtual ~BlacklistDCPolicy() {} 34 | 35 | BlacklistDCPolicy* new_instance() { 36 | return new BlacklistDCPolicy(child_policy_->new_instance(), dcs_); 37 | } 38 | 39 | private: 40 | bool is_valid_host(const Host::Ptr& host) const; 41 | 42 | DcList dcs_; 43 | 44 | private: 45 | DISALLOW_COPY_AND_ASSIGN(BlacklistDCPolicy); 46 | }; 47 | 48 | }}} // namespace datastax::internal::core 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/blacklist_policy.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "blacklist_policy.hpp" 18 | 19 | using namespace datastax::internal::core; 20 | 21 | bool BlacklistPolicy::is_valid_host(const Host::Ptr& host) const { 22 | const String& host_address = host->address().hostname_or_address(); 23 | for (ContactPointList::const_iterator it = hosts_.begin(), end = hosts_.end(); it != end; ++it) { 24 | if (host_address.compare(*it) == 0) { 25 | return false; 26 | } 27 | } 28 | return true; 29 | } 30 | -------------------------------------------------------------------------------- /src/blacklist_policy.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_BLACKLIST_POLICY_HPP 18 | #define DATASTAX_INTERNAL_BLACKLIST_POLICY_HPP 19 | 20 | #include "host.hpp" 21 | #include "list_policy.hpp" 22 | #include "load_balancing.hpp" 23 | #include "scoped_ptr.hpp" 24 | 25 | namespace datastax { namespace internal { namespace core { 26 | 27 | class BlacklistPolicy : public ListPolicy { 28 | public: 29 | BlacklistPolicy(LoadBalancingPolicy* child_policy, const ContactPointList& hosts) 30 | : ListPolicy(child_policy) 31 | , hosts_(hosts) {} 32 | 33 | virtual ~BlacklistPolicy() {} 34 | 35 | BlacklistPolicy* new_instance() { 36 | return new BlacklistPolicy(child_policy_->new_instance(), hosts_); 37 | } 38 | 39 | private: 40 | bool is_valid_host(const Host::Ptr& host) const; 41 | 42 | ContactPointList hosts_; 43 | 44 | private: 45 | DISALLOW_COPY_AND_ASSIGN(BlacklistPolicy); 46 | }; 47 | 48 | }}} // namespace datastax::internal::core 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/cloud_secure_connection_config.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_CLOUD_SECURE_CONNECTION_CONFIG_HPP 18 | #define DATASTAX_INTERNAL_CLOUD_SECURE_CONNECTION_CONFIG_HPP 19 | 20 | #include "string.hpp" 21 | 22 | namespace datastax { namespace internal { namespace core { 23 | 24 | class Config; 25 | 26 | class CloudSecureConnectionConfig { 27 | public: 28 | CloudSecureConnectionConfig(); 29 | 30 | bool load(const String& filename, Config* config = NULL); 31 | bool is_loaded() const { return is_loaded_; } 32 | 33 | const String& username() const { return username_; } 34 | const String& password() const { return password_; } 35 | const String& host() const { return host_; } 36 | int port() const { return port_; } 37 | 38 | const String& ca_cert() const { return ca_cert_; } 39 | const String& cert() const { return cert_; } 40 | const String& key() const { return key_; } 41 | 42 | private: 43 | bool is_loaded_; 44 | String username_; 45 | String password_; 46 | String host_; 47 | int port_; 48 | String ca_cert_; 49 | String cert_; 50 | String key_; 51 | }; 52 | 53 | }}} // namespace datastax::internal::core 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/cluster_config.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_CLUSTER_CONFIG_HPP 18 | #define DATASTAX_INTERNAL_CLUSTER_CONFIG_HPP 19 | 20 | #include "allocated.hpp" 21 | #include "config.hpp" 22 | #include "external.hpp" 23 | 24 | namespace datastax { namespace internal { namespace core { 25 | 26 | class ClusterConfig : public Allocated { 27 | public: 28 | const Config& config() const { return config_; } 29 | Config& config() { return config_; } 30 | 31 | private: 32 | Config config_; 33 | }; 34 | 35 | }}} // namespace datastax::internal::core 36 | 37 | EXTERNAL_TYPE(datastax::internal::core::ClusterConfig, CassCluster) 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/collection_iterator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "collection_iterator.hpp" 18 | 19 | using namespace datastax::internal::core; 20 | 21 | bool CollectionIterator::next() { 22 | if (index_ + 1 >= count_) { 23 | return false; 24 | } 25 | ++index_; 26 | return decode_value(); 27 | } 28 | 29 | bool CollectionIterator::decode_value() { 30 | if (collection_->value_type() == CASS_VALUE_TYPE_MAP) { 31 | const DataType::ConstPtr& data_type = 32 | (index_ % 2 == 0) ? collection_->primary_data_type() : collection_->secondary_data_type(); 33 | value_ = decoder_.decode_value(data_type); 34 | } else { 35 | value_ = decoder_.decode_value(collection_->primary_data_type()); 36 | } 37 | 38 | return value_.is_valid(); 39 | } 40 | 41 | bool TupleIterator::next() { 42 | if (next_ == end_) { 43 | return false; 44 | } 45 | current_ = next_++; 46 | 47 | value_ = decoder_.decode_value(*current_); 48 | return value_.is_valid(); 49 | } 50 | -------------------------------------------------------------------------------- /src/config.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "config.hpp" 18 | 19 | using namespace datastax::internal::core; 20 | 21 | void Config::init_profiles() { 22 | // Initialize the profile settings (if needed) 23 | for (ExecutionProfile::Map::iterator it = profiles_.begin(); it != profiles_.end(); ++it) { 24 | if (it->second.serial_consistency() == CASS_CONSISTENCY_UNKNOWN) { 25 | it->second.set_serial_consistency(default_profile_.serial_consistency()); 26 | } 27 | 28 | if (it->second.request_timeout_ms() == CASS_UINT64_MAX) { 29 | it->second.set_request_timeout(default_profile_.request_timeout_ms()); 30 | } 31 | 32 | if (!it->second.retry_policy()) { 33 | it->second.set_retry_policy(default_profile_.retry_policy().get()); 34 | } 35 | 36 | if (!it->second.speculative_execution_policy()) { 37 | it->second.set_speculative_execution_policy( 38 | default_profile_.speculative_execution_policy()->new_instance()); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/deque.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_DEQUE_HPP 18 | #define DATASTAX_INTERNAL_DEQUE_HPP 19 | 20 | #include "allocator.hpp" 21 | 22 | #include 23 | 24 | namespace datastax { namespace internal { 25 | 26 | template 27 | class Deque : public std::deque > { 28 | public: 29 | typedef internal::Allocator Allocator; 30 | 31 | explicit Deque(const Allocator& alloc = Allocator()) 32 | : std::deque(alloc) {} 33 | 34 | explicit Deque(size_t count, const T& value = T(), const Allocator& alloc = Allocator()) 35 | : std::deque(count, value, alloc) {} 36 | 37 | template 38 | Deque(InputIt first, InputIt last, const Allocator& alloc = Allocator()) 39 | : std::deque(first, last, alloc) {} 40 | }; 41 | 42 | }} // namespace datastax::internal 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/driver_info.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "driver_info.hpp" 18 | 19 | #include "cassandra.h" 20 | #include "macros.hpp" 21 | 22 | #include 23 | 24 | #define DRIVER_VERSION \ 25 | STRINGIFY(CASS_VERSION_MAJOR) "." STRINGIFY(CASS_VERSION_MINOR) "." STRINGIFY(CASS_VERSION_PATCH) 26 | 27 | namespace datastax { namespace internal { 28 | 29 | const char* driver_name() { 30 | return "Scylla Shard-Aware C/C++ Driver"; 31 | } 32 | 33 | const char* driver_version() { 34 | if (strlen(CASS_VERSION_SUFFIX) == 0) { 35 | return DRIVER_VERSION; 36 | } else { 37 | return DRIVER_VERSION "-" CASS_VERSION_SUFFIX; 38 | } 39 | } 40 | 41 | }} // namespace datastax::internal 42 | -------------------------------------------------------------------------------- /src/driver_info.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_DRIVER_INFO_HPP 18 | #define DATASTAX_INTERNAL_DRIVER_INFO_HPP 19 | 20 | namespace datastax { namespace internal { 21 | 22 | const char* driver_name(); 23 | const char* driver_version(); 24 | 25 | }} // namespace datastax::internal 26 | 27 | #endif // DATASTAX_INTERNAL_DRIVER_INFO_HPP 28 | -------------------------------------------------------------------------------- /src/dse_batch_request.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "batch_request.hpp" 18 | 19 | #include 20 | 21 | extern "C" { 22 | 23 | CassError cass_batch_set_execute_as_n(CassBatch* batch, const char* name, size_t name_length) { 24 | batch->set_custom_payload("ProxyExecute", reinterpret_cast(name), name_length); 25 | return CASS_OK; 26 | } 27 | 28 | CassError cass_batch_set_execute_as(CassBatch* batch, const char* name) { 29 | return cass_batch_set_execute_as_n(batch, name, SAFE_STRLEN(name)); 30 | } 31 | 32 | } // extern "C" 33 | -------------------------------------------------------------------------------- /src/dse_date_range.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_ENTERPRISE_INTERNAL_DATE_RANGE_HPP 18 | #define DATASTAX_ENTERPRISE_INTERNAL_DATE_RANGE_HPP 19 | 20 | #include "dse_serialization.hpp" 21 | 22 | namespace datastax { namespace internal { namespace enterprise { 23 | 24 | Bytes encode_date_range(const DseDateRange* range); 25 | 26 | }}} // namespace datastax::internal::enterprise 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/dse_point.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "dse.h" 18 | #include "wkt.hpp" 19 | 20 | #include 21 | 22 | #include "macros.hpp" 23 | 24 | extern "C" { 25 | 26 | CassError dse_point_from_wkt(const char* wkt, cass_double_t* x, cass_double_t* y) { 27 | return dse_point_from_wkt_n(wkt, SAFE_STRLEN(wkt), x, y); 28 | } 29 | 30 | CassError dse_point_from_wkt_n(const char* wkt, size_t wkt_length, cass_double_t* x, 31 | cass_double_t* y) { 32 | WktLexer lexer(wkt, wkt_length); 33 | 34 | if (lexer.next_token() != WktLexer::TK_TYPE_POINT || 35 | lexer.next_token() != WktLexer::TK_OPEN_PAREN || lexer.next_token() != WktLexer::TK_NUMBER) { 36 | return CASS_ERROR_LIB_BAD_PARAMS; 37 | } 38 | 39 | *x = lexer.number(); 40 | 41 | if (lexer.next_token() != WktLexer::TK_NUMBER) { 42 | return CASS_ERROR_LIB_BAD_PARAMS; 43 | } 44 | 45 | *y = lexer.number(); 46 | 47 | // Look for the closing paren 48 | if (lexer.next_token() != WktLexer::TK_CLOSE_PAREN) { 49 | return CASS_ERROR_LIB_BAD_PARAMS; 50 | } 51 | 52 | return CASS_OK; 53 | } 54 | 55 | } // extern "C" 56 | -------------------------------------------------------------------------------- /src/dse_point.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_ENTERPRISE_INTERNAL_POINT_HPP 18 | #define DATASTAX_ENTERPRISE_INTERNAL_POINT_HPP 19 | 20 | #include "dse_serialization.hpp" 21 | 22 | namespace datastax { namespace internal { namespace enterprise { 23 | 24 | inline Bytes encode_point(cass_double_t x, cass_double_t y) { 25 | Bytes bytes; 26 | 27 | bytes.reserve(WKB_HEADER_SIZE + // Header 28 | sizeof(cass_double_t) + // X 29 | sizeof(cass_double_t)); // Y 30 | 31 | encode_header_append(WKB_GEOMETRY_TYPE_POINT, bytes); 32 | encode_append(x, bytes); 33 | encode_append(y, bytes); 34 | 35 | return bytes; 36 | } 37 | 38 | }}} // namespace datastax::internal::enterprise 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/dse_validate.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_ENTERPRISE_INTERNAL_VALIDATE_HPP 18 | #define DATASTAX_ENTERPRISE_INTERNAL_VALIDATE_HPP 19 | 20 | #include "dse.h" 21 | 22 | #include "string_ref.hpp" 23 | 24 | namespace datastax { namespace internal { namespace enterprise { 25 | 26 | inline CassError validate_data_type(const CassValue* value, const char* class_name) { 27 | const CassDataType* data_type = cass_value_data_type(value); 28 | 29 | if (data_type == NULL) { 30 | return CASS_ERROR_LIB_INTERNAL_ERROR; 31 | } 32 | 33 | if (cass_data_type_type(data_type) != CASS_VALUE_TYPE_CUSTOM) { 34 | return CASS_ERROR_LIB_INVALID_VALUE_TYPE; 35 | } 36 | 37 | const char* name; 38 | size_t name_length; 39 | cass_data_type_class_name(data_type, &name, &name_length); 40 | 41 | if (StringRef(name, name_length) != class_name) { 42 | return CASS_ERROR_LIB_INVALID_CUSTOM_TYPE; 43 | } 44 | 45 | return CASS_OK; 46 | } 47 | 48 | }}} // namespace datastax::internal::enterprise 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/execute_request.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "execute_request.hpp" 18 | 19 | #include "constants.hpp" 20 | #include "protocol.hpp" 21 | #include "request_callback.hpp" 22 | 23 | using namespace datastax::internal::core; 24 | 25 | ExecuteRequest::ExecuteRequest(const Prepared* prepared) 26 | : Statement(prepared) 27 | , prepared_(prepared) {} 28 | 29 | int ExecuteRequest::encode(ProtocolVersion version, RequestCallback* callback, 30 | BufferVec* bufs) const { 31 | int32_t length = encode_query_or_id(bufs); 32 | if (version.supports_result_metadata_id()) { 33 | if (callback->prepared_metadata_entry()) { 34 | const Buffer& result_metadata_id(callback->prepared_metadata_entry()->result_metadata_id()); 35 | bufs->push_back(result_metadata_id); 36 | length += result_metadata_id.size(); 37 | } else { 38 | bufs->push_back(Buffer(sizeof(uint16_t))); 39 | bufs->back().encode_uint16(0, 0); 40 | length += bufs->back().size(); 41 | } 42 | } 43 | length += encode_begin(version, static_cast(elements().size()), callback, bufs); 44 | int32_t result = encode_values(version, callback, bufs); 45 | if (result < 0) return result; 46 | length += result; 47 | length += encode_end(version, callback, bufs); 48 | return length; 49 | } 50 | -------------------------------------------------------------------------------- /src/execute_request.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_EXECUTE_REQUEST_HPP 18 | #define DATASTAX_INTERNAL_EXECUTE_REQUEST_HPP 19 | 20 | #include "constants.hpp" 21 | #include "prepared.hpp" 22 | #include "ref_counted.hpp" 23 | #include "statement.hpp" 24 | #include "string.hpp" 25 | #include "vector.hpp" 26 | 27 | namespace datastax { namespace internal { namespace core { 28 | 29 | class ExecuteRequest : public Statement { 30 | public: 31 | ExecuteRequest(const Prepared* prepared); 32 | 33 | const Prepared::ConstPtr& prepared() const { return prepared_; } 34 | 35 | virtual int encode(ProtocolVersion version, RequestCallback* callback, BufferVec* bufs) const; 36 | 37 | bool get_routing_key(String* routing_key) const { 38 | return calculate_routing_key(prepared_->key_indices(), routing_key); 39 | } 40 | 41 | private: 42 | virtual size_t get_indices(StringRef name, IndexVec* indices) { 43 | return prepared_->result()->metadata()->get_indices(name, indices); 44 | } 45 | 46 | virtual const DataType::ConstPtr& get_type(size_t index) const { 47 | return prepared_->result()->metadata()->get_column_definition(index).data_type; 48 | } 49 | 50 | private: 51 | Prepared::ConstPtr prepared_; 52 | }; 53 | 54 | }}} // namespace datastax::internal::core 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/exported_connection.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DATASTAX_EXPORTED_CONNECTION_HPP 2 | #define DATASTAX_EXPORTED_CONNECTION_HPP 3 | 4 | #include "ref_counted.hpp" 5 | #include "protocol.hpp" 6 | #include "address.hpp" 7 | 8 | namespace datastax { namespace internal { namespace core { 9 | 10 | class Host; 11 | class Connection; 12 | class ConnectionListener; 13 | class SocketHandlerBase; 14 | 15 | /** 16 | * This class is a hack that allows moving Connection to 17 | * different event loop. libuv doesn't have any mechanism 18 | * to do that (https://github.com/libuv/libuv/issues/390). 19 | * The solution used here is to extract file descriptor from Connection, 20 | * along with some important fields of Connection and Socket, 21 | * duplicate fd it using `dup` syscall, close and destroy original Connection, 22 | * and then on destination event loop create new Coonnection and Socket objects, 23 | * restoring their state from saved fields. 24 | */ 25 | class ExportedConnection : public RefCounted { 26 | public: 27 | typedef SharedRefPtr Ptr; 28 | ExportedConnection(SharedRefPtr connection); 29 | ~ExportedConnection(); 30 | SharedRefPtr import_connection(uv_loop_t *loop); 31 | 32 | private: 33 | // Connection fields 34 | SharedRefPtr host; 35 | ConnectionListener* listener_; 36 | ProtocolVersion protocol_version_; 37 | String keyspace_; 38 | int32_t shard_id_ = 0; 39 | unsigned int idle_timeout_secs_; 40 | unsigned int heartbeat_interval_secs_; 41 | 42 | // Socket fields 43 | int fd; 44 | SocketHandlerBase *handler_; 45 | bool is_defunct_; 46 | size_t max_reusable_write_objects_; 47 | Address address_; 48 | }; 49 | 50 | }}} // namespace datastax::internal::core 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/external.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_EXTERNAL_HPP 18 | #define DATASTAX_INTERNAL_EXTERNAL_HPP 19 | 20 | // This abstraction allows us to separate internal types from the 21 | // external opaque pointers that we expose. 22 | template 23 | struct External : public In { 24 | In* from() { return static_cast(this); } 25 | const In* from() const { return static_cast(this); } 26 | static Ex* to(In* in) { return static_cast(in); } 27 | static const Ex* to(const In* in) { return static_cast(in); } 28 | }; 29 | 30 | #define EXTERNAL_TYPE(InternalType, ExternalType) \ 31 | extern "C" { \ 32 | struct ExternalType##_ : public External { \ 33 | private: \ 34 | ~ExternalType##_() {} \ 35 | }; \ 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/fixnl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function fixnl() { 4 | echo "Fixing $1..." 5 | awk '/^$/ {nlstack=nlstack "\n";next;} {printf "%s",nlstack; nlstack=""; print;}' $1 > $1.tmp && mv $1.tmp $1 6 | } 7 | 8 | shopt -s globstar 9 | 10 | for file in **/*.cpp; do fixnl "$file"; done 11 | for file in **/*.hpp; do fixnl "$file"; done 12 | -------------------------------------------------------------------------------- /src/get_time-mac.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #if defined(__APPLE__) && defined(__MACH__) 18 | 19 | #include "get_time.hpp" 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace datastax { namespace internal { 26 | 27 | // Information on converting the absolute time to nanoseconds can be found 28 | // here: https://developer.apple.com/library/content/qa/qa1398/_index.html. 29 | 30 | class ClockInfo { 31 | public: 32 | ClockInfo() { 33 | mach_timebase_info_data_t info; 34 | mach_timebase_info(&info); 35 | frequency_ = info.numer / info.denom; 36 | } 37 | 38 | static uint64_t frequency() { return frequency_; } 39 | 40 | private: 41 | static uint64_t frequency_; 42 | }; 43 | 44 | uint64_t ClockInfo::frequency_; 45 | 46 | static ClockInfo __clock_info__; // Initializer 47 | 48 | uint64_t get_time_since_epoch_us() { 49 | struct timeval tv; 50 | gettimeofday(&tv, NULL); 51 | return static_cast(tv.tv_sec) * 1000000 + static_cast(tv.tv_usec); 52 | } 53 | 54 | uint64_t get_time_monotonic_ns() { 55 | uint64_t time = mach_absolute_time(); 56 | return time * ClockInfo::frequency(); 57 | } 58 | 59 | }} // namespace datastax::internal 60 | 61 | #endif // defined(__APPLE__) && defined(__MACH__) 62 | -------------------------------------------------------------------------------- /src/get_time.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_GET_TIME_HPP 18 | #define DATASTAX_INTERNAL_GET_TIME_HPP 19 | 20 | #include 21 | 22 | #define NANOSECONDS_PER_MICROSECOND 1000LL 23 | #define NANOSECONDS_PER_MILLISECOND 1000000LL 24 | #define NANOSECONDS_PER_SECOND 1000000000LL 25 | 26 | #define MICROSECONDS_PER_MILLISECOND 1000LL 27 | 28 | namespace datastax { namespace internal { 29 | 30 | uint64_t get_time_since_epoch_us(); 31 | 32 | inline uint64_t get_time_since_epoch_ms() { 33 | return get_time_since_epoch_us() / MICROSECONDS_PER_MILLISECOND; 34 | } 35 | 36 | // This is a best effort monotonic clock with an arbitrary start time. If the 37 | // system or platform doesn't have a monotonic clock then 38 | // `get_time_since_epoch_us()` will be used. 39 | uint64_t get_time_monotonic_ns(); 40 | 41 | }} // namespace datastax::internal 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/hash.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_HASH_HPP 18 | #define DATASTAX_INTERNAL_HASH_HPP 19 | 20 | #include 21 | #include 22 | 23 | namespace datastax { namespace hash { 24 | 25 | typedef int(Op)(int); 26 | 27 | inline int nop(int c) { return c; } 28 | 29 | #if defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) 30 | #define FNV1_64_INIT 0xcbf29ce484222325ULL 31 | #define FNV1_64_PRIME 0x100000001b3ULL 32 | 33 | inline uint64_t fnv1a(const char* data, size_t length, Op op = nop) { 34 | uint64_t h = FNV1_64_INIT; 35 | for (size_t i = 0; i < length; ++i) { 36 | h ^= static_cast(op(data[i])); 37 | h *= FNV1_64_PRIME; 38 | } 39 | return h; 40 | } 41 | #else 42 | #define FNV1_32_INIT 0x811c9dc5 43 | #define FNV1_32_PRIME 0x01000193 44 | 45 | inline uint32_t fnv1a(const char* data, size_t length, Op op = nop) { 46 | uint32_t h = FNV1_32_INIT; 47 | for (size_t i = 0; i < length; ++i) { 48 | h ^= static_cast(op(data[i])); 49 | h *= FNV1_32_PRIME; 50 | } 51 | return h; 52 | } 53 | #endif 54 | 55 | }} // namespace datastax::hash 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/iterator.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_ITERATOR_HPP 18 | #define DATASTAX_INTERNAL_ITERATOR_HPP 19 | 20 | #include "allocated.hpp" 21 | #include "cassandra.h" 22 | #include "external.hpp" 23 | 24 | namespace datastax { namespace internal { namespace core { 25 | 26 | class Iterator : public Allocated { 27 | public: 28 | Iterator(CassIteratorType type) 29 | : type_(type) {} 30 | 31 | virtual ~Iterator() {} 32 | 33 | CassIteratorType type() const { return type_; } 34 | 35 | virtual bool next() = 0; 36 | 37 | private: 38 | const CassIteratorType type_; 39 | }; 40 | 41 | }}} // namespace datastax::internal::core 42 | 43 | EXTERNAL_TYPE(datastax::internal::core::Iterator, CassIterator) 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/list_policy.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_LIST_POLICY_HPP 18 | #define DATASTAX_INTERNAL_LIST_POLICY_HPP 19 | 20 | #include "host.hpp" 21 | #include "load_balancing.hpp" 22 | #include "scoped_ptr.hpp" 23 | 24 | namespace datastax { namespace internal { namespace core { 25 | 26 | class ListPolicy : public ChainedLoadBalancingPolicy { 27 | public: 28 | ListPolicy(LoadBalancingPolicy* child_policy) 29 | : ChainedLoadBalancingPolicy(child_policy) {} 30 | 31 | virtual ~ListPolicy() {} 32 | 33 | virtual void init(const Host::Ptr& connected_host, const HostMap& hosts, Random* random, 34 | const String& local_dc, const String& local_rack); 35 | 36 | virtual CassHostDistance distance(const Host::Ptr& host) const; 37 | 38 | virtual QueryPlan* new_query_plan(const String& keyspace, RequestHandler* request_handler, 39 | const TokenMap* token_map); 40 | 41 | virtual void on_host_added(const Host::Ptr& host); 42 | virtual void on_host_up(const Host::Ptr& host); 43 | 44 | virtual ListPolicy* new_instance() = 0; 45 | 46 | private: 47 | virtual bool is_valid_host(const Host::Ptr& host) const = 0; 48 | }; 49 | 50 | }}} // namespace datastax::internal::core 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/map.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_MAP_HPP 18 | #define DATASTAX_INTERNAL_MAP_HPP 19 | 20 | #include "allocated.hpp" 21 | #include "allocator.hpp" 22 | 23 | #include 24 | 25 | namespace datastax { namespace internal { 26 | 27 | template > 28 | class Map 29 | : public Allocated 30 | , public std::map > > { 31 | public: 32 | typedef internal::Allocator > Allocator; 33 | 34 | explicit Map(const Compare& compare = Compare(), const Allocator& alloc = Allocator()) 35 | : std::map(compare, alloc) {} 36 | 37 | template 38 | Map(InputIt first, InputIt last, const Compare& compare = Compare(), 39 | const Allocator& alloc = Allocator()) 40 | : std::map(first, last, compare, alloc) {} 41 | }; 42 | 43 | }} // namespace datastax::internal 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/map_iterator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "map_iterator.hpp" 18 | 19 | using namespace datastax::internal::core; 20 | 21 | bool MapIterator::decode_pair() { 22 | key_ = decoder_.decode_value(map_->primary_data_type()); 23 | if (key_.data_type()) { 24 | value_ = decoder_.decode_value(map_->secondary_data_type()); 25 | return value_.is_valid(); 26 | } 27 | return false; 28 | } 29 | 30 | bool MapIterator::next() { 31 | if (index_ + 1 >= count_) { 32 | return false; 33 | } 34 | ++index_; 35 | return decode_pair(); 36 | } 37 | -------------------------------------------------------------------------------- /src/map_iterator.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_MAP_ITERATOR_HPP 18 | #define DATASTAX_INTERNAL_MAP_ITERATOR_HPP 19 | 20 | #include "cassandra.h" 21 | #include "iterator.hpp" 22 | #include "serialization.hpp" 23 | #include "value.hpp" 24 | 25 | namespace datastax { namespace internal { namespace core { 26 | 27 | class MapIterator : public Iterator { 28 | public: 29 | MapIterator(const Value* map) 30 | : Iterator(CASS_ITERATOR_TYPE_MAP) 31 | , map_(map) 32 | , decoder_(map->decoder()) 33 | , index_(-1) 34 | , count_(map_->count()) {} 35 | 36 | virtual bool next(); 37 | 38 | const Value* key() const { 39 | assert(index_ >= 0 && index_ < count_); 40 | return &key_; 41 | } 42 | 43 | const Value* value() const { 44 | assert(index_ >= 0 && index_ < count_); 45 | return &value_; 46 | } 47 | 48 | private: 49 | bool decode_pair(); 50 | 51 | private: 52 | const Value* map_; 53 | Decoder decoder_; 54 | Value key_; 55 | Value value_; 56 | int32_t index_; 57 | const int32_t count_; 58 | }; 59 | 60 | }}} // namespace datastax::internal::core 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/md5.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Based on public domain source found here: 18 | // http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 19 | 20 | #ifndef DATASTAX_INTERNAL_MD5_HPP 21 | #define DATASTAX_INTERNAL_MD5_HPP 22 | 23 | #include "macros.hpp" 24 | 25 | #include 26 | #include 27 | 28 | namespace datastax { namespace internal { 29 | 30 | class Md5 { 31 | public: 32 | Md5(); 33 | 34 | void update(const uint8_t* data, size_t size); 35 | void final(uint8_t* result); 36 | 37 | private: 38 | const uint8_t* body(const uint8_t* data, size_t size); 39 | 40 | private: 41 | // Any 32-bit or wider unsigned integer data type will do 42 | typedef uint32_t MD5_u32plus; 43 | 44 | MD5_u32plus lo_, hi_; 45 | MD5_u32plus a_, b_, c_, d_; 46 | unsigned char buffer_[64]; 47 | MD5_u32plus block_[16]; 48 | 49 | DISALLOW_COPY_AND_ASSIGN(Md5); 50 | }; 51 | 52 | }} // namespace datastax::internal 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/murmur3.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | /*----------------------------------------------------------------------------- 18 | * MurmurHash3 was written by Austin Appleby, and is placed in the public 19 | * domain. The author hereby disclaims copyright to this source code. 20 | */ 21 | 22 | #ifndef DATASTAX_INTERNAL_MURMUR3_HPP 23 | #define DATASTAX_INTERNAL_MURMUR3_HPP 24 | 25 | #include "macros.hpp" 26 | 27 | #include 28 | 29 | namespace datastax { namespace internal { 30 | 31 | int64_t MurmurHash3_x64_128(const void* key, const int len, const uint32_t seed); 32 | 33 | }} // namespace datastax::internal 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/optional.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DATASTAX_INTERNAL_OPTIONAL_HPP 2 | #define DATASTAX_INTERNAL_OPTIONAL_HPP 3 | 4 | #include "driver_config.hpp" 5 | 6 | #if CASS_CPP_STANDARD >= 17 7 | #include "optional/optional_std.hpp" 8 | #else 9 | #include "optional/optional_akrzemi.hpp" 10 | #endif 11 | 12 | #endif /* DATASTAX_INTERNAL_OPTIONAL_HPP */ 13 | -------------------------------------------------------------------------------- /src/optional/optional_std.hpp: -------------------------------------------------------------------------------- 1 | # ifndef OPTIONAL_STD_HPP 2 | # define OPTIONAL_STD_HPP 3 | 4 | # include 5 | 6 | namespace datastax { namespace internal { 7 | 8 | template 9 | using CassOptional = std::optional; 10 | constexpr auto CassNullopt = std::nullopt; 11 | 12 | }} // namespace datastax::internal 13 | 14 | # endif /* OPTIONAL_STD_HPP */ 15 | -------------------------------------------------------------------------------- /src/options_request.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_OPTIONS_REQUEST_HPP 18 | #define DATASTAX_INTERNAL_OPTIONS_REQUEST_HPP 19 | 20 | #include "constants.hpp" 21 | #include "request.hpp" 22 | 23 | namespace datastax { namespace internal { namespace core { 24 | 25 | class OptionsRequest : public Request { 26 | public: 27 | OptionsRequest() 28 | : Request(CQL_OPCODE_OPTIONS) {} 29 | 30 | private: 31 | int encode(ProtocolVersion version, RequestCallback* callback, BufferVec* bufs) const { 32 | return 0; 33 | } 34 | }; 35 | 36 | }}} // namespace datastax::internal::core 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/prepare_request.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "prepare_request.hpp" 18 | 19 | #include "protocol.hpp" 20 | #include "serialization.hpp" 21 | 22 | using namespace datastax::internal::core; 23 | 24 | int PrepareRequest::encode(ProtocolVersion version, RequestCallback* callback, 25 | BufferVec* bufs) const { 26 | // [long string] 27 | size_t length = sizeof(int32_t) + query_.size(); 28 | bufs->push_back(Buffer(length)); 29 | bufs->back().encode_long_string(0, query_.data(), query().size()); 30 | 31 | if (version.supports_set_keyspace()) { 32 | // [int] [ [string]] 33 | int32_t flags = 0; 34 | size_t flags_keyspace_buf_size = sizeof(int32_t); // [int] 35 | 36 | if (!keyspace().empty()) { 37 | flags |= CASS_PREPARE_FLAG_WITH_KEYSPACE; 38 | flags_keyspace_buf_size += sizeof(uint16_t) + keyspace().size(); // [string] 39 | } 40 | 41 | bufs->push_back(Buffer(flags_keyspace_buf_size)); 42 | length += flags_keyspace_buf_size; 43 | 44 | Buffer& buf = bufs->back(); 45 | size_t pos = buf.encode_int32(0, flags); 46 | 47 | if (!keyspace().empty()) { 48 | buf.encode_string(pos, keyspace().data(), static_cast(keyspace().size())); 49 | } 50 | } 51 | return length; 52 | } 53 | -------------------------------------------------------------------------------- /src/prepare_request.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_PREPARE_REQUEST_HPP 18 | #define DATASTAX_INTERNAL_PREPARE_REQUEST_HPP 19 | 20 | #include "constants.hpp" 21 | #include "request.hpp" 22 | #include "string.hpp" 23 | 24 | namespace datastax { namespace internal { namespace core { 25 | 26 | class PrepareRequest : public Request { 27 | public: 28 | typedef SharedRefPtr Ptr; 29 | typedef SharedRefPtr ConstPtr; 30 | 31 | PrepareRequest(const String& query) 32 | : Request(CQL_OPCODE_PREPARE) 33 | , query_(query) {} 34 | 35 | const String& query() const { return query_; } 36 | 37 | void set_query(const String& query) { query_ = query; } 38 | 39 | void set_query(const char* query, size_t query_length) { query_.assign(query, query_length); } 40 | 41 | private: 42 | int encode(ProtocolVersion version, RequestCallback* callback, BufferVec* bufs) const; 43 | 44 | private: 45 | String query_; 46 | }; 47 | 48 | }}} // namespace datastax::internal::core 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/random.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_RANDOM_HPP 18 | #define DATASTAX_INTERNAL_RANDOM_HPP 19 | 20 | #include "allocated.hpp" 21 | #include "third_party/mt19937_64/mt19937_64.hpp" 22 | 23 | #include 24 | #include 25 | 26 | namespace datastax { namespace internal { 27 | 28 | class Random : public Allocated { 29 | public: 30 | Random(); 31 | ~Random(); 32 | 33 | uint64_t next(uint64_t max); 34 | 35 | private: 36 | uv_mutex_t mutex_; 37 | MT19937_64 rng_; 38 | }; 39 | 40 | uint64_t get_random_seed(uint64_t seed); 41 | 42 | template 43 | void random_shuffle(RandomAccessIterator first, RandomAccessIterator last, Random* random) { 44 | size_t size = last - first; 45 | for (size_t i = size - 1; i > 0; --i) { 46 | std::swap(first[i], first[random->next(i + 1)]); 47 | } 48 | } 49 | 50 | }} // namespace datastax::internal 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/ready_response.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_READY_RESPONSE_HPP 18 | #define DATASTAX_INTERNAL_READY_RESPONSE_HPP 19 | 20 | #include "response.hpp" 21 | 22 | namespace datastax { namespace internal { namespace core { 23 | 24 | class ReadyResponse : public Response { 25 | public: 26 | ReadyResponse() 27 | : Response(CQL_OPCODE_READY) {} 28 | 29 | virtual bool decode(Decoder& decoder) { return true; } 30 | }; 31 | 32 | }}} // namespace datastax::internal::core 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/register_request.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "register_request.hpp" 18 | 19 | #include "serialization.hpp" 20 | 21 | using namespace datastax::internal::core; 22 | 23 | int RegisterRequest::encode(ProtocolVersion version, RequestCallback* callback, 24 | BufferVec* bufs) const { 25 | // [string list] 26 | size_t length = sizeof(uint16_t); 27 | Vector events; 28 | 29 | if (event_types_ & CASS_EVENT_TOPOLOGY_CHANGE) { 30 | events.push_back("TOPOLOGY_CHANGE"); 31 | length += sizeof(uint16_t); 32 | length += events.back().size(); 33 | } 34 | 35 | if (event_types_ & CASS_EVENT_STATUS_CHANGE) { 36 | events.push_back("STATUS_CHANGE"); 37 | length += sizeof(uint16_t); 38 | length += events.back().size(); 39 | } 40 | 41 | if (event_types_ & CASS_EVENT_SCHEMA_CHANGE) { 42 | events.push_back("SCHEMA_CHANGE"); 43 | length += sizeof(uint16_t); 44 | length += events.back().size(); 45 | } 46 | 47 | bufs->push_back(Buffer(length)); 48 | bufs->back().encode_string_list(0, events); 49 | 50 | return length; 51 | } 52 | -------------------------------------------------------------------------------- /src/register_request.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_REGISTER_REQUEST_HPP 18 | #define DATASTAX_INTERNAL_REGISTER_REQUEST_HPP 19 | 20 | #include "constants.hpp" 21 | #include "request.hpp" 22 | 23 | namespace datastax { namespace internal { namespace core { 24 | 25 | class RegisterRequest : public Request { 26 | public: 27 | RegisterRequest(int event_types) 28 | : Request(CQL_OPCODE_REGISTER) 29 | , event_types_(event_types) {} 30 | 31 | private: 32 | int encode(ProtocolVersion version, RequestCallback* callback, BufferVec* bufs) const; 33 | 34 | int event_types_; 35 | }; 36 | 37 | }}} // namespace datastax::internal::core 38 | #endif 39 | -------------------------------------------------------------------------------- /src/result_iterator.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_RESULT_ITERATOR_HPP 18 | #define DATASTAX_INTERNAL_RESULT_ITERATOR_HPP 19 | 20 | #include "iterator.hpp" 21 | #include "result_response.hpp" 22 | #include "row.hpp" 23 | 24 | namespace datastax { namespace internal { namespace core { 25 | 26 | class ResultIterator : public Iterator { 27 | public: 28 | ResultIterator(const ResultResponse* result) 29 | : Iterator(CASS_ITERATOR_TYPE_RESULT) 30 | , result_(result) 31 | , index_(-1) 32 | , row_(result) { 33 | decoder_ = (const_cast(result))->row_decoder(); 34 | row_.values = result_->first_row().values; 35 | } 36 | 37 | virtual bool next() { 38 | return (index_ + 1 < result_->row_count()) && 39 | (++index_ < 1 || decode_next_row(decoder_, row_.values)); 40 | } 41 | 42 | const Row* row() const { 43 | assert(index_ >= 0 && index_ < result_->row_count()); 44 | return &row_; 45 | } 46 | 47 | private: 48 | const ResultResponse* result_; 49 | Decoder decoder_; 50 | int32_t index_; 51 | Row row_; 52 | }; 53 | 54 | }}} // namespace datastax::internal::core 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/result_metadata.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // The FNV1a hash code is based on work found here: 18 | // http://www.isthe.com/chongo/tech/comp/fnv/index.html 19 | // and is therefore public domain. 20 | 21 | #include "result_metadata.hpp" 22 | 23 | #include "utils.hpp" 24 | 25 | #include 26 | 27 | using namespace datastax; 28 | using namespace datastax::internal; 29 | using namespace datastax::internal::core; 30 | 31 | ResultMetadata::ResultMetadata(size_t column_count, const RefBuffer::Ptr& buffer) 32 | : defs_(column_count) 33 | , buffer_(buffer) {} 34 | 35 | size_t ResultMetadata::get_indices(StringRef name, IndexVec* result) const { 36 | return defs_.get_indices(name, result); 37 | } 38 | 39 | void ResultMetadata::add(const ColumnDefinition& def) { defs_.add(def); } 40 | -------------------------------------------------------------------------------- /src/row.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_ROW_HPP 18 | #define DATASTAX_INTERNAL_ROW_HPP 19 | 20 | #include "decoder.hpp" 21 | #include "external.hpp" 22 | #include "string_ref.hpp" 23 | #include "value.hpp" 24 | 25 | namespace datastax { namespace internal { namespace core { 26 | 27 | class ResultResponse; 28 | 29 | class Row { 30 | public: 31 | Row() 32 | : result_(NULL) {} 33 | 34 | Row(const ResultResponse* result) 35 | : result_(result) {} 36 | 37 | OutputValueVec values; 38 | 39 | const Value* get_by_name(const StringRef& name) const; 40 | 41 | bool get_string_by_name(const StringRef& name, String* out) const; 42 | 43 | bool get_uuid_by_name(const StringRef& name, CassUuid* out) const; 44 | 45 | const ResultResponse* result() const { return result_; } 46 | 47 | void set_result(ResultResponse* result) { result_ = result; } 48 | 49 | private: 50 | const ResultResponse* result_; 51 | }; 52 | 53 | bool decode_row(Decoder& decoder, const ResultResponse* result, OutputValueVec& output); 54 | bool decode_next_row(Decoder& decoder, OutputValueVec& output); 55 | 56 | }}} // namespace datastax::internal::core 57 | 58 | EXTERNAL_TYPE(datastax::internal::core::Row, CassRow) 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/row_iterator.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_ROW_ITERATOR_HPP 18 | #define DATASTAX_INTERNAL_ROW_ITERATOR_HPP 19 | 20 | #include "iterator.hpp" 21 | #include "row.hpp" 22 | 23 | namespace datastax { namespace internal { namespace core { 24 | 25 | class RowIterator : public Iterator { 26 | public: 27 | RowIterator(const Row* row) 28 | : Iterator(CASS_ITERATOR_TYPE_ROW) 29 | , row_(row) 30 | , index_(-1) {} 31 | 32 | virtual bool next() { 33 | if (static_cast(index_ + 1) >= row_->values.size()) { 34 | return false; 35 | } 36 | ++index_; 37 | return true; 38 | } 39 | 40 | const Value* column() const { 41 | assert(index_ >= 0 && static_cast(index_) < row_->values.size()); 42 | return &row_->values[index_]; 43 | } 44 | 45 | private: 46 | const Row* row_; 47 | int32_t index_; 48 | }; 49 | 50 | }}} // namespace datastax::internal::core 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/set.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_SET_HPP 18 | #define DATASTAX_INTERNAL_SET_HPP 19 | 20 | #include "allocated.hpp" 21 | #include "allocator.hpp" 22 | 23 | #include 24 | 25 | namespace datastax { namespace internal { 26 | 27 | template > 28 | class Set 29 | : public Allocated 30 | , public std::set > { 31 | public: 32 | typedef internal::Allocator Allocator; 33 | 34 | explicit Set(const Compare& compare = Compare(), const Allocator& alloc = Allocator()) 35 | : std::set(compare, alloc) {} 36 | 37 | Set(const Set& other) 38 | : std::set(other) {} 39 | 40 | template 41 | Set(InputIt first, InputIt last, const Compare& compare = Compare(), 42 | const Allocator& alloc = Allocator()) 43 | : std::set(first, last, compare, alloc) {} 44 | }; 45 | 46 | }} // namespace datastax::internal 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/small_vector.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_SMALL_VECTOR_HPP 18 | #define DATASTAX_INTERNAL_SMALL_VECTOR_HPP 19 | 20 | #include "fixed_allocator.hpp" 21 | 22 | #include 23 | 24 | namespace datastax { namespace internal { 25 | 26 | // This vector uses a fixed buffer as long as it doesn't exceed N items. 27 | // This can help to avoid heap allocation in cases where the vector remains 28 | // small and doesn't excceed the fixed buffer. 29 | 30 | template 31 | class SmallVector : public std::vector > { 32 | public: 33 | SmallVector() 34 | : std::vector >(FixedAllocator(&fixed_)) { 35 | this->reserve(N); 36 | } 37 | 38 | SmallVector(size_t inital_size) 39 | : std::vector >(FixedAllocator(&fixed_)) { 40 | this->resize(inital_size); 41 | } 42 | 43 | const typename FixedAllocator::Fixed& fixed() const { return fixed_; } 44 | 45 | private: 46 | typename FixedAllocator::Fixed fixed_; 47 | 48 | private: 49 | DISALLOW_COPY_AND_ASSIGN(SmallVector); 50 | }; 51 | 52 | }} // namespace datastax::internal 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/stack.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_STACK_HPP 18 | #define DATASTAX_INTERNAL_STACK_HPP 19 | 20 | #include "deque.hpp" 21 | 22 | #include 23 | 24 | namespace datastax { namespace internal { 25 | 26 | template > 27 | class Stack : public std::stack { 28 | public: 29 | explicit Stack(const Container& container = Container()) 30 | : std::stack(container) {} 31 | 32 | Stack(const Stack& other) 33 | : std::stack(other) {} 34 | }; 35 | 36 | }} // namespace datastax::internal 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/startup_request.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "startup_request.hpp" 18 | #include "driver_info.hpp" 19 | 20 | using namespace datastax::internal; 21 | using namespace datastax::internal::core; 22 | 23 | int StartupRequest::encode(ProtocolVersion version, RequestCallback* callback, 24 | BufferVec* bufs) const { 25 | // [string map] 26 | size_t length = sizeof(uint16_t); 27 | 28 | OptionsMap options; 29 | if (!application_name_.empty()) { 30 | options["APPLICATION_NAME"] = application_name_; 31 | } 32 | if (!application_version_.empty()) { 33 | options["APPLICATION_VERSION"] = application_version_; 34 | } 35 | if (!client_id_.empty()) { 36 | options["CLIENT_ID"] = client_id_; 37 | } 38 | options["CQL_VERSION"] = CASS_DEFAULT_CQL_VERSION; 39 | options["DRIVER_NAME"] = driver_name(); 40 | options["DRIVER_VERSION"] = driver_version(); 41 | if (no_compact_enabled_) { 42 | options["NO_COMPACT"] = "true"; 43 | } 44 | 45 | for (OptionsMap::const_iterator it = options.begin(), end = options.end(); it != end; ++it) { 46 | length += sizeof(uint16_t) + it->first.size(); 47 | length += sizeof(uint16_t) + it->second.size(); 48 | } 49 | 50 | bufs->push_back(Buffer(length)); 51 | bufs->back().encode_string_map(0, options); 52 | 53 | return length; 54 | } 55 | -------------------------------------------------------------------------------- /src/string_ref.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "string_ref.hpp" 18 | 19 | namespace datastax { 20 | 21 | const StringRef::size_type StringRef::npos = -1; 22 | 23 | } // namespace datastax 24 | -------------------------------------------------------------------------------- /src/supported_response.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "supported_response.hpp" 18 | 19 | #include "logger.hpp" 20 | #include "serialization.hpp" 21 | #include "utils.hpp" 22 | 23 | #include 24 | 25 | using namespace datastax; 26 | using namespace datastax::internal; 27 | using namespace datastax::internal::core; 28 | 29 | bool SupportedResponse::decode(Decoder& decoder) { 30 | decoder.set_type("supported"); 31 | StringMultimap supported_options; 32 | CHECK_RESULT(decoder.decode_string_multimap(supported_options)); 33 | decoder.maybe_log_remaining(); 34 | 35 | // Force keys to be uppercase 36 | for (StringMultimap::iterator it = supported_options.begin(), end = supported_options.end(); 37 | it != end; ++it) { 38 | String key = it->first; 39 | std::transform(key.begin(), key.end(), key.begin(), toupper); 40 | supported_options_[key] = it->second; 41 | } 42 | 43 | return true; 44 | } 45 | -------------------------------------------------------------------------------- /src/supported_response.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_SUPPORTED_RESPONSE_HPP 18 | #define DATASTAX_INTERNAL_SUPPORTED_RESPONSE_HPP 19 | 20 | #include "constants.hpp" 21 | #include "response.hpp" 22 | #include "string.hpp" 23 | #include "vector.hpp" 24 | 25 | namespace datastax { namespace internal { namespace core { 26 | 27 | class SupportedResponse : public Response { 28 | public: 29 | SupportedResponse() 30 | : Response(CQL_OPCODE_SUPPORTED) {} 31 | 32 | virtual bool decode(Decoder& decoder); 33 | 34 | /** 35 | * Get the supported options provided by the server. 36 | * 37 | * @return Supported options; all keys are normalized (uppercase). 38 | */ 39 | const StringMultimap& supported_options() const { return supported_options_; } 40 | 41 | private: 42 | StringMultimap supported_options_; 43 | }; 44 | 45 | }}} // namespace datastax::internal::core 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/third_party/curl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB SOURCES *.cpp *.hpp) 2 | 3 | source_group("Source Files\\" REGULAR_EXPRESSION ".*\\.c(pp)?") 4 | source_group("Header Files\\" REGULAR_EXPRESSION ".*\\.h(pp)?") 5 | 6 | if(CASS_BUILD_SHARED) 7 | add_library(curl_hostcheck OBJECT ${SOURCES}) 8 | set_target_properties(curl_hostcheck PROPERTIES 9 | POSITION_INDEPENDENT_CODE ON 10 | FOLDER "Driver/Dependencies") 11 | endif() 12 | 13 | if(CASS_BUILD_STATIC) 14 | add_library(curl_hostcheck_static OBJECT ${SOURCES}) 15 | set_target_properties(curl_hostcheck_static PROPERTIES 16 | FOLDER "Driver/Dependencies") 17 | endif() 18 | 19 | -------------------------------------------------------------------------------- /src/third_party/curl/COPYING: -------------------------------------------------------------------------------- 1 | COPYRIGHT AND PERMISSION NOTICE 2 | 3 | Copyright (c) 1996 - 2016, Daniel Stenberg, , and many 4 | contributors, see the THANKS file. 5 | 6 | All rights reserved. 7 | 8 | Permission to use, copy, modify, and distribute this software for any purpose 9 | with or without fee is hereby granted, provided that the above copyright 10 | notice and this permission notice appear in all copies. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN 15 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 16 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 17 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 18 | OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | Except as contained in this notice, the name of a copyright holder shall not 21 | be used in advertising or otherwise to promote the sale, use or other dealings 22 | in this Software without prior written authorization of the copyright holder. 23 | -------------------------------------------------------------------------------- /src/third_party/curl/hostcheck.hpp: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CURL_HOSTCHECK_H 2 | #define HEADER_CURL_HOSTCHECK_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | #define CURL_HOST_NOMATCH 0 26 | #define CURL_HOST_MATCH 1 27 | int Curl_cert_hostcheck(const char *match_pattern, const char *hostname); 28 | 29 | #endif /* HEADER_CURL_HOSTCHECK_H */ 30 | -------------------------------------------------------------------------------- /src/third_party/hdr_histogram/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB SOURCES *.cpp *.hpp) 2 | 3 | source_group("Source Files\\" REGULAR_EXPRESSION ".*\\.c(pp)?") 4 | source_group("Header Files\\" REGULAR_EXPRESSION ".*\\.h(pp)?") 5 | 6 | if(CASS_BUILD_SHARED) 7 | add_library(hdr_histogram OBJECT ${SOURCES}) 8 | set_target_properties(hdr_histogram PROPERTIES 9 | POSITION_INDEPENDENT_CODE ON 10 | FOLDER "Driver/Dependencies") 11 | endif() 12 | 13 | if(CASS_BUILD_STATIC) 14 | add_library(hdr_histogram_static OBJECT ${SOURCES}) 15 | set_target_properties(hdr_histogram_static PROPERTIES 16 | FOLDER "Driver/Dependencies") 17 | endif() 18 | -------------------------------------------------------------------------------- /src/third_party/http-parser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB SOURCES http_parser.c http_parser.h) 2 | 3 | source_group("Source Files\\" REGULAR_EXPRESSION ".*\\.c(pp)?") 4 | source_group("Header Files\\" REGULAR_EXPRESSION ".*\\.h(pp)?") 5 | 6 | if(CASS_BUILD_SHARED) 7 | add_library(http-parser OBJECT ${SOURCES}) 8 | set_target_properties(http-parser PROPERTIES 9 | POSITION_INDEPENDENT_CODE ON 10 | FOLDER "Driver/Dependencies") 11 | endif() 12 | 13 | if(CASS_BUILD_STATIC) 14 | add_library(http-parser_static OBJECT ${SOURCES}) 15 | set_target_properties(http-parser_static PROPERTIES 16 | FOLDER "Driver/Dependencies") 17 | endif() 18 | -------------------------------------------------------------------------------- /src/third_party/http-parser/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright Joyent, Inc. and other Node contributors. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to 5 | deal in the Software without restriction, including without limitation the 6 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | sell copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /src/third_party/http-parser/contrib/url_parser.c: -------------------------------------------------------------------------------- 1 | #include "http_parser.h" 2 | #include 3 | #include 4 | 5 | void 6 | dump_url (const char *url, const struct http_parser_url *u) 7 | { 8 | unsigned int i; 9 | 10 | printf("\tfield_set: 0x%x, port: %u\n", u->field_set, u->port); 11 | for (i = 0; i < UF_MAX; i++) { 12 | if ((u->field_set & (1 << i)) == 0) { 13 | printf("\tfield_data[%u]: unset\n", i); 14 | continue; 15 | } 16 | 17 | printf("\tfield_data[%u]: off: %u, len: %u, part: %.*s\n", 18 | i, 19 | u->field_data[i].off, 20 | u->field_data[i].len, 21 | u->field_data[i].len, 22 | url + u->field_data[i].off); 23 | } 24 | } 25 | 26 | int main(int argc, char ** argv) { 27 | struct http_parser_url u; 28 | int len, connect, result; 29 | 30 | if (argc != 3) { 31 | printf("Syntax : %s connect|get url\n", argv[0]); 32 | return 1; 33 | } 34 | len = strlen(argv[2]); 35 | connect = strcmp("connect", argv[1]) == 0 ? 1 : 0; 36 | printf("Parsing %s, connect %d\n", argv[2], connect); 37 | 38 | http_parser_url_init(&u); 39 | result = http_parser_parse_url(argv[2], len, connect, &u); 40 | if (result != 0) { 41 | printf("Parse error : %d\n", result); 42 | return result; 43 | } 44 | printf("Parse ok, result : \n"); 45 | dump_url(argv[2], &u); 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /src/third_party/minizip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB SOURCES ioapi.c unzip.c crypt.h ioapi.h unzip.h) 2 | 3 | source_group("Source Files\\" REGULAR_EXPRESSION ".*\\.c(pp)?") 4 | source_group("Header Files\\" REGULAR_EXPRESSION ".*\\.h(pp)?") 5 | 6 | if(CASS_BUILD_SHARED) 7 | add_library(minizip OBJECT ${SOURCES}) 8 | target_include_directories(minizip PRIVATE ${ZLIB_INCLUDE_DIRS}) 9 | set_target_properties(minizip PROPERTIES 10 | POSITION_INDEPENDENT_CODE ON 11 | FOLDER "Driver/Dependencies") 12 | endif() 13 | 14 | if(CASS_BUILD_STATIC) 15 | add_library(minizip_static OBJECT ${SOURCES}) 16 | target_include_directories(minizip_static PRIVATE ${ZLIB_INCLUDE_DIRS}) 17 | set_target_properties(minizip_static PROPERTIES 18 | FOLDER "Driver/Dependencies") 19 | endif() 20 | -------------------------------------------------------------------------------- /src/third_party/minizip/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libminizip.la 2 | 3 | if COND_DEMOS 4 | bin_PROGRAMS = miniunzip minizip 5 | endif 6 | 7 | zlib_top_srcdir = $(top_srcdir)/../.. 8 | zlib_top_builddir = $(top_builddir)/../.. 9 | 10 | AM_CPPFLAGS = -I$(zlib_top_srcdir) 11 | AM_LDFLAGS = -L$(zlib_top_builddir) 12 | 13 | if WIN32 14 | iowin32_src = iowin32.c 15 | iowin32_h = iowin32.h 16 | endif 17 | 18 | libminizip_la_SOURCES = \ 19 | ioapi.c \ 20 | mztools.c \ 21 | unzip.c \ 22 | zip.c \ 23 | ${iowin32_src} 24 | 25 | libminizip_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 -lz 26 | 27 | minizip_includedir = $(includedir)/minizip 28 | minizip_include_HEADERS = \ 29 | crypt.h \ 30 | ioapi.h \ 31 | mztools.h \ 32 | unzip.h \ 33 | zip.h \ 34 | ${iowin32_h} 35 | 36 | pkgconfigdir = $(libdir)/pkgconfig 37 | pkgconfig_DATA = minizip.pc 38 | 39 | EXTRA_PROGRAMS = miniunzip minizip 40 | 41 | miniunzip_SOURCES = miniunz.c 42 | miniunzip_LDADD = libminizip.la 43 | 44 | minizip_SOURCES = minizip.c 45 | minizip_LDADD = libminizip.la -lz 46 | -------------------------------------------------------------------------------- /src/third_party/minizip/MiniZip64_Changes.txt: -------------------------------------------------------------------------------- 1 | 2 | MiniZip 1.1 was derrived from MiniZip at version 1.01f 3 | 4 | Change in 1.0 (Okt 2009) 5 | - **TODO - Add history** 6 | 7 | -------------------------------------------------------------------------------- /src/third_party/minizip/c90_patch.diff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scylladb/cpp-driver/5909fefba1a6aa28ba1bb22ad92de839b34bd028/src/third_party/minizip/c90_patch.diff -------------------------------------------------------------------------------- /src/third_party/minizip/configure.ac: -------------------------------------------------------------------------------- 1 | # -*- Autoconf -*- 2 | # Process this file with autoconf to produce a configure script. 3 | 4 | AC_INIT([minizip], [1.2.11], [bugzilla.redhat.com]) 5 | AC_CONFIG_SRCDIR([minizip.c]) 6 | AM_INIT_AUTOMAKE([foreign]) 7 | LT_INIT 8 | 9 | AC_MSG_CHECKING([whether to build example programs]) 10 | AC_ARG_ENABLE([demos], AC_HELP_STRING([--enable-demos], [build example programs])) 11 | AM_CONDITIONAL([COND_DEMOS], [test "$enable_demos" = yes]) 12 | if test "$enable_demos" = yes 13 | then 14 | AC_MSG_RESULT([yes]) 15 | else 16 | AC_MSG_RESULT([no]) 17 | fi 18 | 19 | case "${host}" in 20 | *-mingw* | mingw*) 21 | WIN32="yes" 22 | ;; 23 | *) 24 | ;; 25 | esac 26 | AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"]) 27 | 28 | 29 | AC_SUBST([HAVE_UNISTD_H], [0]) 30 | AC_CHECK_HEADER([unistd.h], [HAVE_UNISTD_H=1], []) 31 | AC_CONFIG_FILES([Makefile minizip.pc]) 32 | AC_OUTPUT 33 | -------------------------------------------------------------------------------- /src/third_party/minizip/iowin32.h: -------------------------------------------------------------------------------- 1 | /* iowin32.h -- IO base function header for compress/uncompress .zip 2 | Version 1.1, February 14h, 2010 3 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 4 | 5 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 6 | 7 | Modifications for Zip64 support 8 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 9 | 10 | For more info read MiniZip_info.txt 11 | 12 | */ 13 | 14 | #include 15 | 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 22 | void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def)); 23 | void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def)); 24 | void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def)); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | -------------------------------------------------------------------------------- /src/third_party/minizip/make_vms.com: -------------------------------------------------------------------------------- 1 | $ if f$search("ioapi.h_orig") .eqs. "" then copy ioapi.h ioapi.h_orig 2 | $ open/write zdef vmsdefs.h 3 | $ copy sys$input: zdef 4 | $ deck 5 | #define unix 6 | #define fill_zlib_filefunc64_32_def_from_filefunc32 fillzffunc64from 7 | #define Write_Zip64EndOfCentralDirectoryLocator Write_Zip64EoDLocator 8 | #define Write_Zip64EndOfCentralDirectoryRecord Write_Zip64EoDRecord 9 | #define Write_EndOfCentralDirectoryRecord Write_EoDRecord 10 | $ eod 11 | $ close zdef 12 | $ copy vmsdefs.h,ioapi.h_orig ioapi.h 13 | $ cc/include=[--]/prefix=all ioapi.c 14 | $ cc/include=[--]/prefix=all miniunz.c 15 | $ cc/include=[--]/prefix=all unzip.c 16 | $ cc/include=[--]/prefix=all minizip.c 17 | $ cc/include=[--]/prefix=all zip.c 18 | $ link miniunz,unzip,ioapi,[--]libz.olb/lib 19 | $ link minizip,zip,ioapi,[--]libz.olb/lib 20 | $ mcr []minizip test minizip_info.txt 21 | $ mcr []miniunz -l test.zip 22 | $ rename minizip_info.txt; minizip_info.txt_old 23 | $ mcr []miniunz test.zip 24 | $ delete test.zip;* 25 | $exit 26 | -------------------------------------------------------------------------------- /src/third_party/minizip/minizip.1: -------------------------------------------------------------------------------- 1 | .\" Hey, EMACS: -*- nroff -*- 2 | .TH minizip 1 "May 2, 2001" 3 | .\" Please adjust this date whenever revising the manpage. 4 | .\" 5 | .\" Some roff macros, for reference: 6 | .\" .nh disable hyphenation 7 | .\" .hy enable hyphenation 8 | .\" .ad l left justify 9 | .\" .ad b justify to both left and right margins 10 | .\" .nf disable filling 11 | .\" .fi enable filling 12 | .\" .br insert line break 13 | .\" .sp insert n+1 empty lines 14 | .\" for manpage-specific macros, see man(7) 15 | .SH NAME 16 | minizip - create ZIP archives 17 | .SH SYNOPSIS 18 | .B minizip 19 | .RI [ -o ] 20 | zipfile [ " files" ... ] 21 | .SH DESCRIPTION 22 | .B minizip 23 | is a simple tool which allows the creation of compressed file archives 24 | in the ZIP format used by the MS-DOS utility PKZIP. It was written as 25 | a demonstration of the 26 | .IR zlib (3) 27 | library and therefore lack many of the features of the 28 | .IR zip (1) 29 | program. 30 | .SH OPTIONS 31 | The first argument supplied is the name of the ZIP archive to create or 32 | .RI -o 33 | in which case it is ignored and the second argument treated as the 34 | name of the ZIP file. If the ZIP file already exists it will be 35 | overwritten. 36 | .PP 37 | Subsequent arguments specify a list of files to place in the ZIP 38 | archive. If none are specified then an empty archive will be created. 39 | .SH SEE ALSO 40 | .BR miniunzip (1), 41 | .BR zlib (3), 42 | .BR zip (1). 43 | .SH AUTHOR 44 | This program was written by Gilles Vollant. This manual page was 45 | written by Mark Brown . 46 | 47 | -------------------------------------------------------------------------------- /src/third_party/minizip/minizip.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@/minizip 5 | 6 | Name: minizip 7 | Description: Minizip zip file manipulation library 8 | Requires: 9 | Version: @PACKAGE_VERSION@ 10 | Libs: -L${libdir} -lminizip 11 | Libs.private: -lz 12 | Cflags: -I${includedir} 13 | -------------------------------------------------------------------------------- /src/third_party/minizip/mztools.h: -------------------------------------------------------------------------------- 1 | /* 2 | Additional tools for Minizip 3 | Code: Xavier Roche '2004 4 | License: Same as ZLIB (www.gzip.org) 5 | */ 6 | 7 | #ifndef _zip_tools_H 8 | #define _zip_tools_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #ifndef _ZLIB_H 15 | #include "zlib.h" 16 | #endif 17 | 18 | #include "unzip.h" 19 | 20 | /* Repair a ZIP file (missing central directory) 21 | file: file to recover 22 | fileOut: output file after recovery 23 | fileOutTmp: temporary file name used for recovery 24 | */ 25 | extern int ZEXPORT unzRepair(const char* file, 26 | const char* fileOut, 27 | const char* fileOutTmp, 28 | uLong* nRecovered, 29 | uLong* bytesRecovered); 30 | 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/third_party/mt19937_64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB SOURCES *.hpp) 2 | 3 | source_group("Source Files\\" REGULAR_EXPRESSION ".*\\.c(pp)?") 4 | source_group("Header Files\\" REGULAR_EXPRESSION ".*\\.h(pp)?") 5 | 6 | add_custom_target(mt19937_64 ${SOURCES}) 7 | set_target_properties(mt19937_64 PROPERTIES 8 | FOLDER "Driver/Dependencies") 9 | -------------------------------------------------------------------------------- /src/third_party/rapidjson/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB RAPIDJSON_HEADER_FILES rapidjson/*.h) 2 | file(GLOB RAPIDJSON_ERROR_HEADER_FILES rapidjson/error/*.h) 3 | file(GLOB RAPIDJSON_INTERNAL_HEADER_FILES rapidjson/internal/*.h) 4 | file(GLOB RAPIDJSON_MSIINTTYPES_HEADER_FILES rapidjson/msiinttypes/*.h) 5 | 6 | set(SOURCES 7 | ${RAPIDJSON_HEADER_FILES} 8 | ${RAPIDJSON_ERROR_HEADER_FILES} 9 | ${RAPIDJSON_INTERNAL_HEADER_FILES} 10 | ${RAPIDJSON_MSIINTTYPES_HEADER_FILES}) 11 | 12 | source_group("Header Files\\" FILES ${RAPIDJSON_HEADER_FILES}) 13 | source_group("Header Files\\error" FILES ${RAPIDJSON_ERROR_HEADER_FILES}) 14 | source_group("Header Files\\internal" FILES ${RAPIDJSON_INTERNAL_HEADER_FILES}) 15 | source_group("Header Files\\msiinttypes" FILES ${RAPIDJSON_MSIINTTYPES_HEADER_FILES}) 16 | 17 | add_custom_target(rapidjson ${SOURCES}) 18 | set_target_properties(rapidjson PROPERTIES 19 | FOLDER "Driver/Dependencies") 20 | -------------------------------------------------------------------------------- /src/third_party/rapidjson/README: -------------------------------------------------------------------------------- 1 | SHA: 67fac85e96220f69076121d569abd15471abb6bf 2 | URL: https://github.com/Tencent/rapidjson/tree/67fac85e96220f69076121d569abd15471abb6bf 3 | Commit Date: 2018/10/08 4 | 5 | git clone https://github.com/miloyip/rapidjson.git /tmp/rapidjson 6 | cp -R /tmp/rapidjson/include/rapidjson /tmp/rapidjson/license.txt . 7 | -------------------------------------------------------------------------------- /src/third_party/rapidjson/rapidjson/internal/swap.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making RapidJSON available. 2 | // 3 | // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. 4 | // 5 | // Licensed under the MIT License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // http://opensource.org/licenses/MIT 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef RAPIDJSON_INTERNAL_SWAP_H_ 16 | #define RAPIDJSON_INTERNAL_SWAP_H_ 17 | 18 | #include "../rapidjson.h" 19 | 20 | #if defined(__clang__) 21 | RAPIDJSON_DIAG_PUSH 22 | RAPIDJSON_DIAG_OFF(c++98-compat) 23 | #endif 24 | 25 | RAPIDJSON_NAMESPACE_BEGIN 26 | namespace internal { 27 | 28 | //! Custom swap() to avoid dependency on C++ header 29 | /*! \tparam T Type of the arguments to swap, should be instantiated with primitive C++ types only. 30 | \note This has the same semantics as std::swap(). 31 | */ 32 | template 33 | inline void Swap(T& a, T& b) RAPIDJSON_NOEXCEPT { 34 | T tmp = a; 35 | a = b; 36 | b = tmp; 37 | } 38 | 39 | } // namespace internal 40 | RAPIDJSON_NAMESPACE_END 41 | 42 | #if defined(__clang__) 43 | RAPIDJSON_DIAG_POP 44 | #endif 45 | 46 | #endif // RAPIDJSON_INTERNAL_SWAP_H_ 47 | -------------------------------------------------------------------------------- /src/third_party/sparsehash/AUTHORS: -------------------------------------------------------------------------------- 1 | google-sparsehash@googlegroups.com 2 | 3 | -------------------------------------------------------------------------------- /src/third_party/sparsehash/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2005, Google Inc. 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 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /src/third_party/sparsehash/config.h.cmake: -------------------------------------------------------------------------------- 1 | #cmakedefine HASH_FUN_H <@HASH_FUN_H@> 2 | 3 | /* the namespace of the hash<> function */ 4 | #cmakedefine HASH_NAMESPACE @HASH_NAMESPACE@ 5 | 6 | #cmakedefine HASH_NAME @HASH_NAME@ 7 | 8 | /* Define to 1 if you have the header file. */ 9 | #cmakedefine HAVE_INTTYPES_H 1 10 | 11 | /* Define to 1 if you have the header file. */ 12 | #cmakedefine HAVE_STDINT_H 1 13 | 14 | /* Define to 1 if you have the header file. */ 15 | #cmakedefine HAVE_SYS_TYPES_H 1 16 | 17 | /* Define to 1 if the system has the type `long long'. */ 18 | #cmakedefine HAVE_LONG_LONG 1 19 | 20 | /* Define to 1 if you have the `memcpy' function. */ 21 | #cmakedefine HAVE_MEMCPY 1 22 | 23 | /* Define to 1 if the system has the type `uint16_t'. */ 24 | #cmakedefine HAVE_UINT16_T 1 25 | 26 | /* Define to 1 if the system has the type `u_int16_t'. */ 27 | #cmakedefine HAVE_U_INT16_T 1 28 | 29 | /* Define to 1 if the system has the type `__uint16'. */ 30 | #cmakedefine HAVE___UINT16 1 31 | 32 | /* The system-provided hash function including the namespace. */ 33 | #define SPARSEHASH_HASH HASH_NAMESPACE::HASH_NAME 34 | 35 | /* The system-provided hash function, in namespace HASH_NAMESPACE. */ 36 | #define SPARSEHASH_HASH_NO_NAMESPACE HASH_NAME 37 | 38 | /* Namespace for Google classes */ 39 | #define GOOGLE_NAMESPACE ::sparsehash 40 | 41 | /* Stops putting the code inside the Google namespace */ 42 | #define _END_GOOGLE_NAMESPACE_ } 43 | 44 | /* Puts following code inside the Google namespace */ 45 | #define _START_GOOGLE_NAMESPACE_ namespace sparsehash { 46 | -------------------------------------------------------------------------------- /src/timer.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_TIMER_HPP 18 | #define DATASTAX_INTERNAL_TIMER_HPP 19 | 20 | #include "allocated.hpp" 21 | #include "callback.hpp" 22 | #include "macros.hpp" 23 | 24 | #include 25 | 26 | namespace datastax { namespace internal { namespace core { 27 | 28 | class Timer { 29 | public: 30 | typedef internal::Callback Callback; 31 | 32 | Timer(); 33 | ~Timer(); 34 | 35 | int start(uv_loop_t* loop, uint64_t timeout, const Callback& callback); 36 | void stop(); 37 | 38 | public: 39 | bool is_running() const { return state_ == STARTED; } 40 | uv_loop_t* loop() { return handle_ ? handle_->loop : NULL; } 41 | 42 | private: 43 | static void on_timeout(uv_timer_t* handle); 44 | void handle_timeout(); 45 | 46 | static void on_close(uv_handle_t* handle); 47 | 48 | private: 49 | enum State { CLOSED, STOPPED, STARTED }; 50 | 51 | private: 52 | AllocatedT* handle_; 53 | State state_; 54 | Callback callback_; 55 | 56 | private: 57 | DISALLOW_COPY_AND_ASSIGN(Timer); 58 | }; 59 | 60 | }}} // namespace datastax::internal::core 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/token_map.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "token_map.hpp" 18 | 19 | #include "token_map_impl.hpp" 20 | 21 | using namespace datastax; 22 | using namespace datastax::internal::core; 23 | 24 | TokenMap::Ptr TokenMap::from_partitioner(StringRef partitioner) { 25 | if (ends_with(partitioner, Murmur3Partitioner::name())) { 26 | return Ptr(new TokenMapImpl()); 27 | } else if (ends_with(partitioner, RandomPartitioner::name())) { 28 | return Ptr(new TokenMapImpl()); 29 | } else if (ends_with(partitioner, ByteOrderedPartitioner::name())) { 30 | return Ptr(new TokenMapImpl()); 31 | } else { 32 | LOG_WARN("Unsupported partitioner class '%s'", partitioner.to_string().c_str()); 33 | return Ptr(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/user_type_field_iterator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "user_type_field_iterator.hpp" 18 | 19 | #include "serialization.hpp" 20 | 21 | using namespace datastax::internal::core; 22 | 23 | bool UserTypeFieldIterator::next() { 24 | if (next_ == end_) { 25 | return false; 26 | } 27 | current_ = next_++; 28 | value_ = decoder_.decode_value(current_->type); 29 | return value_.is_valid(); 30 | } 31 | -------------------------------------------------------------------------------- /src/user_type_value.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_USER_TYPE_VALUE_HPP 18 | #define DATASTAX_INTERNAL_USER_TYPE_VALUE_HPP 19 | 20 | #include "abstract_data.hpp" 21 | #include "cassandra.h" 22 | #include "data_type.hpp" 23 | #include "external.hpp" 24 | #include "ref_counted.hpp" 25 | 26 | namespace datastax { namespace internal { namespace core { 27 | 28 | class UserTypeValue : public AbstractData { 29 | public: 30 | UserTypeValue(const UserType::ConstPtr& data_type) 31 | : AbstractData(data_type->fields().size()) 32 | , data_type_(data_type) {} 33 | 34 | const UserType::ConstPtr& data_type() const { return data_type_; } 35 | 36 | protected: 37 | virtual size_t get_indices(StringRef name, IndexVec* indices) { 38 | return data_type_->get_indices(name, indices); 39 | } 40 | 41 | virtual const DataType::ConstPtr& get_type(size_t index) const { 42 | return data_type_->fields()[index].type; 43 | } 44 | 45 | private: 46 | UserType::ConstPtr data_type_; 47 | 48 | private: 49 | DISALLOW_COPY_AND_ASSIGN(UserTypeValue); 50 | }; 51 | 52 | }}} // namespace datastax::internal::core 53 | 54 | EXTERNAL_TYPE(datastax::internal::core::UserTypeValue, CassUserType) 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/uuids.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_UUIDS_HPP 18 | #define DATASTAX_INTERNAL_UUIDS_HPP 19 | 20 | #include "allocated.hpp" 21 | #include "atomic.hpp" 22 | #include "cassandra.h" 23 | #include "external.hpp" 24 | #include "random.hpp" 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace datastax { namespace internal { namespace core { 31 | 32 | class UuidGen : public Allocated { 33 | public: 34 | UuidGen(); 35 | UuidGen(uint64_t node); 36 | ~UuidGen(); 37 | 38 | void generate_time(CassUuid* output); 39 | void from_time(uint64_t timestamp, CassUuid* output); 40 | void generate_random(CassUuid* output); 41 | 42 | private: 43 | void set_clock_seq_and_node(uint64_t node); 44 | uint64_t monotonic_timestamp(); 45 | 46 | uint64_t clock_seq_and_node_; 47 | Atomic last_timestamp_; 48 | 49 | uv_mutex_t mutex_; 50 | MT19937_64 ng_; 51 | }; 52 | 53 | }}} // namespace datastax::internal::core 54 | 55 | EXTERNAL_TYPE(datastax::internal::core::UuidGen, CassUuidGen) 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/vector.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_VECTOR_HPP 18 | #define DATASTAX_INTERNAL_VECTOR_HPP 19 | 20 | #include "allocated.hpp" 21 | #include "allocator.hpp" 22 | 23 | #include 24 | 25 | namespace datastax { namespace internal { 26 | 27 | template 28 | class Vector 29 | : public Allocated 30 | , public std::vector > { 31 | public: 32 | typedef internal::Allocator Allocator; 33 | 34 | explicit Vector(const Allocator& alloc = Allocator()) 35 | : std::vector(alloc) {} 36 | 37 | explicit Vector(size_t count, const T& value = T()) 38 | : std::vector(count, value) {} 39 | 40 | template 41 | Vector(InputIt first, InputIt last) 42 | : std::vector(first, last) {} 43 | }; 44 | 45 | }} // namespace datastax::internal 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/whitelist_dc_policy.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "whitelist_dc_policy.hpp" 18 | 19 | using namespace datastax::internal::core; 20 | 21 | bool WhitelistDCPolicy::is_valid_host(const Host::Ptr& host) const { 22 | const String& host_dc = host->dc(); 23 | for (DcList::const_iterator it = dcs_.begin(), end = dcs_.end(); it != end; ++it) { 24 | if (host_dc.compare(*it) == 0) { 25 | return true; 26 | } 27 | } 28 | return false; 29 | } 30 | -------------------------------------------------------------------------------- /src/whitelist_dc_policy.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_WHITELIST_DC_POLICY_HPP 18 | #define DATASTAX_INTERNAL_WHITELIST_DC_POLICY_HPP 19 | 20 | #include "host.hpp" 21 | #include "list_policy.hpp" 22 | #include "load_balancing.hpp" 23 | #include "scoped_ptr.hpp" 24 | 25 | namespace datastax { namespace internal { namespace core { 26 | 27 | class WhitelistDCPolicy : public ListPolicy { 28 | public: 29 | WhitelistDCPolicy(LoadBalancingPolicy* child_policy, const DcList& dcs) 30 | : ListPolicy(child_policy) 31 | , dcs_(dcs) {} 32 | 33 | virtual ~WhitelistDCPolicy() {} 34 | 35 | WhitelistDCPolicy* new_instance() { 36 | return new WhitelistDCPolicy(child_policy_->new_instance(), dcs_); 37 | } 38 | 39 | private: 40 | bool is_valid_host(const Host::Ptr& host) const; 41 | 42 | DcList dcs_; 43 | 44 | private: 45 | DISALLOW_COPY_AND_ASSIGN(WhitelistDCPolicy); 46 | }; 47 | 48 | }}} // namespace datastax::internal::core 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/whitelist_policy.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "whitelist_policy.hpp" 18 | 19 | using namespace datastax::internal::core; 20 | 21 | bool WhitelistPolicy::is_valid_host(const Host::Ptr& host) const { 22 | const String& host_address = host->address().hostname_or_address(); 23 | for (ContactPointList::const_iterator it = hosts_.begin(), end = hosts_.end(); it != end; ++it) { 24 | if (host_address.compare(*it) == 0) { 25 | return true; 26 | } 27 | } 28 | return false; 29 | } 30 | -------------------------------------------------------------------------------- /src/whitelist_policy.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DATASTAX_INTERNAL_WHITELIST_POLICY_HPP 18 | #define DATASTAX_INTERNAL_WHITELIST_POLICY_HPP 19 | 20 | #include "host.hpp" 21 | #include "list_policy.hpp" 22 | #include "load_balancing.hpp" 23 | #include "scoped_ptr.hpp" 24 | 25 | namespace datastax { namespace internal { namespace core { 26 | 27 | class WhitelistPolicy : public ListPolicy { 28 | public: 29 | WhitelistPolicy(LoadBalancingPolicy* child_policy, const ContactPointList& hosts) 30 | : ListPolicy(child_policy) 31 | , hosts_(hosts) {} 32 | 33 | virtual ~WhitelistPolicy() {} 34 | 35 | WhitelistPolicy* new_instance() { 36 | return new WhitelistPolicy(child_policy_->new_instance(), hosts_); 37 | } 38 | 39 | private: 40 | bool is_valid_host(const Host::Ptr& host) const; 41 | 42 | ContactPointList hosts_; 43 | 44 | private: 45 | DISALLOW_COPY_AND_ASSIGN(WhitelistPolicy); 46 | }; 47 | 48 | }}} // namespace datastax::internal::core 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/wktgen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ragel -o wkt.cpp wkt.rl 3 | -------------------------------------------------------------------------------- /tests/embedded-ads.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scylladb/cpp-driver/5909fefba1a6aa28ba1bb22ad92de839b34bd028/tests/embedded-ads.jar -------------------------------------------------------------------------------- /tests/src/integration/ccm/bridge_exception.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef __CCM_BRIDGE_EXCEPTION_HPP__ 18 | #define __CCM_BRIDGE_EXCEPTION_HPP__ 19 | 20 | #include 21 | #include 22 | 23 | namespace CCM { 24 | 25 | /** 26 | * Exception mechanism for the CCM bridge class 27 | */ 28 | class BridgeException : public std::exception { 29 | public: 30 | #ifdef _WIN32 31 | /** 32 | * CCM bridge exception class 33 | * 34 | * @param message BridgeException message 35 | */ 36 | BridgeException(const std::string& message) 37 | : std::exception(message.c_str()) {} 38 | #else 39 | /** 40 | * CCM bridge exception class 41 | * 42 | * @param message Exception message 43 | */ 44 | BridgeException(const std::string& message) 45 | : message_(message) {} 46 | /** 47 | * Destructor 48 | */ 49 | ~BridgeException() throw() {} 50 | 51 | /** 52 | * Get the exception message 53 | * 54 | * @return Exception message 55 | */ 56 | const char* what() const throw() { return message_.c_str(); } 57 | 58 | private: 59 | /** 60 | * Message to display for exception 61 | */ 62 | std::string message_; 63 | #endif 64 | }; 65 | 66 | } // namespace CCM 67 | 68 | #endif // __CCM_BRIDGE_EXCEPTION_HPP__ 69 | -------------------------------------------------------------------------------- /tests/src/integration/ccm/socket_exception.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef __SOCKET_EXCEPTION_HPP__ 18 | #define __SOCKET_EXCEPTION_HPP__ 19 | 20 | #include 21 | #include 22 | 23 | /** 24 | * Exception mechanism for the socket class 25 | */ 26 | class SocketException : public std::exception { 27 | public: 28 | #ifdef _WIN32 29 | /** 30 | * Socket exception class 31 | * 32 | * @param message SocketException message 33 | */ 34 | SocketException(const std::string& message) 35 | : std::exception(message.c_str()) {} 36 | #else 37 | /** 38 | * Socket exception class 39 | * 40 | * @param message Exception message 41 | */ 42 | SocketException(const std::string& message) 43 | : message_(message) {} 44 | /** 45 | * Destructor 46 | */ 47 | ~SocketException() throw() {} 48 | 49 | /** 50 | * Get the exception message 51 | * 52 | * @return Exception message 53 | */ 54 | const char* what() const throw() { return message_.c_str(); } 55 | 56 | private: 57 | /** 58 | * Message to display for exception 59 | */ 60 | std::string message_; 61 | #endif 62 | }; 63 | 64 | #endif // __SOCKET_EXCEPTION_HPP__ 65 | -------------------------------------------------------------------------------- /tests/src/integration/dse_integration.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "dse_integration.hpp" 18 | 19 | DseIntegration::DseIntegration() 20 | : Integration() 21 | , dse_session_() {} 22 | 23 | void DseIntegration::SetUp() { 24 | // Call the parent setup class 25 | Integration::SetUp(); 26 | 27 | // Create the DSE session object from the Cassandra session object 28 | dse_session_ = session_; 29 | } 30 | 31 | void DseIntegration::connect(dse::Cluster cluster) { 32 | // Call the parent connect function 33 | Integration::connect(cluster); 34 | dse_session_ = session_; 35 | } 36 | 37 | void DseIntegration::connect() { 38 | // Create the cluster configuration and establish the session connection 39 | cluster_ = default_cluster(); 40 | dse_cluster_ = cluster_; 41 | connect(dse_cluster_); 42 | } 43 | 44 | Cluster DseIntegration::default_cluster(bool is_with_default_contact_points) { 45 | Cluster cluster = dse::Cluster::build() 46 | .with_randomized_contact_points(is_randomized_contact_points_) 47 | .with_schema_metadata(is_schema_metadata_); 48 | if (is_with_default_contact_points) { 49 | cluster.with_contact_points(contact_points_); 50 | } 51 | return cluster; 52 | } 53 | -------------------------------------------------------------------------------- /tests/src/integration/dse_objects.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef __DSE_OBJECTS_HPP__ 18 | #define __DSE_OBJECTS_HPP__ 19 | #include "dse.h" 20 | 21 | #include "objects.hpp" 22 | #include "objects/dse_cluster.hpp" 23 | #include "objects/dse_session.hpp" 24 | #include "objects/dse_statement.hpp" 25 | 26 | #endif // __DSE_OBJECTS_HPP__ 27 | -------------------------------------------------------------------------------- /tests/src/integration/dse_values.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef __TEST_DSE_VALUES_HPP__ 18 | #define __TEST_DSE_VALUES_HPP__ 19 | 20 | #include "values.hpp" 21 | #include "values/dse_date_range.hpp" 22 | #include "values/dse_line_string.hpp" 23 | #include "values/dse_point.hpp" 24 | #include "values/dse_polygon.hpp" 25 | 26 | namespace test { namespace driver { namespace dse { 27 | 28 | typedef NullableValue DateRange; 29 | typedef NullableValue LineString; 30 | typedef NullableValue Point; 31 | typedef NullableValue Polygon; 32 | 33 | }}} // namespace test::driver::dse 34 | 35 | #endif // __DRIVER_VALUE_DSE_VALUES_HPP__ 36 | -------------------------------------------------------------------------------- /tests/src/integration/embedded_ads.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "embedded_ads.hpp" 18 | 19 | namespace test { 20 | 21 | // Initialize static variables 22 | uv_process_t EmbeddedADS::process_; 23 | uv_mutex_t EmbeddedADS::mutex_; 24 | std::string EmbeddedADS::configuration_directory_ = ""; 25 | std::string EmbeddedADS::configuration_file_ = ""; 26 | std::string EmbeddedADS::cassandra_keytab_file_ = ""; 27 | std::string EmbeddedADS::dse_keytab_file_ = ""; 28 | std::string EmbeddedADS::dseuser_keytab_file_ = ""; 29 | std::string EmbeddedADS::unknown_keytab_file_ = ""; 30 | std::string EmbeddedADS::bob_keytab_file_ = ""; 31 | std::string EmbeddedADS::bill_keytab_file_ = ""; 32 | std::string EmbeddedADS::charlie_keytab_file_ = ""; 33 | std::string EmbeddedADS::steve_keytab_file_ = ""; 34 | bool EmbeddedADS::is_initialized_ = false; 35 | 36 | } // namespace test 37 | -------------------------------------------------------------------------------- /tests/src/integration/objects.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef __TEST_OBJECTS_HPP__ 18 | #define __TEST_OBJECTS_HPP__ 19 | #include "cassandra.h" 20 | 21 | #include "objects/cluster.hpp" 22 | #include "objects/collection.hpp" 23 | #include "objects/custom_payload.hpp" 24 | #include "objects/future.hpp" 25 | #include "objects/iterator.hpp" 26 | #include "objects/prepared.hpp" 27 | #include "objects/result.hpp" 28 | #include "objects/retry_policy.hpp" 29 | #include "objects/session.hpp" 30 | #include "objects/ssl.hpp" 31 | #include "objects/statement.hpp" 32 | #include "objects/timestamp_generator.hpp" 33 | #include "objects/tuple.hpp" 34 | #include "objects/user_type.hpp" 35 | #include "objects/uuid_gen.hpp" 36 | 37 | #endif // __TEST_OBJECTS_HPP__ 38 | -------------------------------------------------------------------------------- /tests/src/integration/objects/iterator.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef __TEST_ITERATOR_HPP__ 18 | #define __TEST_ITERATOR_HPP__ 19 | #include "cassandra.h" 20 | 21 | #include "objects/object_base.hpp" 22 | 23 | #include 24 | 25 | namespace test { namespace driver { 26 | 27 | class Iterator : public Object { 28 | public: 29 | /** 30 | * Create the empty iterator object 31 | */ 32 | Iterator() 33 | : Object() {} 34 | 35 | /** 36 | * Create the iterator object from the native driver object 37 | * 38 | * @param iterator Native driver object 39 | */ 40 | Iterator(CassIterator* iterator) 41 | : Object(iterator) {} 42 | 43 | /** 44 | * Create the future object from a shared reference 45 | * 46 | * @param future Shared reference 47 | */ 48 | Iterator(Ptr iterator) 49 | : Object(iterator) {} 50 | }; 51 | 52 | }} // namespace test::driver 53 | 54 | #endif // __TEST_ITERATOR_HPP__ 55 | -------------------------------------------------------------------------------- /tests/src/integration/objects/retry_policy.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "retry_policy.hpp" 18 | 19 | using namespace test::driver; 20 | 21 | DowngradingConsistencyRetryPolicy::DowngradingConsistencyRetryPolicy() 22 | : RetryPolicy(cass_retry_policy_downgrading_consistency_new()) {} 23 | -------------------------------------------------------------------------------- /tests/src/integration/objects/statement.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "statement.hpp" 18 | 19 | #include "objects/custom_payload.hpp" 20 | #include "objects/result.hpp" 21 | 22 | void test::driver::Statement::set_custom_payload(CustomPayload custom_payload) { 23 | ASSERT_EQ(CASS_OK, cass_statement_set_custom_payload(get(), custom_payload.get())); 24 | } 25 | 26 | void test::driver::Statement::set_paging_state(const test::driver::Result& result) { 27 | ASSERT_EQ(CASS_OK, cass_statement_set_paging_state(get(), result.get())); 28 | } 29 | -------------------------------------------------------------------------------- /tests/src/integration/policies.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef __TEST_POLICIES_HPP__ 18 | #define __TEST_POLICIES_HPP__ 19 | 20 | #include "policies/ignore_retry_policy.hpp" 21 | #include "policies/next_host_retry_policy.hpp" 22 | 23 | #endif // __TEST_POLICIES_HPP__ 24 | -------------------------------------------------------------------------------- /tests/src/integration/pretty_print.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef __PRETTY_PRINT_HPP__ 18 | #define __PRETTY_PRINT_HPP__ 19 | #include "cassandra.h" 20 | 21 | #include 22 | 23 | /********************************************************* 24 | * Teach Google test how to print values from the driver * 25 | ********************************************************/ 26 | 27 | /** 28 | * Pretty print CassConsistency values 29 | * 30 | * @param consistency CassConsistency value to pretty print 31 | * @param output_stream Output stream to pretty print value to 32 | */ 33 | void PrintTo(CassConsistency consistency, std::ostream* output_stream); 34 | 35 | /** 36 | * Pretty print CassError values 37 | * 38 | * @param error_code CassError value to pretty print 39 | * @param output_stream Output stream to pretty print value to 40 | */ 41 | void PrintTo(CassError error_code, std::ostream* output_stream); 42 | 43 | /** 44 | * Pretty print CassValueType values 45 | * 46 | * @param value_type CassValueType value to pretty print 47 | * @param output_stream Output stream to pretty print value to 48 | */ 49 | void PrintTo(CassValueType value_type, std::ostream* output_stream); 50 | 51 | #endif // __PRETTY_PRINT_HPP__ 52 | -------------------------------------------------------------------------------- /tests/src/integration/strptime.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef __STRPTIME_HPP__ 18 | #define __STRPTIME_HPP__ 19 | 20 | #include 21 | 22 | namespace test { 23 | 24 | /** 25 | * strptime() is not available on all platforms. This implementation is from musl libc. 26 | * 27 | * @param s The string to be parsed 28 | * @param f The format of the string 29 | * @param tm The resulting time struct 30 | * @return NULL if an error occurred 31 | */ 32 | char* strptime(const char* s, const char* f, struct tm* tm); 33 | 34 | } // namespace test 35 | 36 | #endif // __STRPTIME_HPP__ 37 | -------------------------------------------------------------------------------- /tests/src/integration/tests/test_logging.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "integration.hpp" 18 | 19 | class LoggingTests : public Integration { 20 | public: 21 | LoggingTests() { is_ccm_requested_ = false; } 22 | 23 | static void log(const CassLogMessage* log, void* data) { 24 | bool* is_triggered = static_cast(data); 25 | *is_triggered = true; 26 | } 27 | }; 28 | 29 | /** 30 | * Ensure the driver is calling the client logging callback 31 | */ 32 | CASSANDRA_INTEGRATION_TEST_F(LoggingTests, Callback) { 33 | CHECK_FAILURE; 34 | 35 | bool is_triggered = false; 36 | cass_log_set_callback(LoggingTests::log, &is_triggered); 37 | default_cluster().connect("", false); 38 | EXPECT_TRUE(is_triggered); 39 | } -------------------------------------------------------------------------------- /tests/src/integration/tests/test_schema_agreement.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "atomic.hpp" 18 | #include "integration.hpp" 19 | 20 | /** 21 | * Schema changes should wait for the schema to propagate before returning. 22 | */ 23 | class SchemaAgreementTests : public Integration { 24 | public: 25 | SchemaAgreementTests() { number_dc1_nodes_ = 3; } 26 | }; 27 | 28 | CASSANDRA_INTEGRATION_TEST_F(SchemaAgreementTests, Simple) { 29 | CHECK_FAILURE; 30 | 31 | logger_.add_critera("Found schema agreement in"); 32 | 33 | session_.execute( 34 | format_string(CASSANDRA_KEY_VALUE_TABLE_FORMAT, table_name_.c_str(), "int", "int")); 35 | 36 | EXPECT_EQ(1u, logger_.count()); 37 | } 38 | -------------------------------------------------------------------------------- /tests/src/integration/tests/test_tracing.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "integration.hpp" 18 | 19 | class TracingTests : public Integration {}; 20 | 21 | CASSANDRA_INTEGRATION_TEST_F(TracingTests, Simple) { 22 | CHECK_FAILURE; 23 | 24 | Uuid tracing_id; 25 | 26 | { // Get tracing ID. 27 | Statement statement("SELECT release_version FROM system.local"); 28 | statement.set_tracing(true); 29 | Result result = session_.execute(statement); 30 | tracing_id = result.tracing_id(); 31 | ASSERT_FALSE(tracing_id.is_null()); 32 | } 33 | 34 | { // Validate tracing ID by attempting to get the associated tracing data. 35 | Statement statement("SELECT * FROM system_traces.sessions WHERE session_id = ?", 1); 36 | statement.bind(0, tracing_id); 37 | Result result = session_.execute(statement); 38 | ASSERT_GT(result.row_count(), 0u); 39 | Uuid session_id = result.first_row().column_by_name("session_id"); 40 | ASSERT_FALSE(session_id.is_null()); 41 | EXPECT_EQ(tracing_id, session_id); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tests/src/integration/tlog.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef __TLOG_HPP__ 18 | #define __TLOG_HPP__ 19 | 20 | #include "options.hpp" 21 | 22 | // Create simple console logging functions 23 | #define TEST_LOG_MESSAGE(message, is_output) \ 24 | if (is_output) { \ 25 | std::cerr << "test> " << message << std::endl; \ 26 | } 27 | #define TEST_LOG(message) TEST_LOG_MESSAGE(message, Options::is_verbose_integration()) 28 | #define TEST_LOG_ERROR(message) TEST_LOG_MESSAGE(message, true) 29 | 30 | #endif // __TLOG_HPP__ 31 | -------------------------------------------------------------------------------- /tests/src/unit/tests/test_copy_on_write.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include "copy_on_write_ptr.hpp" 20 | #include "map.hpp" 21 | #include "ref_counted.hpp" 22 | #include "string.hpp" 23 | #include "vector.hpp" 24 | 25 | using namespace datastax::internal; 26 | using namespace datastax::internal::core; 27 | 28 | TEST(CopyOnWriteUnitTest, Simple) { 29 | Vector* ptr = new Vector(); 30 | CopyOnWritePtr > vec(ptr); 31 | 32 | // Only a single reference so no copy should be made 33 | EXPECT_EQ(static_cast >&>(vec).operator->(), ptr); 34 | vec->push_back(1); 35 | EXPECT_EQ(static_cast >&>(vec).operator->(), ptr); 36 | 37 | // Make const reference to object 38 | const CopyOnWritePtr > const_vec(vec); 39 | EXPECT_EQ((*const_vec)[0], 1); 40 | EXPECT_EQ(const_vec.operator->(), ptr); 41 | 42 | // Force copy to be made 43 | vec->push_back(2); 44 | EXPECT_NE(static_cast >&>(vec).operator->(), ptr); 45 | EXPECT_EQ(const_vec.operator->(), ptr); 46 | } 47 | -------------------------------------------------------------------------------- /tests/src/unit/tests/test_custom_allocator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include "dse.h" 20 | 21 | #include 22 | 23 | static int custom_malloc_count = 0; 24 | void* custom_malloc(size_t size) { 25 | custom_malloc_count++; 26 | return ::malloc(size); 27 | } 28 | 29 | void* custom_realloc(void* ptr, size_t size) { 30 | // It's nearly impossible to get a predictable count for realloc 31 | return ::realloc(ptr, size); 32 | } 33 | 34 | static int custom_free_count = 0; 35 | void custom_free(void* ptr) { 36 | custom_free_count++; 37 | return ::free(ptr); 38 | } 39 | 40 | TEST(CustomAllocatorUnitTest, ReplaceAllocator) { 41 | // Set custom allocation functions and make sure they're used 42 | cass_alloc_set_functions(custom_malloc, custom_realloc, custom_free); 43 | 44 | CassSession* session = cass_session_new(); 45 | cass_session_free(session); 46 | 47 | ASSERT_GE(custom_malloc_count, 0); 48 | ASSERT_GE(custom_free_count, 0); 49 | 50 | // Restore default functions 51 | custom_malloc_count = 0; 52 | custom_free_count = 0; 53 | cass_alloc_set_functions(NULL, NULL, NULL); 54 | 55 | ASSERT_EQ(custom_malloc_count, 0); 56 | ASSERT_EQ(custom_free_count, 0); 57 | } 58 | -------------------------------------------------------------------------------- /tests/src/unit/tests/test_get_time.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include "get_time.hpp" 20 | #include "test_utils.hpp" 21 | 22 | using datastax::internal::get_time_monotonic_ns; 23 | 24 | TEST(GetTimeUnitTest, Monotonic) { 25 | uint64_t prev = get_time_monotonic_ns(); 26 | for (int i = 0; i < 100; ++i) { 27 | uint64_t current = get_time_monotonic_ns(); 28 | EXPECT_GE(current, prev); 29 | prev = current; 30 | } 31 | } 32 | 33 | TEST(GetTimeUnitTest, MonotonicDuration) { 34 | uint64_t start = get_time_monotonic_ns(); 35 | 36 | test::Utils::msleep(1000); // 1 second 37 | uint64_t elapsed = get_time_monotonic_ns() - start; 38 | EXPECT_GE(elapsed, static_cast(NANOSECONDS_PER_SECOND)); 39 | EXPECT_LE(elapsed, static_cast(2 * NANOSECONDS_PER_SECOND)); 40 | } 41 | -------------------------------------------------------------------------------- /tests/src/unit/tests/test_small_vector.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) DataStax, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include "small_vector.hpp" 20 | 21 | using datastax::internal::SmallVector; 22 | 23 | TEST(SmallVectorUnitTest, Simple) { 24 | SmallVector vec; 25 | EXPECT_EQ(vec.fixed().data.address(), vec.data()); 26 | EXPECT_EQ(vec.fixed().is_used, true); 27 | 28 | for (int i = 0; i < 5; ++i) { 29 | vec.push_back(i); 30 | EXPECT_EQ(vec.fixed().data.address(), vec.data()); 31 | EXPECT_EQ(vec.fixed().is_used, true); 32 | } 33 | 34 | vec.push_back(5); 35 | EXPECT_NE(vec.fixed().data.address(), vec.data()); 36 | EXPECT_EQ(vec.fixed().is_used, false); 37 | } 38 | -------------------------------------------------------------------------------- /tests/src/vendor/gtest/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 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 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /tests/src/vendor/gtest/vendor.info: -------------------------------------------------------------------------------- 1 | SHA: d225acc90bc3a8c420a9bcd1f033033c1ccd7fe0 2 | URL: https://github.com/google/googletest/tree/d225acc 3 | Commit Date: 2016/03/16 4 | 5 | Source files were "fused" using the script available in the project repo 6 | 7 | googletest/scripts/fuse_gtest_files.py [GTEST_ROOT_DIR] OUTPUT_DIR 8 | -------------------------------------------------------------------------------- /tools/alloc-linter-tool/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | *.creator.user 3 | -------------------------------------------------------------------------------- /topics/client_configuration/README.md: -------------------------------------------------------------------------------- 1 | # Client Configuration 2 | 3 | Client configuration allows an application to provide additional metadata to 4 | the cluster which can be useful for troubleshooting and performing diagnostics. 5 | In addition to the optional application metadata the cluster will automatically 6 | be provided with the driver's name, driver's version, and a unique session 7 | identifier. 8 | 9 | ## Application Options (Optional) 10 | 11 | Application name and version metadata can be provided to the cluster during 12 | configuration. This information can be used to isolate specific applications on 13 | the server-side when troubleshooting or performing diagnostics on clusters that 14 | support multiple applications. 15 | 16 | ```c 17 | CassCluster* cluster = cass_cluster_new(); 18 | 19 | /* Assign a name for the application connecting to the cluster */ 20 | cass_cluster_set_application_name(cluster, "Application Name"); 21 | 22 | /* Assign a version for the application connecting to the cluster */ 23 | cass_cluster_set_application_version(cluster, "1.0.0"); 24 | 25 | /* ... */ 26 | 27 | cass_cluster_free(cluster); 28 | ``` 29 | 30 | ## Client Identification 31 | 32 | Each session is assigned a unique identifier (UUID) which can be used to 33 | identify specific client connections server-side. The identifier can also be 34 | retrieved client-side using the following function: 35 | 36 | ```c 37 | CassSession* session = cass_session_new(); 38 | 39 | /* Retrieve the session's unique identifier */ 40 | CassUuid client_id = cass_session_get_client_id(session); 41 | 42 | /* ... */ 43 | 44 | cass_session_free(session); 45 | ``` 46 | 47 | **Note**: A session's unique identifier is constant for its lifetime and does 48 | not change when re-establishing connection to a cluster. 49 | -------------------------------------------------------------------------------- /topics/cloud/README.md: -------------------------------------------------------------------------------- 1 | # Cloud 2 | 3 | ## Connecting to [DataStax Astra Database-as-a-Service] using a secure connection bundle 4 | 5 | Use the following code snippet to connect your database: 6 | 7 | ```c 8 | #include 9 | #include 10 | 11 | int main(int argc, char* argv[]) { 12 | /* Setup and connect to cluster */ 13 | CassCluster* cluster = cass_cluster_new(); 14 | CassSession* session = cass_session_new(); 15 | 16 | /* Setup driver to connect to the cloud using the secure connection bundle */ 17 | const char* secure_connect_bundle = "/path/to/secure-connect-database_name.zip"; 18 | if (cass_cluster_set_cloud_secure_connection_bundle(cluster, secure_connect_bundle) != CASS_OK) { 19 | fprintf(stderr, "Unable to configure cloud using the secure connection bundle: %s\n", 20 | secure_connect_bundle); 21 | return 1; 22 | } 23 | 24 | /* Set credentials provided when creating your database */ 25 | cass_cluster_set_credentials(cluster, "username", "password"); 26 | 27 | CassFuture* connect_future = cass_session_connect(session, cluster); 28 | 29 | if (cass_future_error_code(connect_future) == CASS_OK) { 30 | /* Use the session to run queries */ 31 | } else { 32 | /* Handle error */ 33 | } 34 | 35 | cass_future_free(connect_future); 36 | cass_cluster_free(cluster); 37 | cass_session_free(session); 38 | 39 | return 0; 40 | } 41 | ``` 42 | 43 | **Note:** `cass_cluster_set_contact_points()` and `cass_cluster_set_ssl()` should not used 44 | in conjunction with `cass_cluster_set_cloud_secure_connection_bundle()`. 45 | 46 | [DataStax Astra Database-as-a-Service]: https://astra.datastax.com/ 47 | -------------------------------------------------------------------------------- /topics/dse_features/README.md: -------------------------------------------------------------------------------- 1 | # DSE Features 2 | 3 | * [DSE plaintext and GSSAPI authentication](authentication) 4 | * [DSE geospatial types](geotypes) 5 | 6 | ```{eval-rst} 7 | .. toctree:: 8 | :hidden: 9 | :glob: 10 | 11 | authentication/* 12 | geotypes/* 13 | ``` -------------------------------------------------------------------------------- /topics/faq/README.md: -------------------------------------------------------------------------------- 1 | # FAQ 2 | -------------------------------------------------------------------------------- /topics/installation/README.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | ## Packages 4 | 5 | Pre-built packages are available for CentOS 7 and Ubuntu 18.04. 6 | 7 | ### CentOS 8 | 9 | To install the dependencies we recommend using EPEL: 10 | 11 | ```bash 12 | sudo yum install -y epel-release 13 | sudo yum -y install libuv openssl zlib 14 | ``` 15 | 16 | Install the runtime library. Replace `` with the version+platform string: 17 | 18 | ```bash 19 | sudo yum localinstall -y scylla-cpp-driver-.rpm 20 | ``` 21 | 22 | When developing against the driver you'll also want to install the development 23 | package and the debug symbols: 24 | 25 | ```bash 26 | sudo yum localinstall -y scylla-cpp-driver-devel-.rpm scylla-cpp-driver-debuginfo-.rpm 27 | ``` 28 | 29 | ### Ubuntu 30 | 31 | Ubuntu's apt-get will resolve and install the dependencies by itself. 32 | Replace `` with the appropriate version+platform string: 33 | 34 | ```bash 35 | sudo apt-get update 36 | sudo apt-get install -y ./scylla-cpp-driver_.deb 37 | ``` 38 | 39 | When developing against the driver you'll also want to install the development 40 | package and the debug symbols: 41 | 42 | ```bash 43 | sudo apt-get install -y ./scylla-cpp-driver-dev_.deb ./scylla-cpp-driver-dbg_.deb 44 | ``` 45 | 46 | ## Building 47 | 48 | If pre-built packages are not available for your platform or architecture you 49 | will need to build the driver from source. Directions for building and 50 | installing the Scylla C/C++ Driver can be found [here](../building/). 51 | -------------------------------------------------------------------------------- /topics/logging/README.md: -------------------------------------------------------------------------------- 1 | # Logging 2 | 3 | The driver's logging system uses `stderr` by default and the log level `CASS_LOG_WARN`. Both of these settings can be changed using the driver's `cass_log_*()` configuration functions. 4 | 5 | **Important**: Logging configuration must be done before calling any other driver function. 6 | 7 | ## Log Level 8 | 9 | To update the log level use `cass_log_set_level()`. 10 | 11 | ```c 12 | cass_log_set_level(CASS_LOG_INFO); 13 | 14 | /* Create cluster and connect session */ 15 | ``` 16 | 17 | ## Custom Logging Callback 18 | 19 | The use of a logging callback allows an application to log messages to a file, syslog, or any other logging mechanism. This callback must be thread-safe because it is possible for it to be called from multiple threads concurrently. The `data` parameter allows custom resources to be passed to the logging callback. 20 | 21 | ```c 22 | void on_log(const CassLogMessage* message, void* data) { 23 | /* Handle logging */ 24 | } 25 | 26 | int main() { 27 | void* log_data = NULL /* Custom log resource */; 28 | cass_log_set_callback(on_log, log_data); 29 | cass_log_set_level(CASS_LOG_INFO); 30 | 31 | /* Create cluster and connect session */ 32 | 33 | } 34 | ``` 35 | --------------------------------------------------------------------------------