Full Code of XiaoMi/rdsn for AI

master bf76b99a2eea cached
927 files
6.2 MB
1.7M tokens
3337 symbols
1 requests
Download .txt
Showing preview only (6,635K chars total). Download the full file or copy to clipboard to get everything.
Repository: XiaoMi/rdsn
Branch: master
Commit: bf76b99a2eea
Files: 927
Total size: 6.2 MB

Directory structure:
gitextract_4xu5fau8/

├── .clang-format
├── .github/
│   └── workflows/
│       ├── check_license_header.yaml
│       ├── compilation.yaml
│       ├── cpp_actions.yaml
│       ├── cpp_always_pass_actions.yaml
│       ├── issue_ref.yaml
│       └── non_cpp_actions.yaml
├── .gitignore
├── .licenserc.yaml
├── CMakeLists.txt
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── bin/
│   ├── FindDL.cmake
│   ├── FindJemalloc.cmake
│   ├── FindRT.cmake
│   ├── compiler_info.cmake
│   ├── dsn.cmake
│   └── thrift_utils.cmake
├── compile_thrift.py
├── include/
│   └── dsn/
│       ├── c/
│       │   ├── api_common.h
│       │   ├── api_layer1.h
│       │   ├── api_task.h
│       │   ├── api_utilities.h
│       │   └── app_model.h
│       ├── cpp/
│       │   ├── json_helper.h
│       │   ├── message_utils.h
│       │   ├── pipeline.h
│       │   ├── rpc_holder.h
│       │   ├── rpc_stream.h
│       │   ├── serialization.h
│       │   ├── serialization_helper/
│       │   │   ├── dsn.layer2_types.h
│       │   │   ├── dsn_types.h
│       │   │   └── thrift_helper.h
│       │   ├── serverlet.h
│       │   └── service_app.h
│       ├── dist/
│       │   ├── block_service.h
│       │   ├── common.h
│       │   ├── distributed_lock_service.h
│       │   ├── failure_detector/
│       │   │   ├── failure_detector.h
│       │   │   ├── fd.client.h
│       │   │   ├── fd.code.definition.h
│       │   │   └── fd.server.h
│       │   ├── failure_detector.h
│       │   ├── failure_detector_multimaster.h
│       │   ├── fmt_logging.h
│       │   ├── meta_state_service.h
│       │   ├── nfs_node.h
│       │   ├── remote_command.h
│       │   ├── replication/
│       │   │   ├── duplication_common.h
│       │   │   ├── meta_service_app.h
│       │   │   ├── mutation_duplicator.h
│       │   │   ├── mutation_log_tool.h
│       │   │   ├── partition_resolver.h
│       │   │   ├── replica_base.h
│       │   │   ├── replica_envs.h
│       │   │   ├── replica_test_utils.h
│       │   │   ├── replication.codes.h
│       │   │   ├── replication_app_base.h
│       │   │   ├── replication_ddl_client.h
│       │   │   ├── replication_enums.h
│       │   │   ├── replication_other_types.h
│       │   │   ├── replication_service_app.h
│       │   │   ├── replication_types.h
│       │   │   └── storage_serverlet.h
│       │   └── replication.h
│       ├── http/
│       │   └── http_server.h
│       ├── perf_counter/
│       │   ├── perf_counter.h
│       │   ├── perf_counter_utils.h
│       │   ├── perf_counter_wrapper.h
│       │   └── perf_counters.h
│       ├── service_api_c.h
│       ├── service_api_cpp.h
│       ├── tool/
│       │   ├── nativerun.h
│       │   ├── node_scoper.h
│       │   ├── providers.common.h
│       │   └── simulator.h
│       ├── tool-api/
│       │   ├── aio_task.h
│       │   ├── async_calls.h
│       │   ├── auto_codes.h
│       │   ├── command_manager.h
│       │   ├── env_provider.h
│       │   ├── file_io.h
│       │   ├── future_types.h
│       │   ├── global_config.h
│       │   ├── gpid.h
│       │   ├── group_address.h
│       │   ├── logging_provider.h
│       │   ├── message_parser.h
│       │   ├── network.h
│       │   ├── rpc_address.h
│       │   ├── rpc_message.h
│       │   ├── task.h
│       │   ├── task_code.h
│       │   ├── task_queue.h
│       │   ├── task_spec.h
│       │   ├── task_tracker.h
│       │   ├── task_worker.h
│       │   ├── thread_access_checker.h
│       │   ├── threadpool_code.h
│       │   ├── threadpool_spec.h
│       │   ├── timer_service.h
│       │   ├── uniq_timestamp_us.h
│       │   └── zlocks.h
│       ├── tool_api.h
│       ├── toollet/
│       │   ├── fault_injector.h
│       │   ├── profiler.h
│       │   └── tracer.h
│       ├── utility/
│       │   ├── TokenBucket.h
│       │   ├── absl/
│       │   │   ├── base/
│       │   │   │   └── internal/
│       │   │   │       └── invoke.h
│       │   │   └── utility/
│       │   │       └── utility.h
│       │   ├── alloc.h
│       │   ├── apply.h
│       │   ├── autoref_ptr.h
│       │   ├── binary_reader.h
│       │   ├── binary_writer.h
│       │   ├── blob.h
│       │   ├── casts.h
│       │   ├── chrono_literals.h
│       │   ├── clock.h
│       │   ├── config_api.h
│       │   ├── config_helper.h
│       │   ├── configuration.h
│       │   ├── crc.h
│       │   ├── customizable_id.h
│       │   ├── defer.h
│       │   ├── dlib.h
│       │   ├── endians.h
│       │   ├── enum_helper.h
│       │   ├── error_code.h
│       │   ├── errors.h
│       │   ├── exp_delay.h
│       │   ├── extensible_object.h
│       │   ├── factory_store.h
│       │   ├── fail_point.h
│       │   ├── filesystem.h
│       │   ├── fixed_size_buffer_pool.h
│       │   ├── flags.h
│       │   ├── function_traits.h
│       │   ├── hpc_locks/
│       │   │   ├── autoresetevent.h
│       │   │   ├── autoreseteventcondvar.h
│       │   │   ├── benaphore.h
│       │   │   ├── bitfield.h
│       │   │   ├── readme.txt
│       │   │   ├── rwlock.h
│       │   │   └── sema.h
│       │   ├── join_point.h
│       │   ├── link.h
│       │   ├── long_adder.h
│       │   ├── math.h
│       │   ├── metrics.h
│       │   ├── nth_element.h
│       │   ├── optional.h
│       │   ├── output_utils.h
│       │   ├── ports.h
│       │   ├── preloadable.h
│       │   ├── priority_queue.h
│       │   ├── process_utils.h
│       │   ├── rand.h
│       │   ├── safe_strerror_posix.h
│       │   ├── singleton.h
│       │   ├── singleton_store.h
│       │   ├── smart_pointers.h
│       │   ├── string_conv.h
│       │   ├── string_splitter.h
│       │   ├── string_view.h
│       │   ├── strings.h
│       │   ├── synchronize.h
│       │   ├── sys_exit_hook.h
│       │   ├── timer.h
│       │   ├── utils.h
│       │   └── work_queue.h
│       └── utils/
│           ├── latency_tracer.h
│           ├── time_utils.h
│           ├── token_bucket_throttling_controller.h
│           └── token_buckets.h
├── run.sh
├── scripts/
│   └── linux/
│       ├── build.sh
│       ├── clear_zk.sh
│       ├── install.sh
│       ├── learn_stat.py
│       ├── run-clang-format.py
│       ├── run-clang-format.sh
│       ├── start_zk.sh
│       └── stop_zk.sh
├── src/
│   ├── CMakeLists.txt
│   ├── aio/
│   │   ├── CMakeLists.txt
│   │   ├── aio_provider.cpp
│   │   ├── aio_provider.h
│   │   ├── aio_task.cpp
│   │   ├── disk_engine.cpp
│   │   ├── disk_engine.h
│   │   ├── file_io.cpp
│   │   ├── native_linux_aio_provider.cpp
│   │   ├── native_linux_aio_provider.h
│   │   └── test/
│   │       ├── CMakeLists.txt
│   │       ├── aio.cpp
│   │       ├── clear.sh
│   │       ├── config.ini
│   │       ├── copy_source.txt
│   │       ├── main.cpp
│   │       └── run.sh
│   ├── block_service/
│   │   ├── CMakeLists.txt
│   │   ├── block_service_manager.cpp
│   │   ├── block_service_manager.h
│   │   ├── directio_writable_file.cpp
│   │   ├── directio_writable_file.h
│   │   ├── fds/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── fds_service.cpp
│   │   │   └── fds_service.h
│   │   ├── hdfs/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── hdfs_service.cpp
│   │   │   └── hdfs_service.h
│   │   ├── local/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── local_service.cpp
│   │   │   └── local_service.h
│   │   └── test/
│   │       ├── CMakeLists.txt
│   │       ├── block_service_manager_test.cpp
│   │       ├── block_service_mock.h
│   │       ├── clear.sh
│   │       ├── config-test.ini
│   │       ├── fds_service_test.cpp
│   │       ├── hdfs_service_test.cpp
│   │       ├── local_service_test.cpp
│   │       ├── main.cpp
│   │       └── run.sh
│   ├── client/
│   │   ├── CMakeLists.txt
│   │   ├── partition_resolver.cpp
│   │   ├── partition_resolver_manager.cpp
│   │   ├── partition_resolver_manager.h
│   │   ├── partition_resolver_simple.cpp
│   │   ├── partition_resolver_simple.h
│   │   └── replication_ddl_client.cpp
│   ├── common/
│   │   ├── CMakeLists.txt
│   │   ├── backup.thrift
│   │   ├── backup_common.cpp
│   │   ├── backup_common.h
│   │   ├── bulk_load.thrift
│   │   ├── bulk_load_common.cpp
│   │   ├── bulk_load_common.h
│   │   ├── common.cpp
│   │   ├── consensus.thrift
│   │   ├── duplication.thrift
│   │   ├── duplication_common.cpp
│   │   ├── fs_manager.cpp
│   │   ├── fs_manager.h
│   │   ├── manual_compact.h
│   │   ├── meta_admin.thrift
│   │   ├── metadata.thrift
│   │   ├── partition_split.thrift
│   │   ├── partition_split_common.h
│   │   ├── replica_admin.thrift
│   │   ├── replication_common.cpp
│   │   ├── replication_common.h
│   │   └── test/
│   │       ├── CMakeLists.txt
│   │       ├── common_test.cpp
│   │       ├── config-test.ini
│   │       ├── duplication_common_test.cpp
│   │       ├── fs_manager_test.cpp
│   │       ├── main.cpp
│   │       ├── replication_common_test.cpp
│   │       └── run.sh
│   ├── dsn.layer2.thrift
│   ├── dsn.thrift
│   ├── failure_detector/
│   │   ├── CMakeLists.txt
│   │   ├── failure_detector.cpp
│   │   ├── failure_detector_multimaster.cpp
│   │   ├── fd.thrift
│   │   └── test/
│   │       ├── CMakeLists.txt
│   │       ├── clear.sh
│   │       ├── config-test.ini
│   │       ├── config-whitelist-test-failed.ini
│   │       ├── config-whitelist-test.ini
│   │       ├── failure_detector.cpp
│   │       ├── gtest.filter
│   │       ├── main.cpp
│   │       └── run.sh
│   ├── http/
│   │   ├── CMakeLists.txt
│   │   ├── builtin_http_calls.cpp
│   │   ├── builtin_http_calls.h
│   │   ├── config_http_service.cpp
│   │   ├── http_call_registry.h
│   │   ├── http_message_parser.cpp
│   │   ├── http_message_parser.h
│   │   ├── http_server.cpp
│   │   ├── http_server_impl.h
│   │   ├── perf_counter_http_service.cpp
│   │   ├── pprof_http_service.cpp
│   │   ├── pprof_http_service.h
│   │   ├── service_version.cpp
│   │   ├── service_version.h
│   │   ├── test/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── http_server_test.cpp
│   │   │   ├── perf_counter_http_service_test.cpp
│   │   │   ├── run.sh
│   │   │   └── uri_decoder_test.cpp
│   │   ├── uri_decoder.cpp
│   │   └── uri_decoder.h
│   ├── meta/
│   │   ├── CMakeLists.txt
│   │   ├── app_balance_policy.cpp
│   │   ├── app_balance_policy.h
│   │   ├── app_env_validator.cpp
│   │   ├── app_env_validator.h
│   │   ├── backup_engine.cpp
│   │   ├── backup_engine.h
│   │   ├── cluster_balance_policy.cpp
│   │   ├── cluster_balance_policy.h
│   │   ├── distributed_lock_service_simple.cpp
│   │   ├── distributed_lock_service_simple.h
│   │   ├── dump_file.h
│   │   ├── duplication/
│   │   │   ├── duplication_info.cpp
│   │   │   ├── duplication_info.h
│   │   │   ├── meta_duplication_service.cpp
│   │   │   └── meta_duplication_service.h
│   │   ├── greedy_load_balancer.cpp
│   │   ├── greedy_load_balancer.h
│   │   ├── load_balance_policy.cpp
│   │   ├── load_balance_policy.h
│   │   ├── meta_backup_service.cpp
│   │   ├── meta_backup_service.h
│   │   ├── meta_bulk_load_ingestion_context.cpp
│   │   ├── meta_bulk_load_ingestion_context.h
│   │   ├── meta_bulk_load_service.cpp
│   │   ├── meta_bulk_load_service.h
│   │   ├── meta_data.cpp
│   │   ├── meta_data.h
│   │   ├── meta_http_service.cpp
│   │   ├── meta_http_service.h
│   │   ├── meta_options.cpp
│   │   ├── meta_options.h
│   │   ├── meta_rpc_types.h
│   │   ├── meta_server_failure_detector.cpp
│   │   ├── meta_server_failure_detector.h
│   │   ├── meta_service.cpp
│   │   ├── meta_service.h
│   │   ├── meta_service_app.cpp
│   │   ├── meta_split_service.cpp
│   │   ├── meta_split_service.h
│   │   ├── meta_state_service_simple.cpp
│   │   ├── meta_state_service_simple.h
│   │   ├── meta_state_service_utils.cpp
│   │   ├── meta_state_service_utils.h
│   │   ├── meta_state_service_utils_impl.h
│   │   ├── meta_state_service_zookeeper.cpp
│   │   ├── meta_state_service_zookeeper.h
│   │   ├── partition_guardian.cpp
│   │   ├── partition_guardian.h
│   │   ├── server_load_balancer.cpp
│   │   ├── server_load_balancer.h
│   │   ├── server_state.cpp
│   │   ├── server_state.h
│   │   ├── server_state_restore.cpp
│   │   └── test/
│   │       ├── CMakeLists.txt
│   │       ├── backup_test.cpp
│   │       ├── balancer_simulator/
│   │       │   ├── CMakeLists.txt
│   │       │   └── balancer_simulator.cpp
│   │       ├── balancer_validator.cpp
│   │       ├── clear.sh
│   │       ├── cluster_balance_policy_test.cpp
│   │       ├── config-test.ini
│   │       ├── copy_replica_operation_test.cpp
│   │       ├── dummy_balancer.h
│   │       ├── dump_file.cpp
│   │       ├── duplication_info_test.cpp
│   │       ├── ford_fulkerson_test.cpp
│   │       ├── json_compacity.cpp
│   │       ├── main.cpp
│   │       ├── meta_app_envs_test.cpp
│   │       ├── meta_app_operation_test.cpp
│   │       ├── meta_backup_test.cpp
│   │       ├── meta_bulk_load_ingestion_test.cpp
│   │       ├── meta_bulk_load_service_test.cpp
│   │       ├── meta_data.cpp
│   │       ├── meta_duplication_service_test.cpp
│   │       ├── meta_http_service_test.cpp
│   │       ├── meta_mauanl_compaction_test.cpp
│   │       ├── meta_partition_guardian_test.cpp
│   │       ├── meta_service_test.cpp
│   │       ├── meta_service_test_app.h
│   │       ├── meta_split_service_test.cpp
│   │       ├── meta_state/
│   │       │   ├── CMakeLists.txt
│   │       │   ├── clear.cmd
│   │       │   ├── clear.sh
│   │       │   ├── config-test.ini
│   │       │   ├── gtest.filter
│   │       │   ├── main.cpp
│   │       │   ├── meta_state_service.cpp
│   │       │   └── run.sh
│   │       ├── meta_state_service_utils_test.cpp
│   │       ├── meta_test_base.cpp
│   │       ├── meta_test_base.h
│   │       ├── misc/
│   │       │   ├── misc.cpp
│   │       │   └── misc.h
│   │       ├── run.sh
│   │       ├── server_state_restore_test.cpp
│   │       ├── server_state_test.cpp
│   │       ├── state_sync_test.cpp
│   │       ├── suite1
│   │       ├── suite2
│   │       └── update_configuration_test.cpp
│   ├── nfs/
│   │   ├── CMakeLists.txt
│   │   ├── nfs.thrift
│   │   ├── nfs_client_impl.cpp
│   │   ├── nfs_client_impl.h
│   │   ├── nfs_code_definition.h
│   │   ├── nfs_node.cpp
│   │   ├── nfs_node_impl.cpp
│   │   ├── nfs_node_simple.h
│   │   ├── nfs_server_impl.cpp
│   │   ├── nfs_server_impl.h
│   │   └── test/
│   │       ├── CMakeLists.txt
│   │       ├── clear.sh
│   │       ├── config.ini
│   │       ├── main.cpp
│   │       ├── nfs_test_file1
│   │       ├── nfs_test_file2
│   │       └── run.sh
│   ├── perf_counter/
│   │   ├── CMakeLists.txt
│   │   ├── builtin_counters.cpp
│   │   ├── builtin_counters.h
│   │   ├── perf_counter.cpp
│   │   ├── perf_counter_atomic.h
│   │   ├── perf_counters.cpp
│   │   └── test/
│   │       ├── CMakeLists.txt
│   │       ├── clear.sh
│   │       ├── main.cpp
│   │       ├── perf_counter_test.cpp
│   │       ├── perf_counters_test.cpp
│   │       └── run.sh
│   ├── remote_cmd/
│   │   ├── CMakeLists.txt
│   │   ├── command.thrift
│   │   └── remote_command.cpp
│   ├── replica/
│   │   ├── CMakeLists.txt
│   │   ├── backup/
│   │   │   ├── cold_backup_context.cpp
│   │   │   ├── cold_backup_context.h
│   │   │   ├── replica_backup_manager.cpp
│   │   │   ├── replica_backup_manager.h
│   │   │   ├── replica_backup_server.cpp
│   │   │   ├── replica_backup_server.h
│   │   │   └── test/
│   │   │       ├── CMakeLists.txt
│   │   │       ├── config-test.ini
│   │   │       ├── main.cpp
│   │   │       ├── replica_backup_manager_test.cpp
│   │   │       └── run.sh
│   │   ├── bulk_load/
│   │   │   ├── replica_bulk_loader.cpp
│   │   │   ├── replica_bulk_loader.h
│   │   │   └── test/
│   │   │       ├── CMakeLists.txt
│   │   │       ├── config-test.ini
│   │   │       ├── main.cpp
│   │   │       ├── replica_bulk_loader_test.cpp
│   │   │       └── run.sh
│   │   ├── disk_cleaner.cpp
│   │   ├── disk_cleaner.h
│   │   ├── duplication/
│   │   │   ├── duplication_pipeline.cpp
│   │   │   ├── duplication_pipeline.h
│   │   │   ├── duplication_sync_timer.cpp
│   │   │   ├── duplication_sync_timer.h
│   │   │   ├── load_from_private_log.cpp
│   │   │   ├── load_from_private_log.h
│   │   │   ├── mutation_batch.cpp
│   │   │   ├── mutation_batch.h
│   │   │   ├── replica_duplicator.cpp
│   │   │   ├── replica_duplicator.h
│   │   │   ├── replica_duplicator_manager.cpp
│   │   │   ├── replica_duplicator_manager.h
│   │   │   ├── replica_follower.cpp
│   │   │   ├── replica_follower.h
│   │   │   └── test/
│   │   │       ├── CMakeLists.txt
│   │   │       ├── config-test.ini
│   │   │       ├── duplication_sync_timer_test.cpp
│   │   │       ├── duplication_test_base.h
│   │   │       ├── load_from_private_log_test.cpp
│   │   │       ├── log.1.0.all_loaded_are_write_empties
│   │   │       ├── log.1.0.handle_real_private_log
│   │   │       ├── log.1.0.handle_real_private_log2
│   │   │       ├── main.cpp
│   │   │       ├── mutation_batch_test.cpp
│   │   │       ├── replica_duplicator_manager_test.cpp
│   │   │       ├── replica_duplicator_test.cpp
│   │   │       ├── replica_follower_test.cpp
│   │   │       ├── replica_http_service_test.cpp
│   │   │       ├── run.sh
│   │   │       └── ship_mutation_test.cpp
│   │   ├── log_block.cpp
│   │   ├── log_block.h
│   │   ├── log_file.cpp
│   │   ├── log_file.h
│   │   ├── log_file_stream.h
│   │   ├── mutation.cpp
│   │   ├── mutation.h
│   │   ├── mutation_cache.cpp
│   │   ├── mutation_cache.h
│   │   ├── mutation_log.cpp
│   │   ├── mutation_log.h
│   │   ├── mutation_log_replay.cpp
│   │   ├── mutation_log_utils.cpp
│   │   ├── mutation_log_utils.h
│   │   ├── prepare_list.cpp
│   │   ├── prepare_list.h
│   │   ├── replica.cpp
│   │   ├── replica.h
│   │   ├── replica_2pc.cpp
│   │   ├── replica_backup.cpp
│   │   ├── replica_check.cpp
│   │   ├── replica_chkpt.cpp
│   │   ├── replica_config.cpp
│   │   ├── replica_context.cpp
│   │   ├── replica_context.h
│   │   ├── replica_disk_migrator.cpp
│   │   ├── replica_disk_migrator.h
│   │   ├── replica_failover.cpp
│   │   ├── replica_http_service.cpp
│   │   ├── replica_http_service.h
│   │   ├── replica_init.cpp
│   │   ├── replica_learn.cpp
│   │   ├── replica_restore.cpp
│   │   ├── replica_stub.cpp
│   │   ├── replica_stub.h
│   │   ├── replica_test_utils.cpp
│   │   ├── replica_throttle.cpp
│   │   ├── replication_app_base.cpp
│   │   ├── replication_service_app.cpp
│   │   ├── split/
│   │   │   ├── replica_split_manager.cpp
│   │   │   ├── replica_split_manager.h
│   │   │   └── test/
│   │   │       ├── CMakeLists.txt
│   │   │       ├── config-test.ini
│   │   │       ├── main.cpp
│   │   │       ├── replica_split_test.cpp
│   │   │       └── run.sh
│   │   ├── storage/
│   │   │   ├── CMakeLists.txt
│   │   │   └── simple_kv/
│   │   │       ├── CMakeLists.txt
│   │   │       ├── clear.sh
│   │   │       ├── config.ini
│   │   │       ├── run.sh
│   │   │       ├── simple_kv.app.example.h
│   │   │       ├── simple_kv.client.h
│   │   │       ├── simple_kv.code.definition.h
│   │   │       ├── simple_kv.main.cpp
│   │   │       ├── simple_kv.server.h
│   │   │       ├── simple_kv.server.impl.cpp
│   │   │       ├── simple_kv.server.impl.h
│   │   │       ├── simple_kv.thrift
│   │   │       └── test/
│   │   │           ├── CMakeLists.txt
│   │   │           ├── README.md
│   │   │           ├── addcase.sh
│   │   │           ├── case-000.act
│   │   │           ├── case-000.ini
│   │   │           ├── case-001.act
│   │   │           ├── case-001.ini
│   │   │           ├── case-002.act
│   │   │           ├── case-002.ini
│   │   │           ├── case-003.act
│   │   │           ├── case-003.ini
│   │   │           ├── case-004.act
│   │   │           ├── case-004.ini
│   │   │           ├── case-005.act
│   │   │           ├── case-005.ini
│   │   │           ├── case-006.act
│   │   │           ├── case-006.ini
│   │   │           ├── case-100.act
│   │   │           ├── case-100.ini
│   │   │           ├── case-101.act
│   │   │           ├── case-101.ini
│   │   │           ├── case-102.act
│   │   │           ├── case-102.ini
│   │   │           ├── case-103.act
│   │   │           ├── case-103.ini
│   │   │           ├── case-104.act
│   │   │           ├── case-104.ini
│   │   │           ├── case-105.act
│   │   │           ├── case-105.ini
│   │   │           ├── case-106.act
│   │   │           ├── case-106.ini
│   │   │           ├── case-107.act
│   │   │           ├── case-107.ini
│   │   │           ├── case-108.act
│   │   │           ├── case-108.ini
│   │   │           ├── case-109.act
│   │   │           ├── case-109.ini
│   │   │           ├── case-200.act
│   │   │           ├── case-200.ini
│   │   │           ├── case-201.act
│   │   │           ├── case-201.ini
│   │   │           ├── case-202-0.act
│   │   │           ├── case-202-0.ini
│   │   │           ├── case-202-1.act
│   │   │           ├── case-202-1.ini
│   │   │           ├── case-203-0.act
│   │   │           ├── case-203-0.ini
│   │   │           ├── case-204.act
│   │   │           ├── case-204.ini
│   │   │           ├── case-205.act
│   │   │           ├── case-205.ini
│   │   │           ├── case-206.act
│   │   │           ├── case-206.ini
│   │   │           ├── case-207.act
│   │   │           ├── case-207.ini
│   │   │           ├── case-208.act
│   │   │           ├── case-208.ini
│   │   │           ├── case-209.act
│   │   │           ├── case-209.ini
│   │   │           ├── case-210.act
│   │   │           ├── case-210.ini
│   │   │           ├── case-211.act
│   │   │           ├── case-211.ini
│   │   │           ├── case-212.act
│   │   │           ├── case-212.ini
│   │   │           ├── case-213.act
│   │   │           ├── case-213.ini
│   │   │           ├── case-214.act
│   │   │           ├── case-214.ini
│   │   │           ├── case-215.act
│   │   │           ├── case-215.ini
│   │   │           ├── case-216.act
│   │   │           ├── case-216.ini
│   │   │           ├── case-300-0.act
│   │   │           ├── case-300-0.ini
│   │   │           ├── case-300-1.act
│   │   │           ├── case-300-1.ini
│   │   │           ├── case-300-2.act
│   │   │           ├── case-300-2.ini
│   │   │           ├── case-301.act
│   │   │           ├── case-301.ini
│   │   │           ├── case-302.act
│   │   │           ├── case-302.ini
│   │   │           ├── case-303.act
│   │   │           ├── case-303.ini
│   │   │           ├── case-304.act
│   │   │           ├── case-304.ini
│   │   │           ├── case-305.act
│   │   │           ├── case-305.ini
│   │   │           ├── case-306.act
│   │   │           ├── case-306.ini
│   │   │           ├── case-307.act
│   │   │           ├── case-307.ini
│   │   │           ├── case-400.act
│   │   │           ├── case-400.ini
│   │   │           ├── case-401.act
│   │   │           ├── case-401.ini
│   │   │           ├── case-402.act
│   │   │           ├── case-402.ini
│   │   │           ├── case-600.act
│   │   │           ├── case-600.ini
│   │   │           ├── case-601.act
│   │   │           ├── case-601.ini
│   │   │           ├── case-602.act
│   │   │           ├── case-602.ini
│   │   │           ├── case-603.act
│   │   │           ├── case-603.ini
│   │   │           ├── case.cpp
│   │   │           ├── case.h
│   │   │           ├── checker.cpp
│   │   │           ├── checker.h
│   │   │           ├── clear.sh
│   │   │           ├── client.cpp
│   │   │           ├── client.h
│   │   │           ├── common.cpp
│   │   │           ├── common.h
│   │   │           ├── config.ini
│   │   │           ├── injector.cpp
│   │   │           ├── injector.h
│   │   │           ├── run.sh
│   │   │           ├── simple_kv.main.cpp
│   │   │           ├── simple_kv.server.impl.cpp
│   │   │           └── simple_kv.server.impl.h
│   │   └── test/
│   │       ├── CMakeLists.txt
│   │       ├── backup_block_service_mock.h
│   │       ├── clear.sh
│   │       ├── cold_backup_context_test.cpp
│   │       ├── config-test.ini
│   │       ├── log_block_test.cpp
│   │       ├── log_file_test.cpp
│   │       ├── main.cpp
│   │       ├── mock_utils.h
│   │       ├── mutation_log_learn_test.cpp
│   │       ├── mutation_log_test.cpp
│   │       ├── open_replica_test.cpp
│   │       ├── replica_disk_migrate_test.cpp
│   │       ├── replica_disk_test.cpp
│   │       ├── replica_disk_test_base.h
│   │       ├── replica_learn_test.cpp
│   │       ├── replica_test.cpp
│   │       ├── replica_test_base.h
│   │       ├── replication_service_test_app.h
│   │       ├── run.sh
│   │       └── throttling_controller_test.cpp
│   ├── runtime/
│   │   ├── CMakeLists.txt
│   │   ├── build_config.h
│   │   ├── core_main.cpp
│   │   ├── dsn.layer2_types.cpp
│   │   ├── env.sim.cpp
│   │   ├── env.sim.h
│   │   ├── fault_injector.cpp
│   │   ├── global_config.cpp
│   │   ├── message_utils.cpp
│   │   ├── nativerun.cpp
│   │   ├── profiler.cpp
│   │   ├── profiler_header.h
│   │   ├── providers.common.cpp
│   │   ├── rpc/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── asio_net_provider.cpp
│   │   │   ├── asio_net_provider.h
│   │   │   ├── asio_rpc_session.cpp
│   │   │   ├── asio_rpc_session.h
│   │   │   ├── dsn_message_parser.cpp
│   │   │   ├── dsn_message_parser.h
│   │   │   ├── message_parser.cpp
│   │   │   ├── message_parser_manager.h
│   │   │   ├── network.cpp
│   │   │   ├── network.sim.cpp
│   │   │   ├── network.sim.h
│   │   │   ├── raw_message_parser.cpp
│   │   │   ├── raw_message_parser.h
│   │   │   ├── request_meta.thrift
│   │   │   ├── rpc_engine.cpp
│   │   │   ├── rpc_engine.h
│   │   │   ├── rpc_message.cpp
│   │   │   ├── rpc_task.cpp
│   │   │   ├── thrift_message_parser.cpp
│   │   │   └── thrift_message_parser.h
│   │   ├── scheduler.cpp
│   │   ├── scheduler.h
│   │   ├── security/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── access_controller.cpp
│   │   │   ├── access_controller.h
│   │   │   ├── client_negotiation.cpp
│   │   │   ├── client_negotiation.h
│   │   │   ├── init.cpp
│   │   │   ├── init.h
│   │   │   ├── kinit_context.cpp
│   │   │   ├── kinit_context.h
│   │   │   ├── meta_access_controller.cpp
│   │   │   ├── meta_access_controller.h
│   │   │   ├── negotiation.cpp
│   │   │   ├── negotiation.h
│   │   │   ├── negotiation_manager.cpp
│   │   │   ├── negotiation_manager.h
│   │   │   ├── negotiation_utils.h
│   │   │   ├── replica_access_controller.cpp
│   │   │   ├── replica_access_controller.h
│   │   │   ├── sasl_client_wrapper.cpp
│   │   │   ├── sasl_client_wrapper.h
│   │   │   ├── sasl_init.cpp
│   │   │   ├── sasl_init.h
│   │   │   ├── sasl_server_wrapper.cpp
│   │   │   ├── sasl_server_wrapper.h
│   │   │   ├── sasl_wrapper.cpp
│   │   │   ├── sasl_wrapper.h
│   │   │   ├── security.thrift
│   │   │   ├── server_negotiation.cpp
│   │   │   └── server_negotiation.h
│   │   ├── service_api_c.cpp
│   │   ├── service_engine.cpp
│   │   ├── service_engine.h
│   │   ├── sim_clock.h
│   │   ├── simulator.cpp
│   │   ├── task/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── hpc_task_queue.cpp
│   │   │   ├── hpc_task_queue.h
│   │   │   ├── simple_task_queue.cpp
│   │   │   ├── simple_task_queue.h
│   │   │   ├── task.cpp
│   │   │   ├── task_code.cpp
│   │   │   ├── task_engine.cpp
│   │   │   ├── task_engine.h
│   │   │   ├── task_engine.sim.cpp
│   │   │   ├── task_engine.sim.h
│   │   │   ├── task_queue.cpp
│   │   │   ├── task_spec.cpp
│   │   │   ├── task_tracker.cpp
│   │   │   └── task_worker.cpp
│   │   ├── test/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── async_call.cpp
│   │   │   ├── clear.sh
│   │   │   ├── client_negotiation_test.cpp
│   │   │   ├── command.txt
│   │   │   ├── config-test-corrupt-message.ini
│   │   │   ├── config-test-sim.ini
│   │   │   ├── config-test.ini
│   │   │   ├── corrupt_message.cpp
│   │   │   ├── gtest.filter
│   │   │   ├── lpc.cpp
│   │   │   ├── main.cpp
│   │   │   ├── message_reader_test.cpp
│   │   │   ├── message_utils_test.cpp
│   │   │   ├── meta_access_controller_test.cpp
│   │   │   ├── negotiation_manager_test.cpp
│   │   │   ├── netprovider.cpp
│   │   │   ├── pipeline_test.cpp
│   │   │   ├── replica_access_controller_test.cpp
│   │   │   ├── rpc.cpp
│   │   │   ├── rpc_holder_test.cpp
│   │   │   ├── rpc_message.cpp
│   │   │   ├── run.sh
│   │   │   ├── server_negotiation_test.cpp
│   │   │   ├── service_api_c.cpp
│   │   │   ├── sim_lock.cpp
│   │   │   ├── task_engine.cpp
│   │   │   ├── task_test.cpp
│   │   │   ├── test_utils.h
│   │   │   └── thrift_message_parser_test.cpp
│   │   ├── threadpool_code.cpp
│   │   ├── tool_api.cpp
│   │   ├── tracer.cpp
│   │   └── zlocks.cpp
│   ├── tools/
│   │   ├── CMakeLists.txt
│   │   └── mutation_log_tool.cpp
│   ├── utils/
│   │   ├── CMakeLists.txt
│   │   ├── alloc.cpp
│   │   ├── binary_reader.cpp
│   │   ├── binary_writer.cpp
│   │   ├── clock.cpp
│   │   ├── command_manager.cpp
│   │   ├── config_api.cpp
│   │   ├── configuration.cpp
│   │   ├── coredump.h
│   │   ├── coredump.posix.cpp
│   │   ├── crc.cpp
│   │   ├── error_code.cpp
│   │   ├── fail_point.cpp
│   │   ├── fail_point_impl.h
│   │   ├── filesystem.cpp
│   │   ├── flags.cpp
│   │   ├── gpid.cpp
│   │   ├── latency_tracer.cpp
│   │   ├── lockp.std.h
│   │   ├── logging.cpp
│   │   ├── long_adder.cpp
│   │   ├── long_adder_bench/
│   │   │   ├── CMakeLists.txt
│   │   │   └── long_adder_bench.cpp
│   │   ├── math.cpp
│   │   ├── memutil.h
│   │   ├── metrics.cpp
│   │   ├── output_utils.cpp
│   │   ├── process_utils.cpp
│   │   ├── rand.cpp
│   │   ├── rpc_address.cpp
│   │   ├── safe_strerror_posix.cpp
│   │   ├── shared_io_service.cpp
│   │   ├── shared_io_service.h
│   │   ├── simple_logger.cpp
│   │   ├── simple_logger.h
│   │   ├── string_view.cpp
│   │   ├── strings.cpp
│   │   ├── test/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── TokenBucketTest.cpp
│   │   │   ├── TokenBucketTest.h
│   │   │   ├── address.cpp
│   │   │   ├── autoref_ptr_test.cpp
│   │   │   ├── binary_reader_test.cpp
│   │   │   ├── clear.sh
│   │   │   ├── command_manager.cpp
│   │   │   ├── config-bad-section.ini
│   │   │   ├── config-dup-key.ini
│   │   │   ├── config-dup-section.ini
│   │   │   ├── config-empty.ini
│   │   │   ├── config-no-key.ini
│   │   │   ├── config-no-section.ini
│   │   │   ├── config-null-section.ini
│   │   │   ├── config-sample.ini
│   │   │   ├── config-unmatch-section.ini
│   │   │   ├── configuration.cpp
│   │   │   ├── endian_test.cpp
│   │   │   ├── env.cpp
│   │   │   ├── fail_point_test.cpp
│   │   │   ├── file_system_test.cpp
│   │   │   ├── file_utils.cpp
│   │   │   ├── flag_test.cpp
│   │   │   ├── fmt_logging_test.cpp
│   │   │   ├── hostname_test.cpp
│   │   │   ├── join_point_test.cpp
│   │   │   ├── json_helper_test.cpp
│   │   │   ├── latency_tracer_test.cpp
│   │   │   ├── lock.std.cpp
│   │   │   ├── logger.cpp
│   │   │   ├── logging.cpp
│   │   │   ├── long_adder_test.cpp
│   │   │   ├── main.cpp
│   │   │   ├── memutil_test.cpp
│   │   │   ├── metrics_test.cpp
│   │   │   ├── nth_element_bench/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── nth_element_bench.cpp
│   │   │   ├── nth_element_test.cpp
│   │   │   ├── nth_element_utils.h
│   │   │   ├── output_utils_test.cpp
│   │   │   ├── percentile_utils.h
│   │   │   ├── priority_queue.cpp
│   │   │   ├── rand_test.cpp
│   │   │   ├── run.sh
│   │   │   ├── sema.cpp
│   │   │   ├── smart_pointers_test.cpp
│   │   │   ├── string_conv_test.cpp
│   │   │   ├── string_view_test.cpp
│   │   │   ├── time_utils_test.cpp
│   │   │   ├── token_bucket_throttling_controller_test.cpp
│   │   │   ├── token_buckets_test.cpp
│   │   │   └── utils.cpp
│   │   ├── thread_access_checker.cpp
│   │   ├── throttling_controller.cpp
│   │   ├── throttling_controller.h
│   │   ├── time_utils.cpp
│   │   ├── token_bucket_throttling_controller.cpp
│   │   ├── token_buckets.cpp
│   │   ├── utils.cpp
│   │   └── zlock_provider.h
│   └── zookeeper/
│       ├── CMakeLists.txt
│       ├── distributed_lock_service_zookeeper.cpp
│       ├── distributed_lock_service_zookeeper.h
│       ├── lock_struct.cpp
│       ├── lock_struct.h
│       ├── lock_types.h
│       ├── test/
│       │   ├── CMakeLists.txt
│       │   ├── clear.sh
│       │   ├── config-test.ini
│       │   ├── distributed_lock_zookeeper.cpp
│       │   ├── main.cpp
│       │   └── run.sh
│       ├── zookeeper_error.cpp
│       ├── zookeeper_error.h
│       ├── zookeeper_session.cpp
│       ├── zookeeper_session.h
│       ├── zookeeper_session_mgr.cpp
│       └── zookeeper_session_mgr.h
└── thirdparty/
    ├── CMakeLists.txt
    ├── fix_fds_for_macos.patch
    ├── fix_s2_for_aarch64.patch
    └── fix_thrift_for_cpp11.patch

================================================
FILE CONTENTS
================================================

================================================
FILE: .clang-format
================================================
# The MIT License (MIT)
#
# Copyright (c) 2015 Microsoft Corporation
#
# -=- Robust Distributed System Nucleus (rDSN) -=-
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

---
Language:        Cpp
# BasedOnStyle:  LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands:   true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:   
  AfterClass:      true
  AfterControlStatement: false
  AfterEnum:       true
  AfterFunction:   true
  AfterNamespace:  false
  AfterObjCDeclaration: false
  AfterStruct:     true
  AfterUnion:      true
  BeforeCatch:     false
  BeforeElse:      false
  IndentBraces:    false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit:     100
CommentPragmas:  '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat:   false
ExperimentalAutoDetectBinPacking: true
ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories: 
  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
    Priority:        2
  - Regex:           '^(<|"(gtest|isl|json)/)'
    Priority:        3
  - Regex:           '.*'
    Priority:        1
IncludeIsMainRegex: '$'
IndentCaseLabels: false
IndentWidth:     4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd:   ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments:  true
SortIncludes:    false
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles:  false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard:        Cpp11
TabWidth:        4
UseTab:          Never
...



================================================
FILE: .github/workflows/check_license_header.yaml
================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
---
name: License Check
on:
  pull_request:
  push:
    branches:
      - master
      - 'v[0-9]+.*' # release branch
      - ci-test # testing branch for github action
      - '*dev' # developing branch
jobs:
  license-check:
    name: Check License Header
    runs-on: ubuntu-latest
    steps:
      - name: "Checkout"
        uses: actions/checkout@v2
      - name: Check License Header
        uses: apache/skywalking-eyes@v0.3.0
        with:
          # Optional: set the log level. The default value is `info`.
          # log: debug
          # Optional: set the config file. The default value is `.licenserc.yaml`.
          config: .licenserc.yaml


================================================
FILE: .github/workflows/compilation.yaml
================================================
##############################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
##############################################################################

name: rdsn compilation

on:
  push:
    # when new tag created
    tags:
      - v*
    # when this file is updated
    paths:
      - '.github/workflows/compilation.yml'

  # for manually triggering workflow
  workflow_dispatch:

  # run for every day 2am UTC+8(Beijing)
  schedule:
    - cron:  '0 18 */1 * *'

jobs:
  compilation:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        os:
          - ubuntu1604
          - ubuntu1804
          - ubuntu2004
          #- centos6 is EOL
          - centos7
        compiler-family:
          - gcc
        include:
          - compiler-family: clang
            compiler: "clang-10,clang++-10"
            os: ubuntu2004
          - compiler-family: clang
            compiler: "clang-9,clang++-9"
            os: ubuntu1804
    container:
      image: apache/pegasus:thirdparties-bin-${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2
      - name: Unpack prebuilt third-parties
        run: unzip /root/thirdparties-bin.zip -d ./thirdparty
      - name: Compilation on GCC
        if: ${{ matrix.compiler-family == 'gcc' }}
        run: ./run.sh build -c --skip_thirdparty
      - name: Compilation on Clang
        if: ${{ matrix.compiler-family == 'clang' }}
        env:
          COMPILER: ${{ matrix.compiler }}
        run: ./run.sh build --compiler $COMPILER --skip_thirdparty


================================================
FILE: .github/workflows/cpp_actions.yaml
================================================
# Developer Notes:
#
# This config is for github actions. Before merging your changes of this file,
# it's recommended to create a PR against the ci-test branch to test if it works
# as expected.

name: Code Lint and Unit Test

on:
  # run on each pull request
  pull_request:
    types: [ synchronize, opened, reopened ]
    paths:
      - .github/workflows/cpp_actions.yaml
      - CMakeLists.txt
      - bin/**
      - compile_thrift.py
      - include/**
      - run.sh
      - scripts/**
      - src/**
      - thirdparty/**
    branches:
      - master
      - 'v[0-9]+.*' # release branch
      - ci-test # testing branch for github action
      - '*dev' # developing branch

  # for manually triggering workflow
  workflow_dispatch:

defaults:
  run:
    shell: bash

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    container:
      image: apache/pegasus:clang-format-3.9
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 1
      - name: clang-format
        run: ./scripts/linux/run-clang-format.py --clang-format-executable=clang-format-3.9 -r src include

  test:
    name: Test
    needs: lint
    runs-on: self-hosted
    container:
      image: apache/pegasus:thirdparties-bin-ubuntu1804
      env:
        CCACHE_DIR: /tmp/ccache/pegasus
        CCACHE_MAXSIZE: 10G
      volumes:
        # Place ccache compilation intermediate results in host memory, that's shared among containers.
        - /tmp/ccache/pegasus:/tmp/ccache/pegasus
      # Read docs at https://docs.docker.com/storage/tmpfs/ for more details of using tmpfs in docker.
      options: --mount type=tmpfs,destination=/tmp/pegasus --cap-add=SYS_PTRACE
    steps:
      - uses: actions/checkout@v2
      - uses: dorny/paths-filter@v2
        id: changes
        with:
          filters: |
            thirdparty:
              - 'thirdparty/**'
      - name: Unpack prebuilt third-parties
        if: steps.changes.outputs.thirdparty == 'false'
        run: unzip /root/thirdparties-bin.zip -d ./thirdparty
      - name: Rebuild third-parties
        if: steps.changes.outputs.thirdparty == 'true'
        working-directory: thirdparty
        run: |
          mkdir build
          cmake -DCMAKE_BUILD_TYPE=Release -B build/
          cmake --build build/ -j $(($(nproc)/2+1))
      - name: Compilation
        run: ./run.sh build -c --skip_thirdparty
      - name: Unit Testing
        run: |
          export LD_LIBRARY_PATH=`pwd`/thirdparty/output/lib:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server          
          ulimit -s unlimited
          ./run.sh test --skip_thirdparty

  test-with-sanitizer-address:
    name: Test With Sanitizer Address
    needs: lint
    runs-on: self-hosted
    container:
      image: apache/pegasus:thirdparties-bin-ubuntu1804
      env:
        CCACHE_DIR: /tmp/ccache/pegasus
        CCACHE_MAXSIZE: 10G
      volumes:
        # Place ccache compilation intermediate results in host memory, that's shared among containers.
        - /tmp/ccache/pegasus:/tmp/ccache/pegasus
      # Read docs at https://docs.docker.com/storage/tmpfs/ for more details of using tmpfs in docker.
      options: --mount type=tmpfs,destination=/tmp/pegasus --cap-add=SYS_PTRACE
    steps:
      - uses: actions/checkout@v2
      - uses: dorny/paths-filter@v2
        id: changes
        with:
          filters: |
            thirdparty:
              - 'thirdparty/**'
      - name: Unpack prebuilt third-parties
        if: steps.changes.outputs.thirdparty == 'false'
        run: unzip /root/thirdparties-bin.zip -d ./thirdparty
      - name: Rebuild third-parties
        if: steps.changes.outputs.thirdparty == 'true'
        working-directory: thirdparty
        run: |
          mkdir build
          cmake -DCMAKE_BUILD_TYPE=Release -B build/
          cmake --build build/ -j $(($(nproc)/2+1))
      - name: Compilation
        run: ./run.sh build -c --sanitizer address --skip_thirdparty --disable_gperf
      - name: Unit Testing
        run: |
          export LD_LIBRARY_PATH=`pwd`/thirdparty/output/lib:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server          
          ulimit -s unlimited
          ./run.sh test --sanitizer address --skip_thirdparty --disable_gperf

  test-with-sanitizer-leak:
    name: Test With Sanitizer Leak
    needs: lint
    runs-on: self-hosted
    container:
      image: apache/pegasus:thirdparties-bin-ubuntu1804
      env:
        CCACHE_DIR: /tmp/ccache/pegasus
        CCACHE_MAXSIZE: 10G
      volumes:
        # Place ccache compilation intermediate results in host memory, that's shared among containers.
        - /tmp/ccache/pegasus:/tmp/ccache/pegasus
      # Read docs at https://docs.docker.com/storage/tmpfs/ for more details of using tmpfs in docker.
      options: --mount type=tmpfs,destination=/tmp/pegasus --cap-add=SYS_PTRACE
    steps:
      - uses: actions/checkout@v2
      - uses: dorny/paths-filter@v2
        id: changes
        with:
          filters: |
            thirdparty:
              - 'thirdparty/**'
      - name: Unpack prebuilt third-parties
        if: steps.changes.outputs.thirdparty == 'false'
        run: unzip /root/thirdparties-bin.zip -d ./thirdparty
      - name: Rebuild third-parties
        if: steps.changes.outputs.thirdparty == 'true'
        working-directory: thirdparty
        run: |
          mkdir build
          cmake -DCMAKE_BUILD_TYPE=Release -B build/
          cmake --build build/ -j $(($(nproc)/2+1))
      - name: Compilation
        run: ./run.sh build -c --sanitizer leak --skip_thirdparty --disable_gperf
      - name: Unit Testing
        run: |
          export LD_LIBRARY_PATH=`pwd`/thirdparty/output/lib:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server          
          ulimit -s unlimited
          ./run.sh test --sanitizer leak --skip_thirdparty --disable_gperf

  test-with-sanitizer-undefined:
    name: Test With Sanitizer Undefined
    needs: lint
    runs-on: self-hosted
    container:
      image: apache/pegasus:thirdparties-bin-ubuntu1804
      env:
        CCACHE_DIR: /tmp/ccache/pegasus
        CCACHE_MAXSIZE: 10G
      volumes:
        # Place ccache compilation intermediate results in host memory, that's shared among containers.
        - /tmp/ccache/pegasus:/tmp/ccache/pegasus
      # Read docs at https://docs.docker.com/storage/tmpfs/ for more details of using tmpfs in docker.
      options: --mount type=tmpfs,destination=/tmp/pegasus --cap-add=SYS_PTRACE
    steps:
      - uses: actions/checkout@v2
      - uses: dorny/paths-filter@v2
        id: changes
        with:
          filters: |
            thirdparty:
              - 'thirdparty/**'
      - name: Unpack prebuilt third-parties
        if: steps.changes.outputs.thirdparty == 'false'
        run: unzip /root/thirdparties-bin.zip -d ./thirdparty
      - name: Rebuild third-parties
        if: steps.changes.outputs.thirdparty == 'true'
        working-directory: thirdparty
        run: |
          mkdir build
          cmake -DCMAKE_BUILD_TYPE=Release -B build/
          cmake --build build/ -j $(($(nproc)/2+1))
      - name: Compilation
        run: ./run.sh build -c --sanitizer undefined --skip_thirdparty --disable_gperf
      - name: Unit Testing
        run: |
          export LD_LIBRARY_PATH=`pwd`/thirdparty/output/lib:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server          
          ulimit -s unlimited
          ./run.sh test --sanitizer undefined --skip_thirdparty --disable_gperf


================================================
FILE: .github/workflows/cpp_always_pass_actions.yaml
================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
---
# There are 'paths' filters for .github/workflows/cpp_actions.yaml, 
# it can be skipped, but lead CI pending, we add this
# 'always pass' action to resolve it, see more details:
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks

name: Code Lint and Unit Test

on:
  # run on each pull request
  pull_request:
    types: [ synchronize, opened, reopened ]
    paths-ignore:
      - .github/workflows/cpp_actions.yaml
      - CMakeLists.txt
      - bin/**
      - compile_thrift.py
      - include/**
      - run.sh
      - scripts/**
      - src/**
      - thirdparty/**
    branches:
      - master
      - 'v[0-9]+.*' # release branch
      - ci-test # testing branch for github action
      - '*dev' # developing branch

  # for manually triggering workflow
  workflow_dispatch:

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - run: 'echo "No build required" '

  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - run: 'echo "No build required" '

  test-with-sanitizer-address:
    name: Test With Sanitizer Address
    runs-on: ubuntu-latest
    steps:
      - run: 'echo "No build required" '

  test-with-sanitizer-leak:
    name: Test With Sanitizer Leak
    runs-on: ubuntu-latest
    steps:
      - run: 'echo "No build required" '

  test-with-sanitizer-undefined:
    name: Test With Sanitizer Undefined
    runs-on: ubuntu-latest
    steps:
      - run: 'echo "No build required" '


================================================
FILE: .github/workflows/issue_ref.yaml
================================================
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

name: Issue Check

on:
  pull_request:
    types: ['opened', 'edited', 'reopened', 'synchronize']

jobs:
  title:
    name: Issue check
    runs-on: ubuntu-latest

    steps:
      - name: Check for ticket
        uses: neofinancial/ticket-check-action@v1.3.0
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          ticketPrefix: '#'
          bodyURLRegex: 'http(s?):\/\/(github.com)(\/apache)(\/incubator-pegasus)(\/issues)\/\d+'


================================================
FILE: .github/workflows/non_cpp_actions.yaml
================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
---
name: Non-cpp Code Lint

on:
  # run on each pull request
  pull_request:
    types: [ synchronize, opened, reopened ]
    branches:
      - master
      - 'v[0-9]+.*' # release branch
      - ci-test # testing branch for github action
      - '*dev' # developing branch

  # for manually triggering workflow
  workflow_dispatch:

defaults:
  run:
    shell: bash

jobs:
  semantic_title:
    name: Lint PR title
    runs-on: ubuntu-latest
    steps:
      - uses: amannn/action-semantic-pull-request@v4.3.0
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  markdown-link-check:
    name: Check Markdown links
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: gaurav-nelson/github-action-markdown-link-check@1.0.13


================================================
FILE: .gitignore
================================================
# The MIT License (MIT)
#
# Copyright (c) 2015 Microsoft Corporation
#
# -=- Robust Distributed System Nucleus (rDSN) -=-
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

.matchfile
.kdev4/
.zk_install/
.idea
.vscode/

gcov_report/
bin/Linux/thrift
builder/
install/
test_reports/
Dockerfile
include/thrift/
DSN_ROOT

rdsn.github.config
rdsn.github.creator
rdsn.github.creator.user*
rdsn.github.files
rdsn.github.includes
rDSN.github.*
update_qt_config.sh
zookeeper-3.4.6.tar.gz
zookeeper-3.4.6/

thirdparty/build
thirdparty/src
thirdparty/output

packages/
cmake-build-debug/


================================================
FILE: .licenserc.yaml
================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
header:
  license:
    spdx-id: MIT
    copyright-owner: Microsoft Corporation
    content: |
      The MIT License (MIT)
     
      Copyright (c) 2015 Microsoft Corporation
     
      -=- Robust Distributed System Nucleus (rDSN) -=-
     
      Permission is hereby granted, free of charge, to any person obtaining a copy
      of this software and associated documentation files (the "Software"), to deal
      in the Software without restriction, including without limitation the rights
      to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
      copies of the Software, and to permit persons to whom the Software is
      furnished to do so, subject to the following conditions:
     
      The above copyright notice and this permission notice shall be included in
      all copies or substantial portions of the Software.
     
      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
      AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
      OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
      THE SOFTWARE.

  paths-ignore:
    # All the type of licenses of this project should be added to LICENSE.
    - 'LICENSE'
    # Apache license 2.0
    - 'src/common/backup.thrift'
    - 'src/common/bulk_load.thrift'
    - 'src/common/duplication.thrift'
    - 'src/common/partition_split.thrift'
    - 'src/runtime/rpc/request_meta.thrift'
    - 'src/runtime/security/security.thrift'
    - '.licenserc.yaml'
    - 'bin/FindJemalloc.cmake'
    - 'bin/compiler_info.cmake'
    - 'bin/thrift_utils.cmake'
    - 'CONTRIBUTING.md'
    - '.github/workflows/check_license_header.yaml'
    - '.github/workflows/compilation.yaml'
    - '.github/workflows/cpp_actions.yaml'
    - '.github/workflows/cpp_always_pass_actions.yaml'
    - '.github/workflows/issue_ref.yaml'
    - '.github/workflows/non_cpp_actions.yaml'
    - 'include/dsn/dist/fmt_logging.h'
    - 'include/dsn/dist/block_service.h'
    - 'include/dsn/dist/common.h'
    - 'include/dsn/dist/remote_command.h'
    - 'include/dsn/dist/replication/mutation_duplicator.h'
    - 'include/dsn/dist/replication/duplication_common.h'
    - 'include/dsn/dist/replication/replication_types.h'
    - 'include/dsn/utility/clock.h'
    - 'include/dsn/utility/preloadable.h'
    - 'include/dsn/utility/sys_exit_hook.h'
    - 'include/dsn/utils/token_buckets.h'
    - 'include/dsn/utils/latency_tracer.h'
    - 'include/dsn/utils/token_bucket_throttling_controller.h'
    - 'include/dsn/http/http_server.h'
    - 'include/dsn/cpp/message_utils.h'
    - 'include/dsn/cpp/rpc_holder.h'
    - 'include/dsn/cpp/pipeline.h'
    - 'include/dsn/perf_counter/perf_counter_utils.h'
    - 'include/dsn/utility/endians.h'
    - 'include/dsn/utility/fail_point.h'
    - 'include/dsn/utility/singleton.h'
    - 'include/dsn/utility/process_utils.h'
    - 'include/dsn/utility/flags.h'
    - 'include/dsn/utility/string_conv.h'
    - 'include/dsn/utility/timer.h'
    - 'include/dsn/utility/output_utils.h'
    - 'include/dsn/utility/string_splitter.h'
    - 'include/dsn/utility/rand.h'
    - 'include/dsn/utility/math.h'
    - 'include/dsn/utility/defer.h'
    - 'include/dsn/utility/alloc.h'
    - 'include/dsn/utility/casts.h'
    - 'include/dsn/utility/long_adder.h'
    - 'include/dsn/utility/metrics.h'
    - 'include/dsn/utility/nth_element.h'
    - 'src/aio/aio_task.cpp'
    - 'src/aio/test/main.cpp'
    - 'src/meta/test/meta_http_service_test.cpp'
    - 'src/meta/test/meta_service_test.cpp'
    - 'src/perf_counter/perf_counter_atomic.h'
    - 'src/perf_counter/test/main.cpp'
    - 'src/remote_cmd/remote_command.cpp'
    - 'src/runtime/sim_clock.h'
    - 'src/runtime/test/replica_access_controller_test.cpp'
    - 'src/runtime/test/server_negotiation_test.cpp'
    - 'src/runtime/test/negotiation_manager_test.cpp'
    - 'src/runtime/test/task_test.cpp'
    - 'src/runtime/test/client_negotiation_test.cpp'
    - 'src/runtime/test/message_reader_test.cpp'
    - 'src/runtime/test/thrift_message_parser_test.cpp'
    - 'src/runtime/test/meta_access_controller_test.cpp'
    - 'src/runtime/security/sasl_wrapper.h'
    - 'src/runtime/security/sasl_server_wrapper.cpp'
    - 'src/runtime/security/server_negotiation.cpp'
    - 'src/runtime/security/server_negotiation.h'
    - 'src/runtime/security/sasl_server_wrapper.h'
    - 'src/runtime/security/access_controller.h'
    - 'src/runtime/security/access_controller.cpp'
    - 'src/runtime/security/sasl_init.h'
    - 'src/runtime/security/negotiation_manager.h'
    - 'src/runtime/security/sasl_client_wrapper.cpp'
    - 'src/runtime/security/kinit_context.cpp'
    - 'src/runtime/security/client_negotiation.cpp'
    - 'src/runtime/security/sasl_init.cpp'
    - 'src/runtime/security/kinit_context.h'
    - 'src/runtime/security/negotiation.cpp'
    - 'src/runtime/security/negotiation_manager.cpp'
    - 'src/runtime/security/client_negotiation.h'
    - 'src/runtime/security/negotiation.h'
    - 'src/runtime/security/security.thrift'
    - 'src/runtime/security/sasl_wrapper.cpp'
    - 'src/runtime/security/replica_access_controller.cpp'
    - 'src/runtime/security/meta_access_controller.h'
    - 'src/runtime/security/init.cpp'
    - 'src/runtime/security/init.h'
    - 'src/runtime/security/replica_access_controller.h'
    - 'src/runtime/security/sasl_client_wrapper.h'
    - 'src/runtime/security/negotiation_utils.h'
    - 'src/runtime/security/meta_access_controller.cpp'
    - 'src/runtime/rpc/request_meta.thrift'
    - 'src/meta/meta_state_service_utils_impl.h'
    - 'src/meta/meta_bulk_load_ingestion_context.cpp'
    - 'src/meta/partition_guardian.h'
    - 'src/meta/app_balance_policy.cpp'
    - 'src/meta/test/meta_test_base.h'
    - 'src/meta/test/meta_app_operation_test.cpp'
    - 'src/meta/test/meta_mauanl_compaction_test.cpp'
    - 'src/meta/test/meta_bulk_load_service_test.cpp'
    - 'src/meta/test/ford_fulkerson_test.cpp'
    - 'src/meta/test/cluster_balance_policy_test.cpp'
    - 'src/meta/test/meta_test_base.cpp'
    - 'src/meta/test/dummy_balancer.h'
    - 'src/meta/test/meta_bulk_load_ingestion_test.cpp'
    - 'src/meta/test/meta_backup_test.cpp'
    - 'src/meta/test/backup_test.cpp'
    - 'src/meta/test/main.cpp'
    - 'src/meta/test/server_state_restore_test.cpp'
    - 'src/meta/test/copy_replica_operation_test.cpp'
    - 'src/meta/app_env_validator.cpp'
    - 'src/meta/meta_rpc_types.h'
    - 'src/meta/load_balance_policy.cpp'
    - 'src/meta/meta_bulk_load_service.cpp'
    - 'src/meta/cluster_balance_policy.cpp'
    - 'src/meta/meta_split_service.cpp'
    - 'src/meta/cluster_balance_policy.h'
    - 'src/meta/app_env_validator.h'
    - 'src/meta/meta_bulk_load_service.h'
    - 'src/meta/backup_engine.cpp'
    - 'src/meta/backup_engine.h'
    - 'src/meta/meta_backup_service.cpp'
    - 'src/meta/meta_backup_service.h'
    - 'src/meta/meta_http_service.h'
    - 'src/meta/meta_split_service.h'
    - 'src/meta/meta_state_service_utils.h'
    - 'src/meta/meta_state_service_utils.cpp'
    - 'src/meta/meta_http_service.cpp'
    - 'src/meta/app_balance_policy.h'
    - 'src/meta/partition_guardian.cpp'
    - 'src/meta/meta_bulk_load_ingestion_context.h'
    - 'src/meta/load_balance_policy.h'
    - 'src/meta/duplication/duplication_info.h'
    - 'src/meta/duplication/meta_duplication_service.h'
    - 'src/meta/duplication/duplication_info.cpp'
    - 'src/meta/duplication/meta_duplication_service.cpp'
    - 'src/meta/server_state_restore.cpp'
    - 'src/utils/clock.cpp'
    - 'src/utils/flags.cpp'
    - 'src/utils/throttling_controller.h'
    - 'src/utils/time_utils.cpp'
    - 'src/utils/test/rand_test.cpp'
    - 'src/utils/test/latency_tracer_test.cpp'
    - 'src/utils/test/binary_reader_test.cpp'
    - 'src/utils/test/fail_point_test.cpp'
    - 'src/utils/test/hostname_test.cpp'
    - 'src/utils/test/token_bucket_throttling_controller_test.cpp'
    - 'src/utils/test/file_system_test.cpp'
    - 'src/utils/test/endian_test.cpp'
    - 'src/utils/test/token_buckets_test.cpp'
    - 'src/utils/test/flag_test.cpp'
    - 'src/utils/test/main.cpp'
    - 'src/utils/fail_point.cpp'
    - 'src/utils/math.cpp'
    - 'src/utils/latency_tracer.cpp'
    - 'src/utils/fail_point_impl.h'
    - 'src/utils/process_utils.cpp'
    - 'src/utils/token_bucket_throttling_controller.cpp'
    - 'src/utils/token_buckets.cpp'
    - 'src/utils/rand.cpp'
    - 'src/utils/throttling_controller.cpp'
    - 'src/utils/output_utils.cpp'
    - 'src/utils/alloc.cpp'
    - 'src/utils/long_adder.cpp'
    - 'src/utils/long_adder_bench/long_adder_bench.cpp'
    - 'src/utils/metrics.cpp'
    - 'src/utils/shared_io_service.cpp'
    - 'src/utils/test/long_adder_test.cpp'
    - 'src/utils/test/metrics_test.cpp'
    - 'src/utils/test/nth_element_bench/nth_element_bench.cpp'
    - 'src/utils/test/nth_element_test.cpp'
    - 'src/utils/test/nth_element_utils.h'
    - 'src/utils/test/percentile_utils.h'
    - 'src/common/partition_split.thrift'
    - 'src/common/common.cpp'
    - 'src/common/consensus.thrift'
    - 'src/common/backup_common.h'
    - 'src/common/bulk_load_common.cpp'
    - 'src/common/test/fs_manager_test.cpp'
    - 'src/common/test/common_test.cpp'
    - 'src/common/test/replication_common_test.cpp'
    - 'src/common/fs_manager.h'
    - 'src/common/backup_common.cpp'
    - 'src/common/bulk_load_common.h'
    - 'src/common/duplication.thrift'
    - 'src/common/manual_compact.h'
    - 'src/common/duplication_common.cpp'
    - 'src/common/partition_split_common.h'
    - 'src/common/metadata.thrift'
    - 'src/common/meta_admin.thrift'
    - 'src/common/bulk_load.thrift'
    - 'src/common/backup.thrift'
    - 'src/common/replica_admin.thrift'
    - 'src/http/CMakeLists.txt'
    - 'src/http/builtin_http_calls.h'
    - 'src/http/test/http_server_test.cpp'
    - 'src/http/test/perf_counter_http_service_test.cpp'
    - 'src/http/test/uri_decoder_test.cpp'
    - 'src/http/http_server_impl.h'
    - 'src/http/uri_decoder.cpp'
    - 'src/http/uri_decoder.h'
    - 'src/http/http_server.cpp'
    - 'src/http/perf_counter_http_service.cpp'
    - 'src/http/pprof_http_service.cpp'
    - 'src/http/builtin_http_calls.cpp'
    - 'src/http/service_version.cpp'
    - 'src/http/pprof_http_service.h'
    - 'src/http/service_version.h'
    - 'src/http/config_http_service.cpp'
    - 'src/http/http_call_registry.h'
    - 'src/block_service/CMakeLists.txt'
    - 'src/block_service/test/fds_service_test.cpp'
    - 'src/block_service/test/CMakeLists.txt'
    - 'src/block_service/test/hdfs_service_test.cpp'
    - 'src/block_service/test/local_service_test.cpp'
    - 'src/block_service/test/run.sh'
    - 'src/block_service/test/block_service_mock.h'
    - 'src/block_service/test/clear.sh'
    - 'src/block_service/test/main.cpp'
    - 'src/block_service/test/block_service_manager_test.cpp'
    - 'src/block_service/directio_writable_file.h'
    - 'src/block_service/fds/fds_service.cpp'
    - 'src/block_service/fds/fds_service.h'
    - 'src/block_service/block_service_manager.cpp'
    - 'src/block_service/block_service_manager.h'
    - 'src/block_service/local/local_service.cpp'
    - 'src/block_service/local/local_service.h'
    - 'src/block_service/hdfs/hdfs_service.cpp'
    - 'src/block_service/hdfs/hdfs_service.h'
    - 'src/block_service/directio_writable_file.cpp'
    - 'src/replica/replica_disk_migrator.cpp'
    - 'src/replica/split/replica_split_manager.cpp'
    - 'src/replica/split/test/replica_split_test.cpp'
    - 'src/replica/split/test/main.cpp'
    - 'src/replica/split/replica_split_manager.h'
    - 'src/replica/replica_http_service.cpp'
    - 'src/replica/log_block.cpp'
    - 'src/replica/test/replica_learn_test.cpp'
    - 'src/replica/test/log_file_test.cpp'
    - 'src/replica/test/throttling_controller_test.cpp'
    - 'src/replica/test/replica_disk_test_base.h'
    - 'src/replica/test/cold_backup_context_test.cpp'
    - 'src/replica/test/replica_disk_test.cpp'
    - 'src/replica/test/log_block_test.cpp'
    - 'src/replica/test/clear.sh'
    - 'src/replica/test/replica_test.cpp'
    - 'src/replica/test/replica_disk_migrate_test.cpp'
    - 'src/replica/test/main.cpp'
    - 'src/replica/test/backup_block_service_mock.h'
    - 'src/replica/test/open_replica_test.cpp'
    - 'src/replica/replica_backup.cpp'
    - 'src/replica/disk_cleaner.h'
    - 'src/replica/mutation_log_replay.cpp'
    - 'src/replica/bulk_load/test/replica_bulk_loader_test.cpp'
    - 'src/replica/bulk_load/test/main.cpp'
    - 'src/replica/bulk_load/replica_bulk_loader.cpp'
    - 'src/replica/bulk_load/replica_bulk_loader.h'
    - 'src/replica/disk_cleaner.cpp'
    - 'src/replica/replica_disk_migrator.h'
    - 'src/replica/log_block.h'
    - 'src/replica/replica_throttle.cpp'
    - 'src/replica/backup/cold_backup_context.h'
    - 'src/replica/backup/cold_backup_context.cpp'
    - 'src/replica/backup/test/replica_backup_manager_test.cpp'
    - 'src/replica/backup/test/main.cpp'
    - 'src/replica/backup/replica_backup_manager.h'
    - 'src/replica/backup/replica_backup_server.cpp'
    - 'src/replica/backup/replica_backup_manager.cpp'
    - 'src/replica/backup/replica_backup_server.h'
    - 'src/replica/replica_http_service.h'
    - 'src/replica/replica_restore.cpp'
    - 'src/replica/duplication/mutation_batch.h'
    - 'src/replica/duplication/replica_follower.cpp'
    - 'src/replica/duplication/replica_duplicator_manager.cpp'
    - 'src/replica/duplication/duplication_pipeline.cpp'
    - 'src/replica/duplication/replica_follower.h'
    - 'src/replica/duplication/replica_duplicator_manager.h'
    - 'src/replica/duplication/test/replica_http_service_test.cpp'
    - 'src/replica/duplication/test/replica_duplicator_manager_test.cpp'
    - 'src/replica/duplication/test/duplication_sync_timer_test.cpp'
    - 'src/replica/duplication/test/load_from_private_log_test.cpp'
    - 'src/replica/duplication/test/duplication_test_base.h'
    - 'src/replica/duplication/test/replica_follower_test.cpp'
    - 'src/replica/duplication/test/ship_mutation_test.cpp'
    - 'src/replica/duplication/test/mutation_batch_test.cpp'
    - 'src/replica/duplication/test/replica_duplicator_test.cpp'
    - 'src/replica/duplication/test/main.cpp'
    - 'src/replica/duplication/replica_duplicator.h'
    - 'src/replica/duplication/duplication_pipeline.h'
    - 'src/replica/duplication/load_from_private_log.h'
    - 'src/replica/duplication/mutation_batch.cpp'
    - 'src/replica/duplication/duplication_sync_timer.h'
    - 'src/replica/duplication/duplication_sync_timer.cpp'
    - 'src/replica/duplication/load_from_private_log.cpp'
    - 'src/replica/duplication/replica_duplicator.cpp'
    - 'src/perf_counter/builtin_counters.cpp'
    - 'src/perf_counter/builtin_counters.h'
    # Copyright (c) Facebook, Inc
    - 'include/dsn/utility/TokenBucket.h'
    - 'src/utils/test/TokenBucketTest.cpp'
    - 'src/utils/test/TokenBucketTest.h'
    # https://github.com/preshing/cpp11-on-multicore/blob/master/LICENSE
    - 'include/dsn/utility/hpc_locks/autoreseteventcondvar.h'
    - 'include/dsn/utility/hpc_locks/rwlock.h'
    - 'include/dsn/utility/hpc_locks/autoresetevent.h'
    - 'include/dsn/utility/hpc_locks/sema.h'
    - 'include/dsn/utility/hpc_locks/bitfield.h'
    - 'include/dsn/utility/hpc_locks/benaphore.h'
    # Copyright (c) xxxx The Chromium Authors
    - 'src/runtime/build_config.h'
    - 'src/utils/test/autoref_ptr_test.cpp'
    - 'include/dsn/utility/safe_strerror_posix.h'
    - 'src/runtime/build_config.h'
    - 'src/utils/test/autoref_ptr_test.cpp'
    - 'src/utils/safe_strerror_posix.cpp'
    # Copyright 2017 The Abseil Authors
    - 'include/dsn/utility/absl/base/internal/invoke.h'
    - 'include/dsn/utility/absl/utility/utility.h'
    - 'include/dsn/utility/smart_pointers.h'
    - 'include/dsn/utility/string_view.h'
    - 'src/utils/test/memutil_test.cpp'
    - 'src/utils/test/string_view_test.cpp'
    - 'src/utils/test/smart_pointers_test.cpp'
    - 'src/utils/memutil.h'
    - 'src/utils/string_view.cpp'
    # Copyright (c) 2010-2011, Rob Jansen
    - 'bin/FindRT.cmake'
    - 'bin/FindDL.cmake'
    # Copyright (c) 2017 Guillaume Papin
    - 'scripts/linux/run-clang-format.py'
    # need manual fix
    - 'src/failure_detector/test/gtest.filter'
    - 'src/meta/test/meta_state/gtest.filter'
    - 'src/meta/test/suite1'
    - 'src/meta/test/suite2'
    - 'src/nfs/test/nfs_test_file1'
    - 'src/nfs/test/nfs_test_file2'
    - 'src/runtime/test/gtest.filter'
    - 'thirdparty/fix_fds_for_macos.patch'
    - 'thirdparty/fix_s2_for_aarch64.patch'
    - 'thirdparty/fix_thrift_for_cpp11.patch'
    # should be empty, or ignore all comment lines
    - 'src/utils/test/config-empty.ini'

  comment: on-failure


================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.11.0)

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
    # require at least gcc 5.4.0
    if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.4.0)
        message(FATAL_ERROR "GCC version must be at least 5.4.0!")
    endif ()
endif ()

project(dsn C CXX)

include(bin/dsn.cmake)

set(DSN_BUILD_RUNTIME TRUE)
add_definitions(-DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=0)
dsn_common_setup()

# add custom target for gcov
if(ENABLE_GCOV)
    find_program(GCOV_PATH gcov)
    find_program(GCOVR_PATH gcovr)

    if(NOT GCOV_PATH)
        message(FATAL_ERROR "gcov not found! Aborting...")
    endif() # NOT GCOV_PATH

    if(NOT GCOVR_PATH)
        message(FATAL_ERROR "gcovr not found! Aborting...")
    endif() # NOT GCOVR_PATH

    if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
        message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading")
    endif() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"

    set(COVERAGE_COMPILER_FLAGS "-g -O0 --coverage -fprofile-arcs -ftest-coverage" CACHE INTERNAL "")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_COMPILER_FLAGS}")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}")
    message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}")

    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
    add_definitions(-DENABLE_GCOV=1)
endif()

if(SANITIZER)
    add_definitions(-DSANITIZER=1)
endif()
# Users don't have to configure CMAKE_INSTALL_PREFIX unless they want to customize
# the destination.
set(CMAKE_INSTALL_PREFIX ${DSN_ROOT} CACHE STRING "" FORCE)
message (STATUS "dsn Installation directory: CMAKE_INSTALL_PREFIX = " ${CMAKE_INSTALL_PREFIX})

# install rdsn/include to ${CMAKE_INCLUDE_PREFIX}/include
install(DIRECTORY include/ DESTINATION include)

# NOTE: dsn_types.h is not actually a thrift-generated file. As pegasus may reference it,
# we should copy also this file to the path the same as other thrift-generated files.
install(FILES include/dsn/cpp/serialization_helper/dsn_types.h DESTINATION include)
# TODO(wutao1): remove this line after dsn.layer2_types.h is removed from repo.
install(FILES include/dsn/cpp/serialization_helper/dsn.layer2_types.h DESTINATION include)

include_directories(${DSN_PROJECT_DIR}/include)
include_directories(${DSN_PROJECT_DIR}/include/dsn/cpp/serialization_helper)
include_directories(${DSN_PROJECT_DIR}/src)

add_subdirectory(src)


================================================
FILE: CONTRIBUTING.md
================================================
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

# Contributing to Pegasus

This is a rough outline of what a contributor's workflow looks like:

- Create a topic branch from where you want to base your work. This is usually master.
- Make commits of logical units and add test case if the change fixes a bug or adds new functionality.
- Run tests and make sure all the tests are passed.
- Make sure your commit messages are in the proper format (see below).
- Push your changes to a topic branch in your fork of the repository.
- Submit a pull request.
- Your PR must receive LGTMs from two maintainers.

Thanks for your contributions!

### Format of the Commit Message

We follow a rough convention for commit messages that is designed to answer two
questions: what changed and why. The subject line should feature the what and
the body of the commit should describe the why.

```
utility: introduce rpc_holder

This is a wrapper of dsn_message_t. It manages the lifetime follow RAII.

Fix #10
```

The format can be described more formally as follows:

```
<subsystem>: <what changed>
<BLANK LINE>
<why this change was made>
<BLANK LINE>
<footer>(optional)
```

The first line is the subject and should be no longer than 70 characters, the
second line is always blank, and other lines should be wrapped at 80 characters.
This allows the message to be easier to read on GitHub as well as in various
git tools.

If the change affects more than one subsystem, you can use comma to separate them like `util/codec,util/types:`.

If the change affects many subsystems, you can use ```*``` instead, like ```*:```.

For the why part, if no specific reason for the change,
you can use one of some generic reasons like "Improve documentation.",
"Improve performance.", "Improve robustness.", "Improve test coverage."


================================================
FILE: LICENSE
================================================
The MIT License (MIT)

Copyright (c) Microsoft Corporation

All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--------------------------------------------------------------------------------

include/dsn/utility/TokenBucket.h - Apache License, Version 2.0
src/utils/test/TokenBucketTest.cpp
src/utils/test/TokenBucketTest.h

Copyright (c) Facebook, Inc. and its affiliates.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

--------------------------------------------------------------------------------

include/dsn/utility/hpc_locks/autoreseteventcondvar.h - zlib License
include/dsn/utility/hpc_locks/rwlock.h
include/dsn/utility/hpc_locks/autoresetevent.h
include/dsn/utility/hpc_locks/sema.h
include/dsn/utility/hpc_locks/bitfield.h
include/dsn/utility/hpc_locks/benaphore.h

Copyright (c) 2015 Jeff Preshing

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
   claim that you wrote the original software. If you use this software
   in a product, an acknowledgement in the product documentation would be
   appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
   misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

--------------------------------------------------------------------------------

src/runtime/build_config.h - BSD-3-Clause license
src/utils/test/autoref_ptr_test.cpp
include/dsn/utility/safe_strerror_posix.h
src/runtime/build_config.h
src/utils/test/autoref_ptr_test.cpp
src/utils/safe_strerror_posix.cpp

Copyright (c) 2012 The Chromium Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

   * Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
   * Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------------------

include/dsn/utility/absl/base/internal/invoke.h - Apache License, Version 2.0
include/dsn/utility/absl/utility/utility.h
include/dsn/utility/smart_pointers.h
include/dsn/utility/string_view.h
src/utils/test/memutil_test.cpp
src/utils/test/string_view_test.cpp
src/utils/test/smart_pointers_test.cpp
src/utils/memutil.h
src/utils/string_view.cpp

Copyright 2017 The Abseil Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

--------------------------------------------------------------------------------

bin/FindRT.cmake - BSD-3-Clause license
bin/FindDL.cmake

Copyright (c) 2010-2011, Rob Jansen

To the extent that a federal employee is an author of a portion of
this software or a derivative work thereof, no copyright is claimed by
the United States Government, as represented by the Secretary of the
Navy ("GOVERNMENT") under Title 17, U.S. Code. All Other Rights
Reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
    * Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
    * Neither the names of the copyright owners nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
GOVERNMENT ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION
AND DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
RESULTING FROM THE USE OF THIS SOFTWARE.

--------------------------------------------------------------------------------

scripts/linux/run-clang-format.py - MIT License

MIT License

Copyright (c) 2017 Guillaume Papin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: README.md
================================================
<!--
  ~ The MIT License (MIT)
  ~
  ~ Copyright (c) 2015 Microsoft Corporation
  ~
  ~ -=- Robust Distributed System Nucleus (rDSN) -=-
  ~
  ~ Permission is hereby granted, free of charge, to any person obtaining a copy
  ~ of this software and associated documentation files (the "Software"), to deal
  ~ in the Software without restriction, including without limitation the rights
  ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  ~ copies of the Software, and to permit persons to whom the Software is
  ~ furnished to do so, subject to the following conditions:
  ~
  ~ The above copyright notice and this permission notice shall be included in
  ~ all copies or substantial portions of the Software.
  ~
  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  ~ THE SOFTWARE.
-->

[![Build Status](https://travis-ci.org/XiaoMi/rdsn.svg?branch=master)](https://travis-ci.org/XiaoMi/rdsn)

All pull requests please now go to https://github.com/imzhenyu/rdsn for automatic integration with latest version. We will periodically update this repo. Thank you.

### Top Links
 * [[Case](https://github.com/imzhenyu/rocksdb)] RocksDB made replicated using rDSN!
 * [[Tutorial](https://github.com/Microsoft/rDSN/wiki/Tutorial:-Build-A-Single-Node-Counter-Service)] Build a counter service with built-in tools (e.g., codegen, auto-test, fault injection, bug replay, tracing)
 * [[Tutorial](https://github.com/Microsoft/rDSN/wiki/Tutorial:-Build-A-Scalable-and-Reliable-Counter-Service)] Build a scalable and reliable counter service with built-in replication support
 * [[Tutorial](https://github.com/Microsoft/rDSN/wiki/Tutorial:-Perfect-Failure-Detector)] Build a perfect failure detector with progressively added system complexity
 * [[Tutorial](https://github.com/Microsoft/rDSN/wiki/Tutorial:-Plugin-A-New-Network-Implementation)] Plugin my own network implementation for higher performance
 * [Installation](https://github.com/Microsoft/rDSN/wiki/Installation)
 
<hr>

**Robust Distributed System Nucleus (rDSN)** is a framework for quickly building robust distributed systems. It has a microkernel for pluggable components, including applications, distributed frameworks, devops tools, and local runtime/resource providers, enabling their independent development and seamless integration. The project was originally developed for Microsoft Bing, and now has been adopted in production both inside and outside Microsoft. 

* [How does rDSN build robustness?](#novel)
* [What I can do with rDSN?](#cando)
* [What are the existing modules I can immediately use?] (#existing)

### <a name="cando"> What I can do with rDSN? </a>

 * an enhanced event-driven RPC library such as libevent, Thrift, and GRPC
 * a production Paxos framework to quickly turn a local component (e.g., rocksdb) into a online service with replication, partition, failure recovery, and reconfiguration supports
 * a scale-out and fail-over framework for stateless services such as Memcached
 * more as you can imagine.

### <a name="novel"> How does rDSN build robustness? </a> 

 * **reduced system complexity via microkernel architecture**: applications, frameworks (e.g., replication, scale-out, fail-over), local runtime libraries (e.g., network libraries, locks), and tools are all pluggable modules into a microkernel to enable independent development and seamless integration (therefore modules are reusable and transparently benefit each other) 
 ![rDSN Architecture](resources/arch.png)
 * **auto-handled distributed system challenges**: built-in frameworks to achieve scalability, reliability, availability, and consistency etc. for the applications
 ![rDSN service model](resources/rdsn-layer2.jpg)
 * **transparent tooling support**: dedicated tool API for tool development; built-in plugged tools for understanding, testing, debugging, and monitoring the upper applications and frameworks 
 ![rDSN Architecture](resources/viz.png)
 * **late resource binding with global deploy-time view**: tailor the module instances and their connections on demand with controllable system complexity and resource mapping (e.g., run all nodes in one simulator for testing, allocate CPU resources appropriately for avoiding resource contention, debug with progressively added system complexity) 
 ![rDSN Configuration](resources/config.png)
 
 
### <a name="existing">Existing pluggable modules (and growing) </a>

##### Distributed frameworks

 * a production Paxos framework to quickly turn a local component (e.g., rocksdb) into an online service with replication, partition, failure recovery, and reconfiguration supports
 * a scale-out and fail-over framework for stateless services such as Memcached

##### Local runtime libraries 

 * network libraries on Linux/Windows supporting rDSN/Thrift/HTTP messages at the same time
 * asynchronous disk IO on Linux/Windows
 * locks, rwlocks, semaphores
 * task queues 
 * timer services
 * performance counters
 * loggers (high-perf, screen)

##### Devops tools

 * nativerun and fastrun enables native deployment on Windows and Linux 
 * simulator debugs multiple nodes in one single process without worry about timeout
 * explorer extracts task-level dependencies automatically
 * tracer dumps logs for how requests are processed across tasks/nodes
 * profiler shows detailed task-level performance data (e.g., queue-time, exec-time)
 * fault-injector mimics data center failures to expose bugs early
 * global-checker enables cross-node assertion 
 * replayer reproduces the bugs for easier root cause analysis
 * build-in web studio to visualize task-level performance and dependency information

##### Other distributed providers and libraries

 * remote file copy 
 * perfect failure detector
 * multi-master perfect failure detector 

### License and Support

rDSN is provided on Windows and Linux, with the MIT open source license. You can use the "issues" tab in GitHub to report bugs. 



================================================
FILE: bin/FindDL.cmake
================================================
# Copyright (c) 2010-2011, Rob Jansen

# To the extent that a federal employee is an author of a portion of
# this software or a derivative work thereof, no copyright is claimed by
# the United States Government, as represented by the Secretary of the
# Navy ("GOVERNMENT") under Title 17, U.S. Code. All Other Rights 
# Reserved.

# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#     * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
#     * Neither the names of the copyright owners nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# GOVERNMENT ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION
# AND DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
# RESULTING FROM THE USE OF THIS SOFTWARE.

# - Check for the presence of DL
#
# The following variables are set when DL is found:
#  HAVE_DL       = Set to true, if all components of DL
#                          have been found.
#  DL_INCLUDES   = Include path for the header files of DL
#  DL_LIBRARIES  = Link these to use DL

## -----------------------------------------------------------------------------
## Check for the header files

find_path (DL_INCLUDES dlfcn.h
  PATHS /usr/local/include /usr/include ${CMAKE_EXTRA_INCLUDES}
  )

## -----------------------------------------------------------------------------
## Check for the library

find_library (DL_LIBRARIES dl
  PATHS /usr/local/lib64 /usr/lib64 /lib64 ${CMAKE_EXTRA_LIBRARIES}
  )

## -----------------------------------------------------------------------------
## Actions taken when all components have been found

if (DL_INCLUDES AND DL_LIBRARIES)
  set (HAVE_DL TRUE)
else (DL_INCLUDES AND DL_LIBRARIES)
  if (NOT DL_FIND_QUIETLY)
    if (NOT DL_INCLUDES)
      message (STATUS "Unable to find DL header files!")
    endif (NOT DL_INCLUDES)
    if (NOT DL_LIBRARIES)
      message (STATUS "Unable to find DL library files!")
    endif (NOT DL_LIBRARIES)
  endif (NOT DL_FIND_QUIETLY)
endif (DL_INCLUDES AND DL_LIBRARIES)

if (HAVE_DL)
  if (NOT DL_FIND_QUIETLY)
    message (STATUS "Found components for DL")
    message (STATUS "DL_INCLUDES = ${DL_INCLUDES}")
    message (STATUS "DL_LIBRARIES = ${DL_LIBRARIES}")
  endif (NOT DL_FIND_QUIETLY)
else (HAVE_DL)
  if (DL_FIND_REQUIRED)
    message (FATAL_ERROR "Could not find DL!")
  endif (DL_FIND_REQUIRED)
endif (HAVE_DL)

mark_as_advanced (
  HAVE_DL
  DL_LIBRARIES
  DL_INCLUDES
  )

================================================
FILE: bin/FindJemalloc.cmake
================================================
##############################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
##############################################################################

find_path(Jemalloc_INCLUDE_DIRS
    NAMES jemalloc/jemalloc.h
    PATHS ${DSN_THIRDPARTY_ROOT}/include
    NO_DEFAULT_PATH
)

find_library(Jemalloc_SHARED_LIBRARIES
    NAMES jemalloc
    PATHS ${DSN_THIRDPARTY_ROOT}/lib
    NO_DEFAULT_PATH
)

find_library(Jemalloc_STATIC_LIBRARIES
    NAMES libjemalloc_pic.a
    PATHS ${DSN_THIRDPARTY_ROOT}/lib
    NO_DEFAULT_PATH
)

if(Jemalloc_INCLUDE_DIRS AND Jemalloc_SHARED_LIBRARIES AND Jemalloc_STATIC_LIBRARIES)
    set(Jemalloc_FOUND TRUE)
else()
    set(Jemalloc_FOUND FALSE)
endif()

if(Jemalloc_FOUND)
    message(STATUS "Found jemalloc header files: ${Jemalloc_INCLUDE_DIRS}")
    message(STATUS "Found jemalloc shared libs: ${Jemalloc_SHARED_LIBRARIES}")
    message(STATUS "Found jemalloc static libs: ${Jemalloc_STATIC_LIBRARIES}")
else()
    if(Jemalloc_FIND_REQUIRED)
        message(FATAL_ERROR "Not found jemalloc in ${DSN_THIRDPARTY_ROOT}")
    endif()
endif()

mark_as_advanced(
    Jemalloc_INCLUDE_DIRS
    Jemalloc_SHARED_LIBRARIES
    Jemalloc_STATIC_LIBRARIES
)

if(Jemalloc_FOUND AND NOT (TARGET JeMalloc::JeMalloc))
    if("${JEMALLOC_LIB_TYPE}" STREQUAL "SHARED")
        add_library(JeMalloc::JeMalloc SHARED IMPORTED)
        set_target_properties(JeMalloc::JeMalloc PROPERTIES
            INTERFACE_INCLUDE_DIRECTORIES ${Jemalloc_INCLUDE_DIRS}
            IMPORTED_LOCATION ${Jemalloc_SHARED_LIBRARIES}
        )
        message(STATUS "Use jemalloc lib type: ${JEMALLOC_LIB_TYPE}")
        message(STATUS "Use jemalloc lib: ${Jemalloc_SHARED_LIBRARIES}")
    elseif("${JEMALLOC_LIB_TYPE}" STREQUAL "STATIC")
        add_library(JeMalloc::JeMalloc STATIC IMPORTED)
        set_target_properties(JeMalloc::JeMalloc PROPERTIES
            INTERFACE_INCLUDE_DIRECTORIES ${Jemalloc_INCLUDE_DIRS}
            IMPORTED_LINK_INTERFACE_LANGUAGES "C;CXX"
            IMPORTED_LOCATION ${Jemalloc_STATIC_LIBRARIES}
        )
        message(STATUS "Use jemalloc lib type: ${JEMALLOC_LIB_TYPE}")
        message(STATUS "Use jemalloc lib: ${Jemalloc_STATIC_LIBRARIES}")
    else()
        message(FATAL_ERROR "Invalid jemalloc lib type: ${JEMALLOC_LIB_TYPE}")
    endif()
endif()


================================================
FILE: bin/FindRT.cmake
================================================
# Copyright (c) 2010-2011, Rob Jansen

# To the extent that a federal employee is an author of a portion of
# this software or a derivative work thereof, no copyright is claimed by
# the United States Government, as represented by the Secretary of the
# Navy ("GOVERNMENT") under Title 17, U.S. Code. All Other Rights 
# Reserved.

# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#     * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
#     * Neither the names of the copyright owners nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# GOVERNMENT ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION
# AND DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
# RESULTING FROM THE USE OF THIS SOFTWARE.

# - Check for the presence of RT
#
# The following variables are set when RT is found:
#  HAVE_RT       = Set to true, if all components of RT
#                          have been found.
#  RT_INCLUDES   = Include path for the header files of RT
#  RT_LIBRARIES  = Link these to use RT

## -----------------------------------------------------------------------------
## Check for the header files

find_path (RT_INCLUDES time.h
  PATHS /usr/local/include /usr/include ${CMAKE_EXTRA_INCLUDES}
  )

## -----------------------------------------------------------------------------
## Check for the library

find_library (RT_LIBRARIES rt
  PATHS /usr/local/lib64 /usr/lib64 /lib64 ${CMAKE_EXTRA_LIBRARIES}
  )

## -----------------------------------------------------------------------------
## Actions taken when all components have been found

if (RT_INCLUDES AND RT_LIBRARIES)
  set (HAVE_RT TRUE)
else (RT_INCLUDES AND RT_LIBRARIES)
  if (NOT RT_FIND_QUIETLY)
    if (NOT RT_INCLUDES)
      message (STATUS "Unable to find RT header files!")
    endif (NOT RT_INCLUDES)
    if (NOT RT_LIBRARIES)
      message (STATUS "Unable to find RT library files!")
    endif (NOT RT_LIBRARIES)
  endif (NOT RT_FIND_QUIETLY)
endif (RT_INCLUDES AND RT_LIBRARIES)

if (HAVE_RT)
  if (NOT RT_FIND_QUIETLY)
    message (STATUS "Found components for RT")
    message (STATUS "RT_INCLUDES = ${RT_INCLUDES}")
    message (STATUS "RT_LIBRARIES = ${RT_LIBRARIES}")
  endif (NOT RT_FIND_QUIETLY)
else (HAVE_RT)
  if (RT_FIND_REQUIRED)
    message (FATAL_ERROR "Could not find RT!")
  endif (RT_FIND_REQUIRED)
endif (HAVE_RT)

mark_as_advanced (
  HAVE_RT
  RT_LIBRARIES
  RT_INCLUDES
  )

================================================
FILE: bin/compiler_info.cmake
================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#
# Sets COMPILER_FAMILY to 'clang' or 'gcc'
# Sets COMPILER_VERSION to the version

include(CMakeDetermineCXXCompiler)
message("Running rdsn/bin/compiler_info.cmake")
execute_process(COMMAND env LANG=C "${CMAKE_CXX_COMPILER}" -v
                ERROR_VARIABLE COMPILER_VERSION_FULL)
message(${COMPILER_VERSION_FULL})

# clang on Linux and Mac OS X before 10.9
if("${COMPILER_VERSION_FULL}" MATCHES ".*clang version.*")
  set(COMPILER_FAMILY "clang")
  string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1"
    COMPILER_VERSION "${COMPILER_VERSION_FULL}")

# gcc
elseif("${COMPILER_VERSION_FULL}" MATCHES ".*gcc version.*")
  set(COMPILER_FAMILY "gcc")
  string(REGEX REPLACE ".*gcc version ([0-9\\.]+).*" "\\1"
    COMPILER_VERSION "${COMPILER_VERSION_FULL}")
else()
  message(FATAL_ERROR "Unknown compiler. Version info:\n${COMPILER_VERSION_FULL}")
endif()
message("Selected compiler ${COMPILER_FAMILY} ${COMPILER_VERSION}")

# gcc (and some varieties of clang) mention the path prefix where system headers
# and libraries are located.
if("${COMPILER_VERSION_FULL}" MATCHES "Configured with: .* --prefix=([^ ]*)")
  set(COMPILER_SYSTEM_PREFIX_PATH ${CMAKE_MATCH_1})
  message("Selected compiler built with --prefix=${COMPILER_SYSTEM_PREFIX_PATH}")
endif()

================================================
FILE: bin/dsn.cmake
================================================
# The MIT License (MIT)
#
# Copyright (c) 2015 Microsoft Corporation
#
# -=- Robust Distributed System Nucleus (rDSN) -=-
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

include(${CMAKE_CURRENT_LIST_DIR}/compiler_info.cmake)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR};${CMAKE_MODULE_PATH}) # TODO: move all Find*.cmake into cmake/

# Always generate the compilation database file (compile_commands.json) for use
# with various development tools, such as IWYU and Vim's YouCompleteMe plugin.
# See http://clang.llvm.org/docs/JSONCompilationDatabase.html
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)

# Set DSN_PROJECT_DIR to rdsn/
set(DSN_PROJECT_DIR ${CMAKE_CURRENT_LIST_DIR})
get_filename_component(DSN_PROJECT_DIR ${DSN_PROJECT_DIR} DIRECTORY)

# Set DSN_THIRDPARTY_ROOT to rdsn/thirdparty/output
set(DSN_THIRDPARTY_ROOT ${DSN_PROJECT_DIR}/thirdparty/output)
message(STATUS "DSN_THIRDPARTY_ROOT = ${DSN_THIRDPARTY_ROOT}")

# Set DSN_ROOT to rdsn/DSN_ROOT, this is where rdsn will be installed
set(DSN_ROOT ${DSN_PROJECT_DIR}/DSN_ROOT)
message(STATUS "DSN_ROOT = ${DSN_ROOT}")

option(BUILD_TEST "build unit test" ON)
message(STATUS "BUILD_TEST = ${BUILD_TEST}")

option(ENABLE_GCOV "Enable gcov (for code coverage analysis)" OFF)
message(STATUS "ENABLE_GCOV = ${ENABLE_GCOV}")

# Disable this option before running valgrind.
option(ENABLE_GPERF "Enable gperftools (for tcmalloc)" ON)
message(STATUS "ENABLE_GPERF = ${ENABLE_GPERF}")

option(USE_JEMALLOC "Use jemalloc" OFF)
message(STATUS "USE_JEMALLOC = ${USE_JEMALLOC}")

if(ENABLE_GPERF AND USE_JEMALLOC)
    message(FATAL_ERROR "cannot enable both gperftools and jemalloc simultaneously")
endif()

if(USE_JEMALLOC)
    set(JEMALLOC_LIB_TYPE "SHARED")
endif()

# ================================================================== #

# Helper function to add preprocesor definition of FILE_BASENAME
# to pass the filename without directory path for debugging use.
#
# Note that in header files this is not consistent with
# __FILE__ and __LINE__ since FILE_BASENAME will be the
# compilation unit source file name (.c/.cpp).
#
# Example:
#
#   define_file_basename_for_sources(my_target)
#
# Will add -DFILE_BASENAME="filename" for each source file depended on
# by my_target, where filename is the name of the file.
#
function(define_file_basename_for_sources targetname)
    get_target_property(source_files "${targetname}" SOURCES)
    foreach(sourcefile ${source_files})
        # Add the FILE_BASENAME=filename compile definition to the list.
        get_filename_component(basename "${sourcefile}" NAME)
        # Set the updated compile definitions on the source file.
        set_property(
            SOURCE "${sourcefile}" APPEND
            PROPERTY COMPILE_DEFINITIONS "__FILENAME__=\"${basename}\"")
    endforeach()
endfunction()

# Install this target into ${CMAKE_INSTALL_PREFIX}/lib
function(dsn_install_library)
    install(TARGETS ${MY_PROJ_NAME} DESTINATION "lib")
endfunction()

# Install this target into ${CMAKE_INSTALL_PREFIX}/bin/${PROJ_NAME}
function(dsn_install_executable)
    set(MY_PROJ_TYPE "EXECUTABLE")
    set(INSTALL_DIR "bin/${MY_PROJ_NAME}")
    install(TARGETS ${MY_PROJ_NAME} DESTINATION "${INSTALL_DIR}")

    # install the extra files together with the executable
    if(NOT (MY_BINPLACES STREQUAL ""))
        foreach(BF ${MY_BINPLACES})
            install(FILES ${BF} DESTINATION "${INSTALL_DIR}")
        endforeach()
    endif()
endfunction()

function(ms_add_project PROJ_TYPE PROJ_NAME PROJ_SRC PROJ_LIBS PROJ_BINPLACES)
    if(NOT((PROJ_TYPE STREQUAL "STATIC") OR (PROJ_TYPE STREQUAL "SHARED") OR
           (PROJ_TYPE STREQUAL "EXECUTABLE") OR (PROJ_TYPE STREQUAL "OBJECT")))
        message(FATAL_ERROR "Invalid project type.")
    endif()

    if(PROJ_SRC STREQUAL "")
        message(FATAL_ERROR "No source files.")
    endif()

    if((PROJ_TYPE STREQUAL "STATIC") OR (PROJ_TYPE STREQUAL "OBJECT"))
        add_library(${PROJ_NAME} ${PROJ_TYPE} ${PROJ_SRC})
    elseif(PROJ_TYPE STREQUAL "SHARED")
        add_library(${PROJ_NAME} ${PROJ_TYPE} ${PROJ_SRC})
    elseif(PROJ_TYPE STREQUAL "EXECUTABLE")
        add_executable(${PROJ_NAME} ${PROJ_SRC})
    endif()

    if((PROJ_TYPE STREQUAL "SHARED") OR (PROJ_TYPE STREQUAL "EXECUTABLE"))
        if(PROJ_TYPE STREQUAL "SHARED")
            set(LINK_MODE PRIVATE)
        else()
            set(LINK_MODE PUBLIC)
        endif()
        target_link_libraries(${PROJ_NAME} "${LINK_MODE}" ${PROJ_LIBS})
    endif()
endfunction(ms_add_project)


# Parameters:
# - MY_PROJ_TYPE
# - MY_PROJ_NAME
# - MY_SRC_SEARCH_MODE
#     Search mode for source files under current project directory
#     "GLOB_RECURSE" for recursive search
#     "GLOB" for non-recursive search
# - MY_PROJ_SRC
# - MY_PROJ_LIBS
# - MY_BINPLACES
#     Extra files that will be installed
# - MY_BOOST_LIBS
function(dsn_add_project)
    if((NOT DEFINED MY_PROJ_TYPE) OR (MY_PROJ_TYPE STREQUAL ""))
        message(FATAL_ERROR "MY_PROJ_TYPE is empty.")
    endif()
    if((NOT DEFINED MY_PROJ_NAME) OR (MY_PROJ_NAME STREQUAL ""))
        message(FATAL_ERROR "MY_PROJ_NAME is empty.")
    endif()
    if(NOT DEFINED MY_SRC_SEARCH_MODE)
        set(MY_SRC_SEARCH_MODE "GLOB")
    endif()

    # find source files from current directory
    if(NOT DEFINED MY_PROJ_SRC)
        set(MY_PROJ_SRC "")
    endif()
    set(TEMP_SRC "")
    # We restrict the file suffix to keep our codes consistent.
    file(${MY_SRC_SEARCH_MODE} TEMP_SRC
         "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
         "${CMAKE_CURRENT_SOURCE_DIR}/*.c"
         )
    set(MY_PROJ_SRC ${TEMP_SRC} ${MY_PROJ_SRC})

    if(NOT DEFINED MY_PROJ_LIBS)
        set(MY_PROJ_LIBS "")
    endif()
    if(NOT DEFINED MY_BINPLACES)
        set(MY_BINPLACES "")
    endif()

    if(NOT DEFINED MY_BOOST_LIBS)
        set(MY_BOOST_LIBS "")
    endif()

    if((MY_PROJ_TYPE STREQUAL "SHARED") OR (MY_PROJ_TYPE STREQUAL "EXECUTABLE"))
        set(MY_PROJ_LIBS ${MY_PROJ_LIBS} ${DEFAULT_THIRDPARTY_LIBS} ${MY_BOOST_LIBS} ${DSN_SYSTEM_LIBS})
    endif()
    ms_add_project("${MY_PROJ_TYPE}" "${MY_PROJ_NAME}" "${MY_PROJ_SRC}" "${MY_PROJ_LIBS}" "${MY_BINPLACES}")
    define_file_basename_for_sources(${MY_PROJ_NAME})
endfunction(dsn_add_project)

function(dsn_add_static_library)
    set(MY_PROJ_TYPE "STATIC")
    dsn_add_project()
    dsn_install_library()
endfunction(dsn_add_static_library)

function(dsn_add_shared_library)
    set(MY_PROJ_TYPE "SHARED")
    dsn_add_project()
    dsn_install_library()
endfunction(dsn_add_shared_library)

function(dsn_add_executable)
    set(MY_PROJ_TYPE "EXECUTABLE")
    dsn_add_project()
endfunction(dsn_add_executable)

function(dsn_add_object)
    set(MY_PROJ_TYPE "OBJECT")
    dsn_add_project()
endfunction(dsn_add_object)

function(dsn_add_test)
    if(${BUILD_TEST})
        set(MY_EXECUTABLE_IS_TEST TRUE)
        dsn_add_executable()

        file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
        execute_process(COMMAND ln -sf ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR}/bin/${MY_PROJ_NAME})

        # copy the extra files together with the executable
        if(NOT (MY_BINPLACES STREQUAL ""))
            foreach(BF ${MY_BINPLACES})
                FILE(COPY ${BF} DESTINATION "${CMAKE_BINARY_DIR}/bin/${MY_PROJ_NAME}")
            endforeach()
        endif()
    endif()
endfunction()

function(dsn_setup_compiler_flags)
    if(CMAKE_BUILD_TYPE STREQUAL "Debug")
        add_definitions(-DDSN_BUILD_TYPE=Debug)
        add_definitions(-g)
    else()
        add_definitions(-g)
        add_definitions(-O2)
        add_definitions(-DDSN_BUILD_TYPE=Release)
    endif()
    cmake_host_system_information(RESULT BUILD_HOSTNAME QUERY HOSTNAME)
    add_definitions(-DDSN_BUILD_HOSTNAME=${BUILD_HOSTNAME})

    # We want access to the PRI* print format macros.
    add_definitions(-D__STDC_FORMAT_MACROS)

    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y" CACHE STRING "" FORCE)

    #  -Wall: Enable all warnings.
    add_compile_options(-Wall)
    add_compile_options(-Werror)
    #  -Wno-sign-compare: suppress warnings for comparison between signed and unsigned integers
    add_compile_options(-Wno-sign-compare)
    add_compile_options(-Wno-strict-aliasing)
    add_compile_options(-Wuninitialized)
    add_compile_options(-Wno-unused-result)
    add_compile_options(-Wno-unused-variable)
    add_compile_options(-Wno-deprecated-declarations)
    add_compile_options(-Wno-inconsistent-missing-override)
    add_compile_options(-Wno-attributes)
    # -fno-omit-frame-pointer
    #   use frame pointers to allow simple stack frame walking for backtraces.
    #   This has a small perf hit but worth it for the ability to profile in production
    add_compile_options( -fno-omit-frame-pointer)
    # -Wno-deprecated-register
    #   kbr5.h uses the legacy 'register' keyword.
    add_compile_options(-Wno-deprecated-register)
    # -Wno-implicit-float-conversion
    #   Poco/Dynamic/VarHolder.h uses 'unsigned long' to 'float' conversion
    add_compile_options(-Wno-implicit-float-conversion)

    find_program(CCACHE_FOUND ccache)
    if(CCACHE_FOUND)
        set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
        set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
        if ("${COMPILER_FAMILY}" STREQUAL "clang")
            add_compile_options(-Qunused-arguments)
        endif()
        message(STATUS "use ccache to speed up compilation")
    endif(CCACHE_FOUND)

    # add sanitizer check
    if(DEFINED SANITIZER)
        if(NOT (("${COMPILER_FAMILY}" STREQUAL "clang") OR
        ("${COMPILER_FAMILY}" STREQUAL "gcc" AND "${COMPILER_VERSION}" VERSION_GREATER "5.4.0")))
            message(SEND_ERROR "Cannot use sanitizer without clang or gcc >= 5.4.0")
        endif()

        message(STATUS "Running cmake with sanitizer=${SANITIZER}")
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${SANITIZER}" CACHE STRING "" FORCE)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${SANITIZER}" CACHE STRING "" FORCE)
    endif()

    set(CMAKE_EXE_LINKER_FLAGS
        "${CMAKE_EXE_LINKER_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"
        CACHE
        STRING
        ""
        FORCE)
    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"
        CACHE
        STRING
        ""
        FORCE)
endfunction(dsn_setup_compiler_flags)

# find necessary system libs
function(dsn_setup_system_libs)
    find_package(Threads REQUIRED)

    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
        set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
        message(STATUS "FIND_LIBRARY_USE_LIB64_PATHS = ON")
    endif()

    set(DSN_SYSTEM_LIBS "")

    if (NOT APPLE)
        find_package(RT REQUIRED)
        set(DSN_SYSTEM_LIBS ${DSN_SYSTEM_LIBS} ${RT_LIBRARIES})
    endif()

    find_package(DL REQUIRED)
    set(DSN_SYSTEM_LIBS ${DSN_SYSTEM_LIBS} ${DL_LIBRARIES})

    # for md5 calculation
    find_package(OpenSSL REQUIRED)
    set(DSN_SYSTEM_LIBS ${DSN_SYSTEM_LIBS} ${OPENSSL_CRYPTO_LIBRARY})
    if (APPLE)
        include_directories(SYSTEM ${OPENSSL_ROOT_DIR}/include)
        link_directories("${OPENSSL_ROOT_DIR}/lib")
    endif()

    if (NOT APPLE)
        if(ENABLE_GPERF)
            set(DSN_SYSTEM_LIBS ${DSN_SYSTEM_LIBS} tcmalloc_and_profiler)
            add_definitions(-DDSN_ENABLE_GPERF)
        endif()
    endif()

    if(USE_JEMALLOC)
        find_package(Jemalloc REQUIRED)
        # also use cpu profiler provided by gperftools
        set(DSN_SYSTEM_LIBS ${DSN_SYSTEM_LIBS} JeMalloc::JeMalloc profiler)
        add_definitions(-DDSN_USE_JEMALLOC)
    endif()

    set(DSN_SYSTEM_LIBS
        ${DSN_SYSTEM_LIBS}
        ${CMAKE_THREAD_LIBS_INIT} # the thread library found by FindThreads
        CACHE STRING "rDSN system libs" FORCE
    )
endfunction(dsn_setup_system_libs)

function(dsn_setup_include_path)#TODO(huangwei5): remove this
    include_directories(${DSN_THIRDPARTY_ROOT}/include)
endfunction(dsn_setup_include_path)

function(dsn_setup_thirdparty_libs)
    set(Boost_USE_MULTITHREADED ON)
    set(Boost_USE_STATIC_LIBS OFF)
    set(Boost_USE_STATIC_RUNTIME OFF)
    set(BOOST_ROOT ${DSN_THIRDPARTY_ROOT})
    set(Boost_NO_SYSTEM_PATHS ON)
    set(Boost_NO_BOOST_CMAKE ON)

    set(CMAKE_PREFIX_PATH ${DSN_THIRDPARTY_ROOT};${CMAKE_PREFIX_PATH})
    find_package(Boost COMPONENTS system filesystem regex REQUIRED)
    include_directories(${Boost_INCLUDE_DIRS})

    find_library(THRIFT_LIB NAMES libthrift.a PATHS ${DSN_THIRDPARTY_ROOT}/lib NO_DEFAULT_PATH)
    if(NOT THRIFT_LIB)
        message(FATAL_ERROR "thrift library not found in ${DSN_THIRDPARTY_ROOT}/lib")
    endif()
    find_package(fmt REQUIRED)
    set(DEFAULT_THIRDPARTY_LIBS ${THRIFT_LIB} fmt::fmt CACHE STRING "default thirdparty libs" FORCE)

    # rocksdb
    file(GLOB ROCKSDB_DEPENDS_MODULE_PATH ${DSN_PROJECT_DIR}/thirdparty/build/Source/rocksdb/cmake/modules)
    if(NOT ROCKSDB_DEPENDS_MODULE_PATH)
        message(WARNING "Cannot find RocksDB depends cmake modules path, might not find snappy, zstd, lz4")
    endif()
    list(APPEND CMAKE_MODULE_PATH "${ROCKSDB_DEPENDS_MODULE_PATH}")
    find_package(snappy)
    find_package(zstd)
    find_package(lz4)
    if(USE_JEMALLOC)
        find_package(Jemalloc REQUIRED)
    endif()
    find_package(RocksDB REQUIRED)

    # libhdfs
    find_package(JNI REQUIRED)
    message (STATUS "JAVA_JVM_LIBRARY=${JAVA_JVM_LIBRARY}")
    link_libraries(${JAVA_JVM_LIBRARY})

    link_directories(${DSN_THIRDPARTY_ROOT}/lib)
    if (NOT APPLE)
        link_directories(${DSN_THIRDPARTY_ROOT}/lib64)
    endif()
endfunction(dsn_setup_thirdparty_libs)

function(dsn_common_setup)
    if(NOT (UNIX))
        message(FATAL_ERROR "Only Unix are supported.")
    endif()

    if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
        message(FATAL_ERROR "In-source builds are not allowed.")
    endif()

    if(NOT DEFINED DSN_BUILD_RUNTIME)
        set(DSN_BUILD_RUNTIME FALSE)
    endif()

    set(BUILD_SHARED_LIBS OFF)

    include(CheckCXXCompilerFlag)
    CHECK_CXX_COMPILER_FLAG("-std=c++1y" COMPILER_SUPPORTS_CXX1Y)
    if(NOT ${COMPILER_SUPPORTS_CXX1Y})
        message(FATAL_ERROR "You need a compiler with C++1y support.")
    endif()

    dsn_setup_system_libs()
    dsn_setup_compiler_flags()
    dsn_setup_include_path()
    dsn_setup_thirdparty_libs()

    include(${DSN_PROJECT_DIR}/bin/thrift_utils.cmake)

endfunction(dsn_common_setup)


================================================
FILE: bin/thrift_utils.cmake
================================================
##############################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
##############################################################################

find_program(THRIFT_COMPILER
    NAME
        thrift
    PATHS
        ${DSN_THIRDPARTY_ROOT}/bin
    NO_DEFAULT_PATH
)

set(THRIFT_GENERATED_FILE_PATH ${CMAKE_BINARY_DIR}/thrift-gen CACHE INTERNAL "Where the thrift generated sources locate")
if(NOT EXISTS ${THRIFT_GENERATED_FILE_PATH})
    file(MAKE_DIRECTORY ${THRIFT_GENERATED_FILE_PATH})
endif()
message(STATUS "THRIFT_GENERATED_FILE_PATH=${THRIFT_GENERATED_FILE_PATH}")
include_directories(${THRIFT_GENERATED_FILE_PATH})

# THRIFT_GENERATE_CPP is used to generate sources using the thrift compiler.
#
# Example:
#
# thrift_generate_cpp(
#     REQUEST_META_THRIFT_SRCS
#     REQUEST_META_THRIFT_HDRS
#     ${CMAKE_CURRENT_SOURCE_DIR}/request_meta.thrift
# )
# add_library(
#     dsn_rpc
#     ${REQUEST_META_THRIFT_SRCS}
#     ...
# )
function(THRIFT_GENERATE_CPP SRCS HDRS thrift_file)
    if(NOT EXISTS ${thrift_file})
        message(FATAL_ERROR "thrift file ${thrift_file} does not exist")
    endif()

    message(STATUS "THRIFT_GENERATE_CPP: ${thrift_file}")

    exec_program(${THRIFT_COMPILER}
        ARGS -gen cpp:moveable_types --out ${THRIFT_GENERATED_FILE_PATH} --gen cpp ${thrift_file}
        OUTPUT_VARIABLE __thrift_OUT
        RETURN_VALUE THRIFT_RETURN)
    if(NOT ${THRIFT_RETURN} EQUAL "0")
        message(STATUS "COMMAND: ${THRIFT_COMPILER} -gen cpp:moveable_types --out ${THRIFT_GENERATED_FILE_PATH} --gen cpp ${thrift_file}")
        message(FATAL_ERROR "thrift-compiler exits with " ${THRIFT_RETURN} ": " ${__thrift_OUT})
    endif()

    get_filename_component(__thrift_name ${thrift_file} NAME_WE)

    set(${SRCS})
    set(${HDRS})
    file(GLOB __result_src "${THRIFT_GENERATED_FILE_PATH}/${__thrift_name}_types.cpp")
    file(GLOB __result_hdr "${THRIFT_GENERATED_FILE_PATH}/${__thrift_name}_types.h")
    list(APPEND ${SRCS} ${__result_src})
    list(APPEND ${HDRS} ${__result_hdr})
    # Sets the variables in global scope.
    set(${SRCS} ${${SRCS}} PARENT_SCOPE)
    set(${HDRS} ${${HDRS}} PARENT_SCOPE)

    # install the thrift generated headers to include/
    install(FILES ${__result_hdr} DESTINATION include)
endfunction()


================================================
FILE: compile_thrift.py
================================================
#!/usr/bin/env python2
# The MIT License (MIT)
#
# Copyright (c) 2015 Microsoft Corporation
#
# -=- Robust Distributed System Nucleus (rDSN) -=-
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.


import os
import sys
import platform
import re

'''
the default thrift generator
'''

thrift_description = [
    {
        "name": "dsn.layer2",
        "path": "src",
        "include_fix": {
            "_types.h": {
                "add": ["<dsn/cpp/serialization_helper/dsn_types.h>"],
                "remove": ["\"dsn_types.h\""]
            },
            "_types.cpp": {
                "add": ["<dsn/cpp/serialization_helper/dsn.layer2_types.h>"],
                "remove": ["\"dsn.layer2_types.h\""]
            }
        },
        "file_move": {
            "_types.h": "include/dsn/cpp/serialization_helper",
            "_types.cpp": "src/runtime"
        }
    },
]


class CompileError(Exception):
    """ Raised when dealing with thrift idl have errors"""

    def __init__(self, msg):
        self.msg = msg

    def __str__(self):
        return self.msg


def fix_include_file(filename, fix_commands):
    tmp_result = filename + ".swapfile"
    from_fd, to_fd = open(filename, "r"), open(tmp_result, "w")

    add_ok = not "add" in fix_commands

    for line in from_fd:
        include_statement = False
        if len(line.strip()) > 0:
            stripped_line = line.strip()
            if stripped_line[0] == "#" and "include" in stripped_line:
                include_statement = True

        if include_statement == True and add_ok == False:
            add_includes = "\n".join(["#include %s" % (s)
                                      for s in fix_commands["add"]])
            to_fd.write(add_includes + "\n")
            add_ok = True

        if include_statement == True and ("remove" in fix_commands):
            if len(filter(lambda x: x in line, fix_commands["remove"])) == 0:
                to_fd.write(line)
        else:
            to_fd.write(line)

    from_fd.close()
    to_fd.close()

    os.remove(filename)
    os.rename(tmp_result, filename)


def fix_include(thrift_name, include_fix_dict):
    # current dir is thrift file dir
    os.chdir("output")

    for pair in include_fix_dict.iteritems():
        filename = thrift_name + pair[0]
        fix_include_file(filename, pair[1])

    os.chdir("..")


def compile_thrift_file(thrift_info):
    thrift_name = thrift_info["name"]
    print "\n>>> compiling thrift file %s.thrift ..." % (thrift_name)

    if "path" not in thrift_info:
        raise CompileError("can't find thrift file")

    # ensure <name>.thrift exists
    os.chdir(root_dir + "/" + thrift_info["path"])
    if os.path.isfile(thrift_name+".thrift") == False:
        raise CompileError("can't find thrift file")

    # create tmp directory: <thrift_info["path"]>/output
    os.system("rm -rf output")
    os.system("mkdir output")
    print "mkdir {}/output".format(os.getcwd())

    # generate files
    cmd = "{} -gen cpp:moveable_types -out output {}.thrift".format(
        thrift_exe, thrift_name)
    os.system(cmd)
    print cmd

    # TODO(wutao1): code format files
    # os.system("clang-format-3.9 -i output/*")

    if "include_fix" in thrift_info:
        fix_include(thrift_name, thrift_info["include_fix"])

    if "hook" in thrift_info:
        os.chdir("output")
        for hook_func, args in thrift_info["hook"]:
            hook_func(args)
        os.chdir("..")

    if "file_move" in thrift_info:
        for pair in thrift_info["file_move"].iteritems():
            dest_path = root_dir + "/" + pair[1]
            for postfix in pair[0].split():
                src_path = "output/%s%s" % (thrift_name, postfix)
                cmd = "mv %s %s" % (src_path, dest_path)
                os.system(cmd)
                print cmd

    os.system("rm -rf output")
    print "rm -rf {}/output".format(os.getcwd())

    os.chdir(root_dir)


# special hooks for thrift, all these are executed in the output dir


def constructor_hook(args):
    generated_fname = args[0]
    class_name = args[1]
    add_code = args[2]

    target_fname = generated_fname + ".swapfile"
    src_fd, dst_fd = open(generated_fname, "r"), open(target_fname, "w")

    in_class = 0
    for line in src_fd:
        if in_class == 1:
            if "public:" in line:
                line = line + add_code + "\n"
            elif "bool operator <" in line:
                line = ""
            # this may not be right
            elif line.startswith("};"):
                in_class = 2
        elif in_class == 0 and line.startswith("class " + class_name + " {"):
            in_class = 1
        dst_fd.write(line)

    src_fd.close()
    dst_fd.close()

    os.remove(generated_fname)
    os.rename(target_fname, generated_fname)


def replace_hook(args):
    generated_fname = args[0]
    replace_map = args[1]

    target_fname = generated_fname + ".swapfile"
    src_fd, dst_fd = open(generated_fname, "r"), open(target_fname, "w")

    for line in src_fd:
        for key, value in replace_map.items():
            line = re.sub(key, value, line)
        dst_fd.write(line)

    src_fd.close()
    dst_fd.close()

    os.remove(generated_fname)
    os.rename(target_fname, generated_fname)


def add_hook(name, path, func, args):
    for i in thrift_description:
        if name == i["name"] and path == i["path"]:
            if "hook" not in i:
                i["hook"] = [(func, args)]
            else:
                i["hook"].append((func, args))


if __name__ == "__main__":
    thrift_exe = os.getcwd() + "/thirdparty/output/bin/thrift"
    root_dir = os.getcwd()
    print "thrift_exe = " + thrift_exe
    print "root_dir = " + root_dir

    if not os.path.isfile(thrift_exe):
        print "Error: can't find compiler %s\nPlease build thrift in thirdparty/" % thrift_exe
        sys.exit()

    ctor_kv_pair = "  kv_pair(const std::string& _key, const std::string& _val): key(_key), value(_val) {\n  }"
    ctor_configuration_proposal_action = "  configuration_proposal_action(::dsn::rpc_address t, ::dsn::rpc_address n, config_type::type tp): target(t), node(n), type(tp) {}"
    add_hook("simple_kv", "src/replica/storage/simple_kv", constructor_hook,
             ["simple_kv_types.h", "kv_pair", ctor_kv_pair])
    add_hook("replication", "src/", constructor_hook,
             ["replication_types.h", "configuration_proposal_action", ctor_configuration_proposal_action])
    add_hook("dsn.layer2", "src", replace_hook, ["dsn.layer2_types.h", {
             r"dsn\.layer2_TYPES_H": 'dsn_layer2_TYPES_H'}])

    for i in thrift_description:
        compile_thrift_file(i)


================================================
FILE: include/dsn/c/api_common.h
================================================
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Microsoft Corporation
 *
 * -=- Robust Distributed System Nucleus (rDSN) -=-
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

/*
 * Description:
 *     basic data structures and macros for rDSN service API
 *
 * Revision history:
 *     Feb., 2016, @imzhenyu (Zhenyu Guo), first version
 *     xxxx-xx-xx, author, fix bug about xxx
 */

#pragma once

#include <stdint.h>
#include <stddef.h>
#include <stdarg.h>
#include <dsn/utility/dlib.h>

#ifdef __cplusplus
#define DEFAULT(value) = value
#define NORETURN [[noreturn]]
#else
#define DEFAULT(value)
#define NORETURN
#include <stdbool.h>
#endif

#define DSN_MAX_TASK_CODE_NAME_LENGTH 48
#define DSN_MAX_ERROR_CODE_NAME_LENGTH 48
#define DSN_MAX_ADDRESS_NAME_LENGTH 48
#define DSN_MAX_BUFFER_COUNT_IN_MESSAGE 64
#define DSN_MAX_APP_TYPE_NAME_LENGTH 32
#define DSN_MAX_CALLBAC_COUNT 32
#define DSN_MAX_APP_COUNT_IN_SAME_PROCESS 256
#define DSN_MAX_PATH 1024

typedef void *dsn_handle_t;


================================================
FILE: include/dsn/c/api_layer1.h
================================================
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Microsoft Corporation
 *
 * -=- Robust Distributed System Nucleus (rDSN) -=-
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

#pragma once

#include <dsn/c/api_common.h>
#include <dsn/c/api_task.h>
#include <dsn/tool-api/gpid.h>
#include <dsn/tool-api/rpc_address.h>
#include <dsn/tool-api/task_tracker.h>

/*!
 @defgroup service-api-c Core Service API

 @ingroup service-api

  Core service API for building applications and distributed frameworks, which
  covers the major categories that a server application may use, shown in the modules below.

 @{
 */

/*!
 @defgroup task-common Common Task Operations

 Common Task/Event Operations

 rDSN adopts the event-driven programming model, where all computations (event handlers) are
 represented as individual tasks; each is the execution of a sequential piece of code in one thread.
 Specifically, rDSN categorizes the tasks into four types, as defined in \ref dsn_task_type_t.

Unlike the traditional event-driven programming, rDSN enhances the model in the following ways,
with which they control the application in many aspects in a declarative approach.

- each task is labeled with a task code, with which developers can configure many aspects in config
files.
  Developers can define new task code using \ref DEFINE_TASK_CODE, or \ref dsn_task_code_register.

  <PRE>
  [task..default]
  ; allow task executed in other thread pools or tasks
  ; for TASK_TYPE_COMPUTE - allow-inline allows a task being executed in its caller site
  ; for other tasks - allow-inline allows a task being execution in io-thread
  allow_inline = false

  ; group rpc mode with group address: GRPC_TO_LEADER, GRPC_TO_ALL, GRPC_TO_ANY
  grpc_mode = GRPC_TO_LEADER

  ; when toollet profiler is enabled
  is_profile = true

  ; when toollet tracer is enabled
  is_trace = true

  ; thread pool to execute the task
  pool_code = THREAD_POOL_DEFAULT

  ; task priority
  priority = TASK_PRIORITY_COMMON

  ; whether to randomize the timer delay to random(0, timer_interval),
  ; if the initial delay is zero, to avoid multiple timers executing at the same time (e.g.,
checkpointing)
  randomize_timer_delay_if_zero = false

  ; what kind of network channel for this kind of rpc calls
  rpc_call_channel = RPC_CHANNEL_TCP

  ; what kind of header format for this kind of rpc calls
  rpc_call_header_format = NET_HDR_DSN

  ; how many milliseconds to delay recving rpc session for
  ; when queue length ~= [1.0, 1.2, 1.4, 1.6, 1.8, >=2.0] x pool.queue_length_throttling_threshold,
  ; e.g., 0, 0, 1, 2, 5, 10
  rpc_request_delays_milliseconds = 0, 0, 1, 2, 5, 10

  ; whether to drop a request right before execution when its queueing time
  ; is already greater than its timeout value
  rpc_request_dropped_before_execution_when_timeout = false

  ; for how long (ms) the request will be resent if no response
  ; is received yet, 0 for disable this feature
  rpc_request_resend_timeout_milliseconds = 0

  ; throttling mode for rpc requets: TM_NONE, TM_REJECT, TM_DELAY when
  ; queue length > pool.queue_length_throttling_threshold
  rpc_request_throttling_mode = TM_NONE

  ; what is the default timeout (ms) for this kind of rpc calls
  rpc_timeout_milliseconds = 5000

  [task.LPC_AIO_IMMEDIATE_CALLBACK]
  ; override the option in [task..default]
  allow_inline = true
  </PRE>

- each task code is bound to a thread pool, which can be customized as follows.
  Developers can define new thread pools using \ref DEFINE_THREAD_POOL_CODE, or \ref
dsn_threadpool_code_register.

  <PRE>
  [threadpool..default]

  ; how many tasks (if available) should be returned for
  ; one dequeue call for best batching performance
  dequeue_batch_size = 5

  ; throttling: whether to enable throttling with virtual queues
  enable_virtual_queue_throttling = false

  ; thread pool name
  name = THREAD_POOL_INVALID

  ; whethe the threads share a single queue(partitioned=false) or not;
  ; the latter is usually for workload hash partitioning for avoiding locking
  partitioned = false

  ; task queue aspects names, usually for tooling purpose
  queue_aspects =

  ; task queue provider name
  queue_factory_name = dsn::tools::hpc_concurrent_task_queue

  ; throttling: throttling threshold above which rpc requests will be dropped
  queue_length_throttling_threshold = 1000000

  ; what CPU cores are assigned to this pool, 0 for all
  worker_affinity_mask = 0

  ; task aspects names, usually for tooling purpose
  worker_aspects =

  ; thread/worker count
  worker_count = 2

  ; task worker provider name
  worker_factory_name =

  ; thread priority
  worker_priority = THREAD_xPRIORITY_NORMAL

  ; whether the threads share all assigned cores
  worker_share_core = true

  [threadpool.THREAD_POOL_DEFAULT]
  ; override default options in [threadpool..default]
  dequeue_batch_size = 5

  </PRE>
-

 @{
 */
/*! cancel the later execution of the timer task inside the timer */
extern DSN_API void dsn_task_cancel_current_timer();

/*!
 check whether the task is currently running inside the given task

 \param t the given task handle

 \return true if it is.
 */
extern DSN_API bool dsn_task_is_running_inside(dsn::task *t);

/*@}*/

/*!
 @defgroup tasking Asynchronous Tasks and Timers

 Asynchronous Tasks and Timers

 @{
 */

/*!
@defgroup rpc Remote Procedure Call (RPC)

Remote Procedure Call (RPC)

Note developers can easily plugin their own implementation to
replace the underneath implementation of the network (e.g., RDMA, simulated network)
@{
*/

/*!
@{
*/

extern DSN_API dsn::rpc_address dsn_primary_address();

/*!
@defgroup rpc-server Server-Side RPC Primitives

Server-Side RPC Primitives
@{
 */

/*! register callback to handle RPC request */
extern DSN_API bool dsn_rpc_register_handler(dsn::task_code code,
                                             const char *extra_name,
                                             const dsn::rpc_request_handler &cb);

/*! unregister callback to handle RPC request, returns true if unregister ok, false if no handler
    was registered */
extern DSN_API bool dsn_rpc_unregiser_handler(dsn::task_code code);

/*! reply with a response which is created using dsn::message_ex::create_response */
extern DSN_API void dsn_rpc_reply(dsn::message_ex *response,
                                  dsn::error_code err DEFAULT(dsn::ERR_OK));

/*! forward the request to another server instead */
extern DSN_API void dsn_rpc_forward(dsn::message_ex *request, dsn::rpc_address addr);

/*@}*/

/*!
@defgroup rpc-client Client-Side RPC Primitives

Client-Side RPC Primitives
@{
*/

/*! client invokes the RPC call */
extern DSN_API void dsn_rpc_call(dsn::rpc_address server, dsn::rpc_response_task *rpc_call);

/*!
   client invokes the RPC call and waits for its response, note
   returned msg must be explicitly released using \ref dsn::message_ex::release_ref
 */
extern DSN_API dsn::message_ex *dsn_rpc_call_wait(dsn::rpc_address server,
                                                  dsn::message_ex *request);

/*! one-way RPC from client, no rpc response is expected */
extern DSN_API void dsn_rpc_call_one_way(dsn::rpc_address server, dsn::message_ex *request);

/*@}*/

/*@}*/

extern DSN_API uint64_t dsn_now_ns();

__inline uint64_t dsn_now_us() { return dsn_now_ns() / 1000; }
__inline uint64_t dsn_now_ms() { return dsn_now_ns() / 1000000; }
__inline uint64_t dsn_now_s() { return dsn_now_ns() / 1000000000; }

/*@}*/

/*@}*/

/*@}*/


================================================
FILE: include/dsn/c/api_task.h
================================================
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Microsoft Corporation
 *
 * -=- Robust Distributed System Nucleus (rDSN) -=-
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

/*
 * Description:
 *     task and execution model
 *
 * Revision history:
 *     Feb., 2016, @imzhenyu (Zhenyu Guo), first version
 *     xxxx-xx-xx, author, fix bug about xxx
 */

#pragma once

#include <dsn/c/api_common.h>
#include <dsn/utility/error_code.h>
#include <dsn/tool-api/threadpool_code.h>
#include <dsn/tool-api/task_code.h>

/*!
@addtogroup task-common
@{
 */

namespace dsn {
class message_ex;

typedef std::function<void()> task_handler;

/// A callback to handle rpc requests.
///
/// Parameters:
///  - dsn::message_ex*: the received rpc request
typedef std::function<void(dsn::message_ex *)> rpc_request_handler;

/// A callback to handle rpc responses.
///
/// Parameters:
///  - error_code
///  - message_ex: the sent rpc request
///  - message_ex: the received rpc response
typedef std::function<void(dsn::error_code, dsn::message_ex *, dsn::message_ex *)>
    rpc_response_handler;

/// Parameters:
///  - error_code
///  - size_t: the read or written size of bytes from file.
typedef std::function<void(dsn::error_code, size_t)> aio_handler;

class task;
class raw_task;
class rpc_request_task;
class rpc_response_task;
class aio_task;
}
/*!
apps updates the value at dsn_task_queue_virtual_length_ptr(..) to control
the length of a vitual queue (bound to current code + hash) to
enable customized throttling, see spec of thread pool for more information
*/
extern DSN_API volatile int *dsn_task_queue_virtual_length_ptr(dsn::task_code code,
                                                               int hash DEFAULT(0));

/*@}*/


================================================
FILE: include/dsn/c/api_utilities.h
================================================
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Microsoft Corporation
 *
 * -=- Robust Distributed System Nucleus (rDSN) -=-
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

/*
 * Description:
 *     useful utilities in rDSN exposed via C API
 *
 * Revision history:
 *     Feb., 2016, @imzhenyu (Zhenyu Guo), first version
 *     xxxx-xx-xx, author, fix bug about xxx
 */

#pragma once

#include <dsn/c/api_common.h>
#include <dsn/utility/ports.h>

/*!
@defgroup logging Logging Service
@ingroup service-api-utilities

 Logging Service

 Note developers can plug into rDSN their own logging libraryS
 implementation, so as to integrate rDSN logs into
 their own cluster operation systems.
@{
*/

typedef enum dsn_log_level_t {
    LOG_LEVEL_INFORMATION,
    LOG_LEVEL_DEBUG,
    LOG_LEVEL_WARNING,
    LOG_LEVEL_ERROR,
    LOG_LEVEL_FATAL,
    LOG_LEVEL_COUNT,
    LOG_LEVEL_INVALID
} dsn_log_level_t;

// logs with level smaller than this start_level will not be logged
extern DSN_API dsn_log_level_t dsn_log_start_level;
extern DSN_API dsn_log_level_t dsn_log_get_start_level();
extern DSN_API void dsn_log_set_start_level(dsn_log_level_t level);
extern DSN_API void dsn_logv(const char *file,
                             const char *function,
                             const int line,
                             dsn_log_level_t log_level,
                             const char *fmt,
                             va_list args);
extern DSN_API void dsn_logf(const char *file,
                             const char *function,
                             const int line,
                             dsn_log_level_t log_level,
                             const char *fmt,
                             ...);
extern DSN_API void dsn_log(const char *file,
                            const char *function,
                            const int line,
                            dsn_log_level_t log_level,
                            const char *str);
extern DSN_API void dsn_coredump();

// __FILENAME__ macro comes from the cmake, in which we calculate a filename without path.
#define dlog(level, ...)                                                                           \
    do {                                                                                           \
        if (level >= dsn_log_start_level)                                                          \
            dsn_logf(__FILENAME__, __FUNCTION__, __LINE__, level, __VA_ARGS__);                    \
    } while (false)
#define dinfo(...) dlog(LOG_LEVEL_INFORMATION, __VA_ARGS__)
#define ddebug(...) dlog(LOG_LEVEL_DEBUG, __VA_ARGS__)
#define dwarn(...) dlog(LOG_LEVEL_WARNING, __VA_ARGS__)
#define derror(...) dlog(LOG_LEVEL_ERROR, __VA_ARGS__)
#define dfatal(...) dlog(LOG_LEVEL_FATAL, __VA_ARGS__)
#define dassert(x, ...)                                                                            \
    do {                                                                                           \
        if (dsn_unlikely(!(x))) {                                                                  \
            dlog(LOG_LEVEL_FATAL, "assertion expression: " #x);                                    \
            dlog(LOG_LEVEL_FATAL, __VA_ARGS__);                                                    \
            dsn_coredump();                                                                        \
        }                                                                                          \
    } while (false)

#define dreturn_not_ok_logged(err, ...)                                                            \
    do {                                                                                           \
        if (dsn_unlikely((err) != dsn::ERR_OK)) {                                                  \
            derror(__VA_ARGS__);                                                                   \
            return err;                                                                            \
        }                                                                                          \
    } while (0)

#ifndef NDEBUG
#define dbg_dassert dassert
#else
#define dbg_dassert(x, ...)
#endif

#ifdef DSN_MOCK_TEST
#define mock_private public
#define mock_virtual virtual
#else
#define mock_private private
#define mock_virtual
#endif

/*@}*/

#define dverify(exp)                                                                               \
    if (dsn_unlikely(!(exp)))                                                                      \
    return false

#define dverify_exception(exp)                                                                     \
    do {                                                                                           \
        try {                                                                                      \
            exp;                                                                                   \
        } catch (...) {                                                                            \
            return false;                                                                          \
        }                                                                                          \
    } while (0)

#define dverify_logged(exp, level, ...)                                                            \
    do {                                                                                           \
        if (dsn_unlikely(!(exp))) {                                                                \
            dlog(level, __VA_ARGS__);                                                              \
            return false;                                                                          \
        }                                                                                          \
    } while (0)

#define dstop_on_false(exp)                                                                        \
    if (dsn_unlikely(!(exp)))                                                                      \
    return
#define dstop_on_false_logged(exp, level, ...)                                                     \
    do {                                                                                           \
        if (dsn_unlikely(!(exp))) {                                                                \
            dlog(level, __VA_ARGS__);                                                              \
            return;                                                                                \
        }                                                                                          \
    } while (0)
/*@}*/


================================================
FILE: include/dsn/c/app_model.h
================================================
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Microsoft Corporation
 *
 * -=- Robust Distributed System Nucleus (rDSN) -=-
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

/*
 * Description:
 *     application model in rDSN
 *
 * Revision history:
 *     Mar., 2015, @imzhenyu (Zhenyu Guo), first version
 *     xxxx-xx-xx, author, fix bug about xxx
 */

#pragma once

#include <dsn/c/api_common.h>

/*!
 mimic an app as if the following execution in the current thread are
 executed in the target app's threads.

 \param app_name name of the application, note it is not the type name
 \param index    one-based index of the application instances

 \return true if it succeeds, false if it fails.

 This is useful when we want to leverage 3rd party library into rDSN
 application and call rDSN service API in the threads that are created
 by the 3rd party code.

 For cases we simply want to use a rDSN-based client library in a non-rDSN
 application, developers can simply set [core] enable_default_app_mimic = true
 in configuration file. See more details at \ref enable_default_app_mimic.

 */
extern DSN_API bool dsn_mimic_app(const char *app_role, int index);

/*!
 start the system with given configuration

 \param config           the configuration file for this run
 \param is_server whether it is server or not, default is false

 \return true if it succeeds, false if it fails.
 */
extern DSN_API bool dsn_run_config(const char *config, bool is_server DEFAULT(false));

/*!
 start the system with given arguments

 \param argc             argc in C main convention
 \param argv             argv in C main convention
 \param is_server whether it is server or not, default is false

 \return true if it succeeds, false if it fails.

 Usage:
   config-file [-cargs k1=v1;k2=v2] [-app_list app_name1@index1;app_name2@index]

 Examples:
 - config.ini -app_list replica@1 to start the first replica as a new process
 - config.ini -app_list replica to start ALL replicas (count specified in config) as a new
 process
 - config.ini -app_list replica -cargs replica-port=34556 to start ALL replicas
   with given port variable specified in config.ini
 - config.ini to start ALL apps as a new process

 Note the argc, argv folllows the C main convention that argv[0] is the executable name.
 */
extern DSN_API void dsn_run(int argc, char **argv, bool is_server DEFAULT(false));

/*!
 exit the process with the given exit code

 \param code exit code for the process

 rDSN runtime does not provide elegant exit routines. Thereafter, developers call dsn_exit
 to exit the current process to avoid exceptions happending during normal exit.
 */
NORETURN extern DSN_API void dsn_exit(int code);


================================================
FILE: include/dsn/cpp/json_helper.h
================================================
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Microsoft Corporation
 *
 * -=- Robust Distributed System Nucleus (rDSN) -=-
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
#pragma once

#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <sstream>
#include <string>
#include <type_traits>
#include <cctype>

#include <rapidjson/ostreamwrapper.h>
#include <rapidjson/prettywriter.h>
#include <rapidjson/writer.h>
#include <rapidjson/document.h>

#include <boost/lexical_cast.hpp>

#include <dsn/utility/autoref_ptr.h>
#include <dsn/utility/utils.h>
#include <dsn/tool-api/auto_codes.h>
#include <dsn/dist/replication/replication_types.h>
#include <dsn/dist/replication/replication_enums.h>

#define JSON_ENCODE_ENTRY(out, prefix, T)                                                          \
    out.Key(#T);                                                                                   \
    ::dsn::json::json_forwarder<std::decay<decltype((prefix).T)>::type>::encode(out, (prefix).T)
#define JSON_ENCODE_ENTRIES2(out, prefix, T1, T2)                                                  \
    JSON_ENCODE_ENTRY(out, prefix, T1);                                                            \
    JSON_ENCODE_ENTRY(out, prefix, T2)
#define JSON_ENCODE_ENTRIES3(out, prefix, T1, T2, T3)                                              \
    JSON_ENCODE_ENTRIES2(out, prefix, T1, T2);                                                     \
    JSON_ENCODE_ENTRY(out, prefix, T3)
#define JSON_ENCODE_ENTRIES4(out, prefix, T1, T2, T3, T4)                                          \
    JSON_ENCODE_ENTRIES3(out, prefix, T1, T2, T3);                                                 \
    JSON_ENCODE_ENTRY(out, prefix, T4)
#define JSON_ENCODE_ENTRIES5(out, prefix, T1, T2, T3, T4, T5)                                      \
    JSON_ENCODE_ENTRIES4(out, prefix, T1, T2, T3, T4);                                             \
    JSON_ENCODE_ENTRY(out, prefix, T5)
#define JSON_ENCODE_ENTRIES6(out, prefix, T1, T2, T3, T4, T5, T6)                                  \
    JSON_ENCODE_ENTRIES5(out, prefix, T1, T2, T3, T4, T5);                                         \
    JSON_ENCODE_ENTRY(out, prefix, T6)
#define JSON_ENCODE_ENTRIES7(out, prefix, T1, T2, T3, T4, T5, T6, T7)                              \
    JSON_ENCODE_ENTRIES6(out, prefix, T1, T2, T3, T4, T5, T6);                                     \
    JSON_ENCODE_ENTRY(out, prefix, T7)
#define JSON_ENCODE_ENTRIES8(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8)                          \
    JSON_ENCODE_ENTRIES7(out, prefix, T1, T2, T3, T4, T5, T6, T7);                                 \
    JSON_ENCODE_ENTRY(out, prefix, T8)
#define JSON_ENCODE_ENTRIES9(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9)                      \
    JSON_ENCODE_ENTRIES8(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8);                             \
    JSON_ENCODE_ENTRY(out, prefix, T9)
#define JSON_ENCODE_ENTRIES10(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)                \
    JSON_ENCODE_ENTRIES9(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9);                         \
    JSON_ENCODE_ENTRY(out, prefix, T10)
#define JSON_ENCODE_ENTRIES11(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)           \
    JSON_ENCODE_ENTRIES10(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10);                   \
    JSON_ENCODE_ENTRY(out, prefix, T11)
#define JSON_ENCODE_ENTRIES12(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)      \
    JSON_ENCODE_ENTRIES11(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11);              \
    JSON_ENCODE_ENTRY(out, prefix, T12)
#define JSON_ENCODE_ENTRIES13(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) \
    JSON_ENCODE_ENTRIES12(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12);         \
    JSON_ENCODE_ENTRY(out, prefix, T13)
#define JSON_ENCODE_ENTRIES14(                                                                     \
    out, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)                      \
    JSON_ENCODE_ENTRIES13(out, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13);    \
    JSON_ENCODE_ENTRY(out, prefix, T14)

#define JSON_DECODE_ENTRY(in, prefix, T)                                                           \
    do {                                                                                           \
        dverify(in.HasMember(#T));                                                                 \
        dverify(::dsn::json::json_forwarder<std::decay<decltype((prefix).T)>::type>::decode(       \
            in[#T], (prefix).T));                                                                  \
    } while (0)

#define JSON_TRY_DECODE_ENTRY(in, prefix, T)                                                       \
    do {                                                                                           \
        ++arguments_count;                                                                         \
        if (in.HasMember(#T)) {                                                                    \
            dverify(::dsn::json::json_forwarder<std::decay<decltype((prefix).T)>::type>::decode(   \
                in[#T], (prefix).T));                                                              \
            ++parsed_count;                                                                        \
        }                                                                                          \
    } while (0)

#define JSON_DECODE_ENTRIES2(in, prefix, T1, T2)                                                   \
    JSON_TRY_DECODE_ENTRY(in, prefix, T1);                                                         \
    JSON_TRY_DECODE_ENTRY(in, prefix, T2)
#define JSON_DECODE_ENTRIES3(in, prefix, T1, T2, T3)                                               \
    JSON_DECODE_ENTRIES2(in, prefix, T1, T2);                                                      \
    JSON_TRY_DECODE_ENTRY(in, prefix, T3)
#define JSON_DECODE_ENTRIES4(in, prefix, T1, T2, T3, T4)                                           \
    JSON_DECODE_ENTRIES3(in, prefix, T1, T2, T3);                                                  \
    JSON_TRY_DECODE_ENTRY(in, prefix, T4)
#define JSON_DECODE_ENTRIES5(in, prefix, T1, T2, T3, T4, T5)                                       \
    JSON_DECODE_ENTRIES4(in, prefix, T1, T2, T3, T4);                                              \
    JSON_TRY_DECODE_ENTRY(in, prefix, T5)
#define JSON_DECODE_ENTRIES6(in, prefix, T1, T2, T3, T4, T5, T6)                                   \
    JSON_DECODE_ENTRIES5(in, prefix, T1, T2, T3, T4, T5);                                          \
    JSON_TRY_DECODE_ENTRY(in, prefix, T6)
#define JSON_DECODE_ENTRIES7(in, prefix, T1, T2, T3, T4, T5, T6, T7)                               \
    JSON_DECODE_ENTRIES6(in, prefix, T1, T2, T3, T4, T5, T6);                                      \
    JSON_TRY_DECODE_ENTRY(in, prefix, T7)
#define JSON_DECODE_ENTRIES8(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8)                           \
    JSON_DECODE_ENTRIES7(in, prefix, T1, T2, T3, T4, T5, T6, T7);                                  \
    JSON_TRY_DECODE_ENTRY(in, prefix, T8)
#define JSON_DECODE_ENTRIES9(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9)                       \
    JSON_DECODE_ENTRIES8(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8);                              \
    JSON_TRY_DECODE_ENTRY(in, prefix, T9)
#define JSON_DECODE_ENTRIES10(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)                 \
    JSON_DECODE_ENTRIES9(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9);                          \
    JSON_TRY_DECODE_ENTRY(in, prefix, T10)
#define JSON_DECODE_ENTRIES11(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)            \
    JSON_DECODE_ENTRIES10(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10);                    \
    JSON_TRY_DECODE_ENTRY(in, prefix, T11)
#define JSON_DECODE_ENTRIES12(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)       \
    JSON_DECODE_ENTRIES11(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11);               \
    JSON_TRY_DECODE_ENTRY(in, prefix, T12)
#define JSON_DECODE_ENTRIES13(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)  \
    JSON_DECODE_ENTRIES12(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12);          \
    JSON_TRY_DECODE_ENTRY(in, prefix, T13)
#define JSON_DECODE_ENTRIES14(                                                                     \
    in, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)                       \
    JSON_DECODE_ENTRIES13(in, prefix, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13);     \
    JSON_TRY_DECODE_ENTRY(in, prefix, T14)

#define JSON_ENTRIES_GET_MACRO(                                                                    \
    ph1, ph2, ph3, ph4, ph5, ph6, ph7, ph8, ph9, ph10, ph11, ph12, ph13, ph14, NAME, ...)          \
    NAME
// workaround due to the way VC handles "..."
#define JSON_ENTRIES_GET_MACRO_(tuple) JSON_ENTRIES_GET_MACRO tuple

#define JSON_ENCODE_ENTRIES(out, prefix, ...)                                                      \
    out.StartObject();                                                                             \
    JSON_ENTRIES_GET_MACRO_((__VA_ARGS__,                                                          \
                             JSON_ENCODE_ENTRIES14,                                                \
                             JSON_ENCODE_ENTRIES13,                                                \
                             JSON_ENCODE_ENTRIES12,                                                \
                             JSON_ENCODE_ENTRIES11,                                                \
                             JSON_ENCODE_ENTRIES10,                                                \
                             JSON_ENCODE_ENTRIES9,                                                 \
                             JSON_ENCODE_ENTRIES8,                                                 \
                             JSON_ENCODE_ENTRIES7,                                                 \
                             JSON_ENCODE_ENTRIES6,                                                 \
                             JSON_ENCODE_ENTRIES5,                                                 \
                             JSON_ENCODE_ENTRIES4,                                                 \
                             JSON_ENCODE_ENTRIES3,                                                 \
                             JSON_ENCODE_ENTRIES2,                                                 \
                             JSON_ENCODE_ENTRY))                                                   \
    (out, prefix, __VA_ARGS__);                                                                    \
    out.EndObject()

#define JSON_DECODE_ENTRIES(in, prefix, ...)                                                       \
    dverify(in.IsObject());                                                                        \
    int arguments_count = 0;                                                                       \
    int parsed_count = 0;                                                                          \
    JSON_ENTRIES_GET_MACRO_((__VA_ARGS__,                                                          \
                             JSON_DECODE_ENTRIES14,                                                \
                             JSON_DECODE_ENTRIES13,                                                \
                             JSON_DECODE_ENTRIES12,                                                \
                             JSON_DECODE_ENTRIES11,                                                \
                             JSON_DECODE_ENTRIES10,                                                \
                             JSON_DECODE_ENTRIES9,                                                 \
                             JSON_DECODE_ENTRIES8,                                                 \
                             JSON_DECODE_ENTRIES7,                                                 \
                             JSON_DECODE_ENTRIES6,                                                 \
                             JSON_DECODE_ENTRIES5,                                                 \
                             JSON_DECODE_ENTRIES4,                                                 \
                             JSON_DECODE_ENTRIES3,                                                 \
                             JSON_DECODE_ENTRIES2,                                                 \
                             JSON_DECODE_ENTRY))                                                   \
    (in, prefix, __VA_ARGS__);                                                                     \
    return parsed_count == arguments_count || parsed_count == in.MemberCount();

#define DEFINE_JSON_SERIALIZATION(...)                                                             \
    void encode_json_state(std::ostream &os)                                                       \
    {                                                                                              \
        rapidjson::OStreamWrapper wrapper(os);                                                     \
        dsn::json::JsonWriter w(wrapper);                                                          \
        encode_json_state(w);                                                                      \
    }                                                                                              \
    void encode_json_state(dsn::json::JsonWriter &out) const                                       \
    {                                                                                              \
        JSON_ENCODE_ENTRIES(out, *this, __VA_ARGS__);                                              \
    }                                                                                              \
    bool decode_json_state(const dsn::json::JsonObject &in)                                        \
    {                                                                                              \
        JSON_DECODE_ENTRIES(in, *this, __VA_ARGS__);                                               \
    }

#define NON_MEMBER_JSON_SERIALIZATION(type, ...)                                                   \
    inline void json_encode(dsn::json::JsonWriter &output, const type &t)                          \
    {                                                                                              \
        JSON_ENCODE_ENTRIES(output, t, __VA_ARGS__);                                               \
    }                                                                                              \
    inline bool json_decode(const dsn::json::JsonObject &input, type &t)                           \
    {                                                                                              \
        JSON_DECODE_ENTRIES(input, t, __VA_ARGS__);                                                \
    }

namespace dsn {
namespace json {

typedef rapidjson::GenericValue<rapidjson::UTF8<>> JsonObject;
typedef rapidjson::Writer<rapidjson::OStreamWrapper> JsonWriter;
typedef rapidjson::PrettyWriter<rapidjson::OStreamWrapper> PrettyJsonWriter;

template <typename>
class json_forwarder;

// json serialization for string types.
// please notice when we call rapidjson::Writer::String, with 3rd parameter with "true",
// which means that we will COPY string to writer
template <typename Writer>
void json_encode(Writer &out, const std::string &str)
{
    out.String(str.c_str(), str.length(), true);
}
inline void json_encode(JsonWriter &out, const char *str) { out.String(str, strlen(str), true); }
inline bool json_decode(const JsonObject &in, std::string &str)
{
    dverify(in.IsString());
    str = in.GetString();
    return true;
}

inline void json_encode(JsonWriter &out, const error_code &err)
{
    const char *str = err.to_string();
    out.String(str, strlen(str), true);
}
inline bool json_decode(const JsonObject &in, error_code &err)
{
    dverify(in.IsString());
    err = error_code(in.GetString());
    return true;
}

// json serialization for bool types.
// for compatibility, we treat bool as integers, which is not this case in json standard
inline void json_encode(JsonWriter &out, bool t) { out.Int(t ? 1 : 0); }
inline bool json_decode(const JsonObject &in, bool &t)
{
    if (in.IsInt()) {
        int ans = in.GetInt();
        t = (ans != 0);
        return true;
    } else if (in.IsBool()) {
        t = in.GetBool();
        return true;
    }
    return false;
}

// json serialization for double types
inline void json_encode(JsonWriter &out, double d) { out.Double(d); }
inline bool json_decode(const JsonObject &in, double &t)
{
    if (in.IsDouble()) {
        t = in.GetDouble();
        return true;
    } else if (in.IsInt64()) {
        t = (double)in.GetInt64();
        return true;
    } else if (in.IsUint64()) {
        t = (double)in.GetUint64();
        return true;
    }
    return false;
}

// json serialization for int types
#define INT_TYPE_SERIALIZATION(TName)                                                              \
    inline void json_encode(JsonWriter &out, TName t) { out.Int64((int64_t)t); }                   \
    inline bool json_decode(const JsonObject &in, TName &t)                                        \
    {                                                                                              \
        dverify(in.IsInt64());                                                                     \
        int64_t ans = in.GetInt64();                                                               \
        dverify(ans >= std::numeric_limits<TName>::min() &&                                        \
                ans <= std::numeric_limits<TName>::max());                                         \
        t = (TName)ans;                                                                            \
        return true;                                                                               \
    }

INT_TYPE_SERIALIZATION(int8_t)
INT_TYPE_SERIALIZATION(int16_t)
INT_TYPE_SERIALIZATION(int32_t)
INT_TYPE_SERIALIZATION(int64_t)

// json serialization for uint types
#define UINT_TYPE_SERIALIZATION(TName)                                                             \
    inline void json_encode(JsonWriter &out, TName t) { out.Uint64((uint64_t)t); }                 \
    inline bool json_decode(const JsonObject &in, TName &t)                                        \
    {                                                                                              \
        dverify(in.IsUint64());                                                                    \
        int64_t ans = in.GetUint64();                                                              \
        dverify(ans >= std::numeric_limits<TName>::min() &&                                        \
                ans <= std::numeric_limits<TName>::max());                                         \
        t = (TName)ans;                                                                            \
        return true;                                                                               \
    }

UINT_TYPE_SERIALIZATION(uint8_t)
UINT_TYPE_SERIALIZATION(uint16_t)
UINT_TYPE_SERIALIZATION(uint32_t)
UINT_TYPE_SERIALIZATION(uint64_t)

// helper macro for enum types, we treat all enums as string
#define ENUM_TYPE_SERIALIZATION(EnumType, InvalidEnum)                                             \
    inline void json_encode(dsn::json::JsonWriter &out, const EnumType &enum_variable)             \
    {                                                                                              \
        dsn::json::json_encode(out, enum_to_string(enum_variable));                                \
    }                                                                                              \
    inline bool json_decode(const dsn::json::JsonObject &in, EnumType &enum_variable)              \
    {                                                                                              \
        std::string status_message;                                                                \
        dverify(dsn::json::json_decode(in, status_message));                                       \
        enum_variable = enum_from_string(status_message.c_str(), InvalidEnum);                     \
        return true;                                                                               \
    }

ENUM_TYPE_SERIALIZATION(dsn::replication::partition_status::type,
                        dsn::replication::partition_status::PS_INVALID)
ENUM_TYPE_SERIALIZATION(dsn::app_status::type, dsn::app_status::AS_INVALID)
ENUM_TYPE_SERIALIZATION(dsn::replication::bulk_load_status::type,
                        dsn::replication::bulk_load_status::BLS_INVALID)

// json serialization for gpid, we treat it as string: "app_id.partition_id"
inline void json_encode(JsonWriter &out, const dsn::gpid &pid)
{
    json_encode(out, pid.to_string());
}
inline bool json_decode(const dsn::json::JsonObject &in, dsn::gpid &pid)
{
    std::string gpid_message;
    dverify(json_decode(in, gpid_message));
    return pid.parse_from(gpid_message.c_str());
}

// json serialization for rpc address, we use the string representation of a address
inline void json_encode(JsonWriter &out, const dsn::rpc_address &address)
{
    json_encode(out, address.to_string());
}
inline bool json_decode(const dsn::json::JsonObject &in, dsn::rpc_address &address)
{
    std::string rpc_address_string;
    dverify(json_decode(in, rpc_address_string));
    if (rpc_address_string == "invalid address") {
        return true;
    }
    return address.from_string_ipv4(rpc_address_string.c_str());
}

inline void json_encode(JsonWriter &out, const dsn::partition_configuration &config);
inline bool json_decode(const JsonObject &in, dsn::partition_configuration &config);
inline void json_encode(JsonWriter &out, const dsn::app_info &info);
inline bool json_decode(const JsonObject &in, dsn::app_info &info);
inline void json_encode(JsonWriter &out, const dsn::replication::file_meta &f_meta);
inline bool json_decode(const JsonObject &in, dsn::replication::file_meta &f_meta);
inline void json_encode(JsonWriter &out, const dsn::replication::bulk_load_metadata &metadata);
inline bool json_decode(const JsonObject &in, dsn::replication::bulk_load_metadata &metadata);

template <typename T>
inline void json_encode_iterable(JsonWriter &out, const T &t)
{
    out.StartArray();
    for (auto it = t.begin(); it != t.end(); ++it) {
        json_forwarder<typename std::decay<decltype(*it)>::type>::encode(out, *it);
    }
    out.EndArray();
}

template <typename T>
inline void json_encode_map(JsonWriter &out, const T &t)
{
    out.StartObject();
    for (auto it = t.begin(); it != t.end(); ++it) {
        // please notice that in json's standard, all keys must be string
        std::string key_string = boost::lexical_cast<std::string>(it->first);
        out.Key(key_string.c_str(), key_string.size(), true);
        json_forwarder<typename std::decay<decltype(it->second)>::type>::encode(out, it->second);
    }
    out.EndObject();
}

template <typename TMap>
inline bool json_decode_map(const JsonObject &in, TMap &t)
{
    dverify(in.IsObject());
    t.clear();
    for (rapidjson::Value::ConstMemberIterator it = in.MemberBegin(); it != in.MemberEnd(); ++it) {
        typename TMap::key_type key;
        dverify_exception(key = boost::lexical_cast<typename TMap::key_type>(it->name.GetString()));
        typename TMap::mapped_type value;
        dverify(json_forwarder<decltype(value)>::decode(it->value, value));
        if (!t.emplace(key, value).second)
            return false;
    }
    return true;
}

template <typename T>
inline void json_encode(JsonWriter &out, const std::vector<T> &t)
{
    json_encode_iterable(out, t);
}

template <typename T>
inline bool json_decode(const JsonObject &in, std::vector<T> &t)
{
    dverify(in.IsArray());
    t.clear();
    t.reserve(in.Size());

    for (rapidjson::Value::ConstValueIterator it = in.Begin(); it != in.End(); ++it) {
        T value;
        dverify(json_forwarder<T>::decode(*it, value));
        t.emplace_back(std::move(value));
    }
    return true;
}

template <typename T>
inline void json_encode(JsonWriter &out, const std::set<T> &t)
{
    json_encode_iterable(out, t);
}

template <typename T>
inline bool json_decode(const JsonObject &in, std::set<T> &t)
{
    dverify(in.IsArray());
    t.clear();

    for (rapidjson::Value::ConstValueIterator it = in.Begin(); it != in.End(); ++it) {
        T value;
        dverify(json_forwarder<T>::decode(*it, value));
        dverify(t.emplace(std::move(value)).second);
    }
    return true;
}

template <typename T1, typename T2>
inline void json_encode(JsonWriter &out, const std::unordered_map<T1, T2> &t)
{
    json_encode_map(out, t);
}

template <typename T1, typename T2>
inline bool json_decode(const JsonObject &in, std::unordered_map<T1, T2> &t)
{
    return json_decode_map(in, t);
}

template <typename T1, typename T2>
inline void json_encode(JsonWriter &out, const std::map<T1, T2> &t)
{
    json_encode_map(out, t);
}

template <typename T1, typename T2>
inline bool json_decode(const JsonObject &in, std::map<T1, T2> &t)
{
    return json_decode_map(in, t);
}

template <typename T>
inline void json_encode(JsonWriter &out, const dsn::ref_ptr<T> &t)
{
    // when a smart ptr is encoded, caller should ensure the ptr is not nullptr
    // TODO: encoded to null?
    assert(t.get() != nullptr);
    json_encode(out, *t);
}

template <typename T>
inline bool json_decode(const JsonObject &in, dsn::ref_ptr<T> &t)
{
    t = new T();
    return json_decode(in, *t);
}

template <typename T>
inline void json_encode(JsonWriter &out, const std::shared_ptr<T> &t)
{
    // when a smart ptr is encoded, caller should ensure the ptr is not nullptr
    // TODO: encoded to null?
    assert(t.get() != nullptr);
    json_encode(out, *t);
}

template <typename T>
inline bool json_decode(const JsonObject &in, std::shared_ptr<T> &t)
{
    t.reset(new T());
    return json_decode(in, *t);
}

template <typename T>
class json_forwarder
{
private:
    // check if C has C.encode_json_state(dsn::json::JsonWriter&) function
    template <typename C>
    static auto check_json_state(C *) -> typename std::is_same<
        decltype(std::declval<C>().encode_json_state(std::declval<dsn::json::JsonWriter &>())),
        void>::type;

    template <typename>
    static std::false_type check_json_state(...);

    // check if C has C->json_state(dsn::json::JsonWriter&) function
    template <typename C>
    static auto p_check_json_state(C *) -> typename std::is_same<
        decltype(std::declval<C>()->encode_json_state(std::declval<dsn::json::JsonWriter &>())),
        void>::type;

    template <typename>
    static std::false_type p_check_json_state(...);

    typedef decltype(check_json_state<T>(0)) has_json_state;
    typedef decltype(p_check_json_state<T>(0)) p_has_json_state;

    // internal serialization
    static void encode_inner(JsonWriter &out, const T &t, std::true_type, std::false_type)
    {
        t.encode_json_state(out);
    }
    static void encode_inner(JsonWriter &out, const T &t, std::false_type, std::true_type)
    {
        t->encode_json_state(out);
    }
    static void encode_inner(JsonWriter &out, const T &t, std::true_type, std::true_type)
    {
        t->encode_json_state(out);
    }
    static void encode_inner(JsonWriter &out, const T &t, std::false_type, std::false_type)
    {
        json_encode(out, t);
    }

    // internal deserialization
    static bool decode_inner(const JsonObject &in, T &t, std::true_type, std::false_type)
    {
        return t.decode_json_state(in);
    }
    static bool decode_inner(const JsonObject &in, T &t, std::false_type, std::true_type)
    {
        return t->decode_json_state(in);
    }
    static bool decode_inner(const JsonObject &in, T &t, std::true_type, std::true_type)
    {
        return t->decode_json_state(in);
    }
    static bool decode_inner(const JsonObject &in, T &t, std::false_type, std::false_type)
    {
        return json_decode(in, t);
    }

public:
    static void encode(JsonWriter &out, const T &t)
    {
        encode_inner(out, t, has_json_state{}, p_has_json_state{});
    }
    static void encode(std::ostream &os, const T &t)
    {
        rapidjson::OStreamWrapper wrapper(os);
        JsonWriter writer(wrapper);
        encode(writer, t);
    }
    static dsn::blob encode(const T &t)
    {
        std::ostringstream os;
        encode(os, t);
        return blob::create_from_bytes(os.str());
    }

    static bool decode(const JsonObject &in, T &t)
    {
        return decode_inner(in, t, has_json_state{}, p_has_json_state{});
    }
    static bool decode(const dsn::blob &bb, T &t)
    {
        rapidjson::Document doc;
        dverify(!doc.Parse(bb.data(), bb.length()).HasParseError());
        return decode(doc, t);
    }

    // decode the member that's const qualified.
    static bool decode(const JsonObject &in, const T &t)
    {
        using MutableT = typename std::remove_const<T>::type;
        return decode(in, const_cast<MutableT &>(t));
    }
    static bool decode(const dsn::blob &bb, const T &t)
    {
        using MutableT = typename std::remove_const<T>::type;
        return decode(bb, const_cast<MutableT &>(t));
    }
};

NON_MEMBER_JSON_SERIALIZATION(dsn::partition_configuration,
                              pid,
                              ballot,
                              max_replica_count,
                              primary,
                              secondaries,
                              last_drops,
                              last_committed_decree,
                              partition_flags)

NON_MEMBER_JSON_SERIALIZATION(dsn::app_info,
                              status,
                              app_type,
                              app_name,
                              app_id,
                              partition_count,
                              envs,
                              is_stateful,
                              max_replica_count,
                              expire_second,
                              create_second,
                              drop_second,
                              duplicating,
                              init_partition_count,
                              is_bulk_loading)

NON_MEMBER_JSON_SERIALIZATION(dsn::replication::file_meta, name, size, md5)

NON_MEMBER_JSON_SERIALIZATION(dsn::replication::bulk_load_metadata, files, file_total_size)
} // namespace json
} // namespace dsn


================================================
FILE: include/dsn/cpp/message_utils.h
================================================
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

#pragma once

#include <dsn/utility/string_view.h>
#include <dsn/utility/binary_writer.h>
#include <dsn/utility/binary_reader.h>
#include <dsn/cpp/rpc_stream.h>
#include <dsn/cpp/serialization.h>
#include <dsn/tool-api/rpc_message.h>
#include <dsn/cpp/serialization_helper/dsn.layer2_types.h>

namespace dsn {

/// Move the content inside message `m` into a blob.
inline blob move_message_to_blob(message_ex *m)
{
    rpc_read_stream reader(m);
    return reader.get_buffer();
}

/// Convert a blob into a message for reading(unmarshalling).
/// This function is identical with dsn::message_ex::create_received_request,
/// however it passes a blob to ensure ownership safety instead of
/// passing simply a constant view.
/// MUST released manually later using dsn::message_ex::release_ref.
extern message_ex *
from_blob_to_received_msg(task_code rpc_code,
                          const blob &bb,
                          int thread_hash = 0,
                          uint64_t partition_hash = 0,
                          dsn_msg_serialize_format serialization_type = DSF_THRIFT_BINARY);
inline message_ex *
from_blob_to_received_msg(task_code rpc_code,
                          blob &&bb,
                          int thread_hash = 0,
                          uint64_t partition_hash = 0,
                          dsn_msg_serialize_format serialization_type = DSF_THRIFT_BINARY)
{
    return from_blob_to_received_msg(rpc_code, bb, thread_hash, partition_hash, serialization_type);
}

/// Convert a thrift request into a dsn message (using binary encoding).
/// It's useful for unit test, especially when we need to create a fake message
/// as test input.
template <typename T>
inline message_ex *from_thrift_request_to_received_message(const T &thrift_request, task_code tc)
{
    binary_writer writer;
    marshall_thrift_binary(writer, thrift_request);
    return from_blob_to_received_msg(tc, writer.get_buffer());
}

/// Convert a blob into a thrift object.
template <typename T>
inline void from_blob_to_thrift(const blob &data, T &thrift_obj)
{
    binary_reader reader(data);
    unmarshall_thrift_binary(reader, thrift_obj);
}

} // namespace dsn


================================================
FILE: include/dsn/cpp/pipeline.h
================================================
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

#pragma once

#include <dsn/tool-api/task_code.h>
#include <dsn/tool-api/task_tracker.h>
#include <dsn/tool-api/async_calls.h>
#include <dsn/utility/chrono_literals.h>
#include <dsn/utility/apply.h>

namespace dsn {
namespace pipeline {

// The environment for execution.
struct environment
{
    template <typename F>
    void schedule(F &&f, std::chrono::milliseconds delay_ms = 0_ms) const
    {
        tasking::enqueue(__conf.thread_pool_code,
                         __conf.tracker,
                         std::forward<F>(f),
                         __conf.thread_hash,
                         delay_ms);
    }

    /// Fluent APIs to specify the environment configuration.
    environment &thread_pool(task_code tc)
    {
        __conf.thread_pool_code = tc;
        return *this;
    }
    environment &thread_hash(int hash)
    {
        __conf.thread_hash = hash;
        return *this;
    }
    environment &task_tracker(dsn::task_tracker *tracker)
    {
        __conf.tracker = tracker;
        return *this;
    }

    struct
    {
        task_code thread_pool_code;
        dsn::task_tracker *tracker{nullptr};
        int thread_hash{0};
    } __conf;
};

template <typename... Args>
struct result
{
    typedef std::tuple<Args...> ArgsTupleType;

    // Step down to next stage.
    // NOTE: Remember to exit from caller function after `step_down_next_stage`.
    // For example:
    //
    // ```
    //   pipeline::base base;
    //   ping_rpc rpc = ...;
    //
    //   pipeline::do_when<> ping([&ping]() {
    //        bool ok = rpc.call();
    //        if(ok) {
    //            step_down_next_stage();
    //            // when steps out, it goes to repeat this stage round and round.
    //        }
    //        repeat(1_s); // will repeat even after stepping down to next stage.
    //   });
    //
    //   base.thread_pool(LPC_DUPLICATE_MUTATIONS).task_tracker(&tracker).from(&s1);
    //   base.run_pipeline();
    //   base.wait_all();
    // ```
    //
    // To fix the problem, return immediately after `step_down_next_stage`.
    //
    // ```
    //   pipeline::do_when<> ping([&ping]() {
    //        bool ok = rpc.call();
    //        if(ok) {
    //            step_down_next_stage();
    //            return;
    //        }
    //        repeat(1_s); // will repeat even after stepping down to next stage.
    //   });
    // ```
    //
    void step_down_next_stage(Args &&... args)
    {
        dassert(__func != nullptr, "no next stage is linked");
        __func(std::make_tuple(std::forward<Args>(args)...));
    }

    std::function<void(ArgsTupleType &&)> __func;
};

//
// Example:
//
// ```
//   pipeline::base base;
//
//   pipeline::do_when<> s1([&s1]() { s1.repeat(1_s); });
//   base.thread_pool(LPC_DUPLICATE_MUTATIONS).task_tracker(&tracker).from(&s1);
//
//   base.run_pipeline();
//   base.pause();
//   base.wait_all();
// ```
//
struct base : environment
{
    // Start this pipeline.
    // NOTE: Be careful when pipeline starting and pausing are running concurrently,
    //       though it's internally synchronized, the actual order is still non-deterministic
    //       from the user's view.
    //
    // ```
    //   base.schedule([&base]() { base.run_pipeline(); });
    //   base.pause();
    //   base.wait_all(); // the pipeline won't stop.
    // ```
    //
    void run_pipeline();

    void pause() { _paused.store(true, std::memory_order_release); }

    bool paused() const { return _paused.load(std::memory_order_acquire); }

    // Await for all running tasks to complete.
    void wait_all() { __conf.tracker->wait_outstanding_tasks(); }
    void cancel_all() { __conf.tracker->cancel_outstanding_tasks(); }

    /// === Pipeline Declaration === ///
    /// Declaration of pipeline is not thread-safe.

    template <typename Stage>
    struct node
    {
        // pipeline supports cyclic execution.
        // For example in "data verifier", we insert data into database, and verify
        // that it is applied successfully. After verification we make next insert.
        //
        // ```
        //      _insert = dsn::make_unique<insert_data>(...);
        //      _verify = dsn::make_unique<verify_data>(...);
        //      link(*_insert).link(*_verify).link(*_insert);
        // ```
        //
        // Here we construct a infinite loop.
        // When first `_insert` steps down to `_verify`, it directly calls the function
        // `_verify->run(...)`.
        // However when `_verify` is stepping down, in order to avoid infinite recursion
        // which will cause stack overflow, it calls `_insert->async(..)`, which enqueues
        // a new task into rdsn task engine.
        template <typename NextStage>
        node<NextStage> link(NextStage &next)
        {
            using ArgsTupleType = typename Stage::ArgsTupleType;

            // link to node of existing pipeline
            if (next.__pipeline != nullptr) {
                this_stage->__func = [next_ptr = &next](ArgsTupleType && args) mutable
                {
                    dsn::apply(&NextStage::async,
                               std::tuple_cat(std::make_tuple(next_ptr), std::move(args)));
                };
            } else {
                next.__conf = this_stage->__conf;
                next.__pipeline = this_stage->__pipeline;
                this_stage->__func = [next_ptr = &next](ArgsTupleType && args) mutable
                {
                    if (next_ptr->paused()) {
                        return;
                    }
                    dsn::apply(&NextStage::run,
                               std::tuple_cat(std::make_tuple(next_ptr), std::move(args)));
                };
            }
            return node<NextStage>(&next);
        }

        explicit node(Stage *s) : this_stage(s) {}

    private:
        Stage *this_stage;
    };

    template <typename Stage>
    node<Stage> from(Stage &start)
    {
        start.__conf = __conf;
        start.__pipeline = this;
        _root_stage = &start;
        return node<Stage>(&start);
    }

    // Create a fork of the pipeline, which shares the same task tracker,
    // but with different thread pool, thread hash.
    template <typename NextStage>
    node<NextStage> fork(NextStage &next, task_code tc, int thread_hash)
    {
        next.__conf.thread_pool_code = tc;
        next.__conf.thread_hash = thread_hash;
        next.__conf.tracker = __conf.tracker;

        next.__pipeline = this;
        return node<NextStage>(&next);
    }

private:
    environment *_root_stage{nullptr};
    std::atomic_bool _paused{true};
};

// A piece of execution, receiving argument `Args`, running in the environment
// created by `pipeline::base`.
template <typename... Args>
struct when : environment
{
    /// Run this stage within current context.
    virtual void run(Args &&... in) = 0;

    void repeat(Args &&... in, std::chrono::milliseconds delay_ms = 0_ms)
    {
        auto arg_tuple = std::make_tuple(this, std::forward<Args>(in)...);
        schedule([ this, args = std::move(arg_tuple) ]() mutable {
            if (paused()) {
                return;
            }
            dsn::apply(&when<Args...>::run, std::move(args));
        },
                 delay_ms);
    }

    /// Run this stage asynchronously in its environment.
    void async(Args &&... in) { repeat(std::forward<Args>(in)...); }

    bool paused() const { return __pipeline->paused(); }

    base *__pipeline{nullptr};
};

inline void base::run_pipeline()
{
    dassert(__conf.tracker != nullptr, "must configure task tracker");

    _paused.store(false, std::memory_order_release);

    schedule([stage = static_cast<when<> *>(_root_stage)]() {
        // static_cast for downcast, but completely safe.
        stage->run();
    });
}

/// A simple utility for definition of a `when` using lambda.
/// It's useful for unit test.
template <typename... Args>
struct do_when : when<Args...>
{
    explicit do_when(std::function<void(Args &&... args)> &&func) : _cb(std::move(func)) {}

    void run(Args &&... args) override { _cb(std::forward<Args>(args)...); }

    virtual ~do_when() = default;

private:
    std::function<void(Args &&...)> _cb;
};

/// Runnable must extend from pipeline::environment and implement
/// a public method: `void run();`
template <typename Runnable>
static void repeat(Runnable &&r, std::chrono::milliseconds delay_ms = 0_ms)
{
    environment env = r;
    env.schedule([r = std::move(r)]() mutable { r.run(); }, delay_ms);
}

} // namespace pipeline
} // namespace dsn


================================================
FILE: include/dsn/cpp/rpc_holder.h
================================================
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

#pragma once

#include <dsn/c/api_common.h>
#include <dsn/c/api_layer1.h>
#include <dsn/service_api_cpp.h>
#include <dsn/tool-api/rpc_message.h>
#include <dsn/tool-api/async_calls.h>
#include <dsn/tool-api/task_tracker.h>
#include <dsn/utility/smart_pointers.h>
#include <dsn/utility/chrono_literals.h>
#include <dsn/dist/replication/partition_resolver.h>

namespace dsn {

using literals::chrono_literals::operator"" _ms;

//
// rpc_holder is mainly designed for RAII of message_ex*.
// Since the request message will be automatically released after the rpc ends,
// it will become inaccessible when you use it in an async call (probably via tasking::enqueue).
// So in rpc_holder we hold another reference of the message, preventing it to be deleted.
//
// rpc_holder also provides a simple approach for rpc mocking.
// For example:
//
//   typedef rpc_holder<write_request, write_response> write_rpc;
//
//   void write() {
//       ....
//       auto request = make_unique<write_request>();
//       request->data = "abc";
//       request->timestamp = 12;
//       write_rpc rpc(std::move(request), RPC_WRITE);
//       rpc.call(rpc_address("10.57.223.31", 12321), nullptr, on_write_rpc_reply);
//       ...
//   }
//
//   RPC_MOCKING(write_rpc) {
//       write();
//       ASSERT_EQ(1, write_rpc::mail_box().size());
//   }
//
// Here in the instance of `RPC_MOCKING`, we call a function `write`, in which a write_rpc
// was sent to "10.57.223.31:12321". However, since we are in the mock mode, every `write_request`
// message will be dropped into `write_rpc::mail_box` without going through network.
//

template <typename TRequest, typename TResponse>
class rpc_holder
{
public:
    using request_type = TRequest;
    using response_type = TResponse;

public:
    explicit rpc_holder(message_ex *req = nullptr)
    {
        if (req != nullptr) {
            _i = std::make_shared<internal>(req);
        }
    }

    rpc_holder(std::unique_ptr<TRequest> req,
               task_code code,
               std::chrono::milliseconds timeout = 0_ms,
               uint64_t partition_hash = 0,
               int thread_hash = 0)
        : _i(new internal(req, code, timeout, partition_hash, thread_hash))
    {
    }

    // copyable and movable
    // Copying an rpc_holder doesn't produce a deep copy, the new instance will
    // reference the same rpc internal data. So, just feel free to copy :)
    rpc_holder(const rpc_holder &) = default;
    rpc_holder(rpc_holder &&) noexcept = default;
    rpc_holder &operator=(const rpc_holder &) = default;
    rpc_holder &operator=(rpc_holder &&) noexcept = default;

    bool is_initialized() const { return bool(_i); }

    const TRequest &request() const
    {
        dassert(_i, "rpc_holder is uninitialized");
        return *(_i->thrift_request);
    }

    TRequest *mutable_request() const
    {
        dassert(_i, "rpc_holder is uninitialized");
        return _i->thrift_request.get();
    }

    TResponse &response() const
    {
        dassert(_i, "rpc_holder is uninitialized");
        return _i->thrift_response;
    }

    dsn::error_code &error() const
    {
        dassert(_i, "rpc_holder is uninitialized");
        return _i->rpc_error;
    }

    message_ex *dsn_request() const
    {
        dassert(_i, "rpc_holder is uninitialized");
        return _i->dsn_request;
    }

    // the remote address where reveice request from and send response to.
    rpc_address remote_address() const { return dsn_request()->header->from_address; }

    // TCallback = void(error_code)
    // NOTE that the `error_code` is not the error carried by response. Users should
    // check the responded error themselves.
    template <typename TCallback>
    task_ptr call(const rpc_address &server,
                  task_tracker *tracker,
                  TCallback &&callback,
                  int reply_thread_hash = 0)
    {
        // ensures that TCallback receives exactly one argument, which must be a error_code.
        static_assert(function_traits<TCallback>::arity == 1,
                      "TCallback must receive exactly one argument");
        static_assert(
            std::is_same<typename function_traits<TCallback>::template arg_t<0>, error_code>::value,
            "the first argument of TCallback must be error_code");

        if (dsn_unlikely(_mail_box != nullptr)) {
            _mail_box->emplace_back(*this);
            return nullptr;
        }

        rpc_response_task_ptr t = rpc::create_rpc_response_task(
            dsn_request(),
            tracker,
            [ cb_fwd = std::forward<TCallback>(callback),
              rpc = *this ](error_code err, message_ex * req, message_ex * resp) mutable {
                if (err == ERR_OK) {
                    unmarshall(resp, rpc.response());
                }
                cb_fwd(err);
            },
            reply_thread_hash);
        dsn_rpc_call(server, t);
        return t;
    }

    template <typename TCallback>
    task_ptr call(replication::partition_resolver_ptr &resolver,
                  task_tracker *tracker,
                  TCallback &&callback,
                  int reply_thread_hash = 0)
    {
        static_assert(function_traits<TCallback>::arity == 1,
                      "TCallback must receive exactly one argument");
        static_assert(
            std::is_same<typename function_traits<TCallback>::template arg_t<0>, error_code>::value,
            "the first argument of TCallback must be error_code");

        if (dsn_unlikely(_mail_box != nullptr)) {
            _mail_box->emplace_back(*this);
            return nullptr;
        }

        rpc_response_task_ptr t = rpc::create_rpc_response_task(
            dsn_request(),
            tracker,
            [ cb_fwd = std::forward<TCallback>(callback),
              rpc = *this ](error_code err, message_ex * req, message_ex * resp) mutable {
                if (err == ERR_OK) {
                    unmarshall(resp, rpc.response());
                }
                cb_fwd(err);
            },
            reply_thread_hash);
        resolver->call_task(t);
        return t;
    }

    void forward(const rpc_address &addr)
    {
        _i->auto_reply = false;
        if (dsn_unlikely(_forward_mail_box != nullptr)) {
            dsn_request()->header->from_address = addr;
            _forward_mail_box->emplace_back(*this);
            return;
        }

        dsn_rpc_forward(dsn_request(), addr);
    }

    // Returns an rpc_holder that will reply the request after its lifetime ends.
    // By default rpc_holder never replies.
    // SEE: serverlet<T>::register_rpc_handler_with_rpc_holder
    static inline rpc_holder auto_reply(message_ex *req)
    {
        rpc_holder rpc(req);
        rpc._i->auto_reply = true;
        return rpc;
    }

    // Only use this function when testing.
    // In mock mode, all messages will be dropped into mail_box without going through network,
    // and response callbacks will never be called.
    // This function is not thread-safe.
    using mail_box_t = std::vector<rpc_holder<TRequest, TResponse>>;
    using mail_box_u_ptr = std::unique_ptr<mail_box_t>;
    static void enable_mocking()
    {
        dassert(_mail_box == nullptr && _forward_mail_box == nullptr,
                "remember to call clear_mocking_env after testing");
        _mail_box = make_unique<mail_box_t>();
        _forward_mail_box = make_unique<mail_box_t>();
    }

    // Only use this function when testing.
    // Remember to call it after test finishes, or it may effect the results of other tests.
    // This function is not thread-safe.
    static void clear_mocking_env()
    {
        _mail_box.reset(nullptr);
        _forward_mail_box.reset(nullptr);
    }

    static mail_box_t &mail_box()
    {
        dassert(_mail_box != nullptr, "call this function only when you are in mock mode");
        return *_mail_box.get();
    }

    static mail_box_t &forward_mail_box()
    {
        dassert(_forward_mail_box != nullptr, "call this function only when you are in mock mode");
        return *_forward_mail_box.get();
    }

    friend bool operator<(const rpc_holder &lhs, const rpc_holder &rhs) { return lhs._i < rhs._i; }

private:
    friend class rpc_holder_test;

    struct internal
    {
        explicit internal(message_ex *req)
            : dsn_request(req), thrift_request(make_unique<TRequest>()), auto_reply(false)
        {
            // we must hold one reference for the request, or rdsn will delete it after
            // the rpc call ends.
            dsn_request->add_ref();
            unmarshall(req, *thrift_request);
        }

        internal(std::unique_ptr<TRequest> &req,
                 task_code code,
                 std::chrono::milliseconds timeout,
                 uint64_t partition_hash,
                 int thread_hash)
            : thrift_request(std::move(req)), auto_reply(false)
        {
            dassert(thrift_request != nullptr, "req should not be null");

            dsn_request = message_ex::create_request(
                code, static_cast<int>(timeout.count()), thread_hash, partition_hash);
            dsn_request->add_ref();
            marshall(dsn_request, *thrift_request);
        }

        void reply()
        {
            if (dsn_unlikely(_mail_box != nullptr)) {
                rpc_holder<TRequest, TResponse> rpc(std::move(thrift_request),
                                                    dsn_request->rpc_code());
                rpc.response() = std::move(thrift_response);
                _mail_box->emplace_back(std::move(rpc));
                return;
            }

            message_ex *dsn_response = dsn_request->create_response();
            marshall(dsn_response, thrift_response);
            dsn_rpc_reply(dsn_response, rpc_error);
        }

        ~internal()
        {
            if (auto_reply) {
                reply();
            }
            dsn_request->release_ref();
        }

        message_ex *dsn_request;
        std::unique_ptr<TRequest> thrift_request;
        TResponse thrift_response;
        dsn::error_code rpc_error = dsn::ERR_OK;

        bool auto_reply;
    };

    std::shared_ptr<internal> _i;

    static mail_box_u_ptr _mail_box;
    static mail_box_u_ptr _forward_mail_box;
};

// ======== type traits ========

// check if a given type is rpc_holder.
// is_rpc_holder<T>::value = true indicates that type T is an rpc_holder.

template <typename T>
struct is_rpc_holder : public std::false_type
{
};

template <typename TRequest, typename TResponse>
struct is_rpc_holder<rpc_holder<TRequest, TResponse>> : public std::true_type
{
};

// ======== utilities ========

namespace rpc {

// call an RPC specified by rpc_holder.
// TCallback = void(error_code)

template <typename TCallback, typename TRpcHolder>
task_ptr call(rpc_address server,
              TRpcHolder rpc,
              task_tracker *tracker,
              TCallback &&callback,
              int reply_thread_hash = 0)
{
    static_assert(is_rpc_holder<TRpcHolder>::value, "TRpcHolder must be an rpc_holder");
    return rpc.call(server, tracker, std::forward<TCallback &&>(callback), reply_thread_hash);
}

} // namespace rpc

// ======== rpc mock ========

template <typename TRequest, typename TResponse>
typename rpc_holder<TRequest, TResponse>::mail_box_u_ptr rpc_holder<TRequest, TResponse>::_mail_box;
template <typename TRequest, typename TResponse>
typename rpc_holder<TRequest, TResponse>::mail_box_u_ptr
    rpc_holder<TRequest, TResponse>::_forward_mail_box;

template <typename TRpcHolder>
struct rpc_mock_wrapper
{
    rpc_mock_wrapper() { TRpcHolder::enable_mocking(); }
    ~rpc_mock_wrapper() { TRpcHolder::clear_mocking_env(); }
    int counter = 0;
};

#define RPC_MOCKING(__rpc_type__)                                                                  \
    for (::dsn::rpc_mock_wrapper<__rpc_type__> __rpc_type__##_mocking__;                           \
         __rpc_type__##_mocking__.counter != 1;                                                    \
         __rpc_type__##_mocking__.counter++)

} // namespace dsn


================================================
FILE: include/dsn/cpp/rpc_stream.h
================================================
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Microsoft Corporation
 *
 * -=- Robust Distributed System Nucleus (rDSN) -=-
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

#pragma once

#include <dsn/utility/utils.h>
#include <dsn/utility/binary_reader.h>
#include <dsn/utility/binary_writer.h>

#include <dsn/tool-api/rpc_message.h>
#include <dsn/tool-api/auto_codes.h>
#include <dsn/service_api_c.h>

namespace dsn {

// rpc_read_stream is a bridge between binary_reader and rpc_message, with which you can
// easily visit rpc_message's buffer in binary_reader's manner.
class rpc_read_stream : public binary_reader
{
public:
    rpc_read_stream(message_ex *msg) { set_read_msg(msg); }

    rpc_read_stream() : _msg(nullptr) {}

    void set_read_msg(message_ex *msg)
    {
        _msg = msg;
        if (nullptr != _msg) {
            ::dsn::blob bb;
            bool r = ((::dsn::message_ex *)_msg)->read_next(bb);
            dassert(r, "read msg must have one segment of buffer ready");

            init(std::move(bb));
        }
    }

    int read(char *buffer, int sz) { return inner_read(buffer, sz); }

    int read(blob &blob, int len) { return inner_read(blob, len); }

    ~rpc_read_stream()
    {
        if (_msg) {
            _msg->read_commit((size_t)(total_size() - get_remaining_size()));
        }
    }

private:
    dsn::message_ex *_msg;
};
typedef ::dsn::ref_ptr<rpc_read_stream> rpc_read_stream_ptr;

// rpc_write_stream is a bridge between binary_writer and rpc_message, with which you can
// easily store data to rpc_message's buffer in binary_writer's manner.
class rpc_write_stream : public binary_writer
{
public:
    rpc_write_stream(message_ex *msg)
        : _msg(msg), _last_write_next_committed(true), _last_write_next_total_size(0)
    {
    }

    // write buffer for rpc_write_stream is allocated from
    // a per-thread pool, and it is expected that
    // the per-thread pool cannot allocated two outstanding
    // buffers at the same time.
    // e.g., alloc1, commit1, alloc2, commit2 is ok
    // while alloc1, alloc2, commit2, commit 1 is invalid
    // TODO(zhaoliwei): remove functions and variables below, because msg is not implemented by tls
    // memory now
    void commit_buffer()
    {
        if (!_last_write_next_committed) {
            _msg->write_commit((size_t)(total_size() - _last_write_next_total_size));
            _last_write_next_committed = true;
        }
    }

    virtual ~rpc_write_stream() { flush(); }

    virtual void flush() override
    {
        binary_writer::flush();
        commit_buffer();
    }

private:
    virtual void create_new_buffer(size_t size, /*out*/ blob &bb) override
    {
        commit_buffer();

        void *ptr;
        size_t sz;
        _msg->write_next(&ptr, &sz, size);
        dbg_dassert(sz >= size, "allocated buffer size must be not less than the required size");
        bb.assign((const char *)ptr, 0, (int)sz);

        _last_write_next_total_size = total_size();
        _last_write_next_committed = false;
    }

private:
    message_ex *_msg;
    bool _last_write_next_committed;
    int _last_write_next_total_size;
};
typedef ::dsn::ref_ptr<rpc_write_stream> rpc_write_stream_ptr;
} // namespace dsn


================================================
FILE: include/dsn/cpp/serialization.h
================================================
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Microsoft Corporation
 *
 * -=- Robust Distributed System Nucleus (rDSN) -=-
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

#pragma once

#include <dsn/utility/utils.h>
#include <dsn/tool-api/rpc_address.h>
#include <dsn/cpp/rpc_stream.h>
#include <dsn/cpp/serialization_helper/thrift_helper.h>

namespace dsn {
namespace serialization {

template <typename T>
std::string no_registered_function_error_notice(const T &t, dsn_msg_serialize_format fmt)
{
    std::stringstream ss;
    ss << "This error occurs because someone is trying to ";
    ss << "serialize/deserialize an object of the type ";
    ss << typeid(t).name();
    ss << " but has not registered corresponding serialization/deserialization function for the "
          "format of ";
    //           ss << enum_to_string(fmt) << ".";
    ss << fmt << ".";
    return ss.str();
}

} // namespace serialization

template <typename ThriftType>
inline void marshall(binary_writer &writer, const ThriftType &value, dsn_msg_serialize_format fmt)
{
    switch (fmt) {
    case DSF_THRIFT_BINARY:
        marshall_thrift_binary(writer, value);
        break;
    case DSF_THRIFT_JSON:
        marshall_thrift_json(writer, value);
        break;
    default:
        dassert(false, serialization::no_registered_function_error_notice(value, fmt).c_str());
    }
}

template <typename ThriftType>
inline void unmarshall(binary_reader &reader, ThriftType &value, dsn_msg_serialize_format fmt)
{
    switch (fmt) {
    case DSF_THRIFT_BINARY:
        unmarshall_thrift_binary(reader, value);
        break;
    case DSF_THRIFT_JSON:
        unmarshall_thrift_json(reader, value);
        break;
    default:
        dassert(false, serialization::no_registered_function_error_notice(value, fmt).c_str());
    }
}

template <typename T>
inline void marshall(dsn::message_ex *msg, const T &val)
{
    ::dsn::rpc_write_stream writer(msg);
    marshall(writer, val, (dsn_msg_serialize_format)msg->header->context.u.serialize_format);
}

template <typename T>
inline void marshall(dsn::message_ex *msg, const T &val, dsn_msg_serialize_format fmt)
{
    ::dsn::rpc_write_stream writer(msg);
    marshall(writer, val, fmt);
}

template <typename T>
inline void unmarshall(dsn::message_ex *msg, /*out*/ T &val)
{
    ::dsn::rpc_read_stream reader(msg);
    unmarshall(reader, val, (dsn_msg_serialize_format)msg->header->context.u.serialize_format);
}

} // namespace dsn


================================================
FILE: include/dsn/cpp/serialization_helper/dsn.layer2_types.h
================================================
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Microsoft Corporation
 *
 * -=- Robust Distributed System Nucleus (rDSN) -=-
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
#ifndef dsn_layer2_TYPES_H
#define dsn_layer2_TYPES_H

#include <dsn/cpp/serialization_helper/dsn_types.h>
#include <iosfwd>

#include <thrift/Thrift.h>
#include <thrift/TApplicationException.h>
#include <thrift/protocol/TProtocol.h>
#include <thrift/transport/TTransport.h>

#include <thrift/cxxfunctional.h>

namespace dsn {

struct app_status
{
    enum type
    {
        AS_INVALID = 0,
        AS_AVAILABLE = 1,
        AS_CREATING = 2,
        AS_CREATE_FAILED = 3,
        AS_DROPPING = 4,
        AS_DROP_FAILED = 5,
        AS_DROPPED = 6,
        AS_RECALLING = 7
    };
};

extern const std::map<int, const char *> _app_status_VALUES_TO_NAMES;

class partition_configuration;

class configuration_query_by_index_request;

class configuration_query_by_index_response;

class app_info;

typedef struct _partition_configuration__isset
{
    _partition_configuration__isset()
        : pid(false),
          ballot(false),
          max_replica_count(false),
          primary(false),
          secondaries(false),
          last_drops(false),
          last_committed_decree(false),
          partition_flags(false)
    {
    }
    bool pid : 1;
    bool ballot : 1;
    bool max_replica_count : 1;
    bool primary : 1;
    bool secondaries : 1;
    bool last_drops : 1;
    bool last_committed_decree : 1;
    bool partition_flags : 1;
} _partition_configuration__isset;

class partition_configuration
{
public:
    partition_configuration(const partition_configuration &);
    partition_configuration(partition_configuration &&);
    partition_configuration &operator=(const partition_configuration &);
    partition_configuration &operator=(partition_configuration &&);
    partition_configuration()
        : ballot(0), max_replica_count(0), last_committed_decree(0), partition_flags(0)
    {
    }

    virtual ~partition_configuration() throw();
    ::dsn::gpid pid;
    int64_t ballot;
    int32_t max_replica_count;
    ::dsn::rpc_address primary;
    std::vector<::dsn::rpc_address> secondaries;
    std::vector<::dsn::rpc_address> last_drops;
    int64_t last_committed_decree;
    int32_t partition_flags;

    _partition_configuration__isset __isset;

    void __set_pid(const ::dsn::gpid &val);

    void __set_ballot(const int64_t val);

    void __set_max_replica_count(const int32_t val);

    void __set_primary(const ::dsn::rpc_address &val);

    void __set_secondaries(const std::vector<::dsn::rpc_address> &val);

    void __set_last_drops(const std::vector<::dsn::rpc_address> &val);

    void __set_last_committed_decree(const int64_t val);

    void __set_partition_flags(const int32_t val);

    bool operator==(const partition_configuration &rhs) const
    {
        if (!(pid == rhs.pid))
            return false;
        if (!(ballot == rhs.ballot))
            return false;
        if (!(max_replica_count == rhs.max_replica_count))
            return false;
        if (!(primary == rhs.primary))
            return false;
        if (!(secondaries == rhs.secondaries))
            return false;
        if (!(last_drops == rhs.last_drops))
            return false;
        if (!(last_committed_decree == rhs.last_committed_decree))
            return false;
        if (!(partition_flags == rhs.partition_flags))
            return false;
        return true;
    }
    bool operator!=(const partition_configuration &rhs) const { return !(*this == rhs); }

    bool operator<(const partition_configuration &) const;

    uint32_t read(::apache::thrift::protocol::TProtocol *iprot);
    uint32_t write(::apache::thrift::protocol::TProtocol *oprot) const;

    virtual void printTo(std::ostream &out) const;
};

void swap(partition_configuration &a, partition_configuration &b);

inline std::ostream &operator<<(std::ostream &out, const partition_configuration &obj)
{
    obj.printTo(out);
    return out;
}

typedef struct _configuration_query_by_index_request__isset
{
    _configuration_query_by_index_request__isset() : app_name(false), partition_indices(false) {}
    bool app_name : 1;
    bool partition_indices : 1;
} _configuration_query_by_index_request__isset;

class configuration_query_by_index_request
{
public:
    configuration_query_by_index_request(const configuration_query_by_index_request &);
    configuration_query_by_index_request(configuration_query_by_index_request &&);
    configuration_query_by_index_request &operator=(const configuration_query_by_index_request &);
    configuration_query_by_index_request &operator=(configuration_query_by_index_request &&);
    configuration_query_by_index_request() : app_name() {}

    virtual ~configuration_query_by_index_request() throw();
    std::string app_name;
    std::vector<int32_t> partition_indices;

    _configuration_query_by_index_request__isset __isset;

    void __set_app_name(const std::string &val);

    void __set_partition_indices(const std::vector<int32_t> &val);

    bool operator==(const configuration_query_by_index_request &rhs) const
    {
        if (!(app_name == rhs.app_name))
            return false;
        if (!(partition_indices == rhs.partition_indices))
            return false;
        return true;
    }
    bool operator!=(const configuration_query_by_index_request &rhs) const
    {
        return !(*this == rhs);
    }

    bool operator<(const configuratio
Download .txt
gitextract_4xu5fau8/

├── .clang-format
├── .github/
│   └── workflows/
│       ├── check_license_header.yaml
│       ├── compilation.yaml
│       ├── cpp_actions.yaml
│       ├── cpp_always_pass_actions.yaml
│       ├── issue_ref.yaml
│       └── non_cpp_actions.yaml
├── .gitignore
├── .licenserc.yaml
├── CMakeLists.txt
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── bin/
│   ├── FindDL.cmake
│   ├── FindJemalloc.cmake
│   ├── FindRT.cmake
│   ├── compiler_info.cmake
│   ├── dsn.cmake
│   └── thrift_utils.cmake
├── compile_thrift.py
├── include/
│   └── dsn/
│       ├── c/
│       │   ├── api_common.h
│       │   ├── api_layer1.h
│       │   ├── api_task.h
│       │   ├── api_utilities.h
│       │   └── app_model.h
│       ├── cpp/
│       │   ├── json_helper.h
│       │   ├── message_utils.h
│       │   ├── pipeline.h
│       │   ├── rpc_holder.h
│       │   ├── rpc_stream.h
│       │   ├── serialization.h
│       │   ├── serialization_helper/
│       │   │   ├── dsn.layer2_types.h
│       │   │   ├── dsn_types.h
│       │   │   └── thrift_helper.h
│       │   ├── serverlet.h
│       │   └── service_app.h
│       ├── dist/
│       │   ├── block_service.h
│       │   ├── common.h
│       │   ├── distributed_lock_service.h
│       │   ├── failure_detector/
│       │   │   ├── failure_detector.h
│       │   │   ├── fd.client.h
│       │   │   ├── fd.code.definition.h
│       │   │   └── fd.server.h
│       │   ├── failure_detector.h
│       │   ├── failure_detector_multimaster.h
│       │   ├── fmt_logging.h
│       │   ├── meta_state_service.h
│       │   ├── nfs_node.h
│       │   ├── remote_command.h
│       │   ├── replication/
│       │   │   ├── duplication_common.h
│       │   │   ├── meta_service_app.h
│       │   │   ├── mutation_duplicator.h
│       │   │   ├── mutation_log_tool.h
│       │   │   ├── partition_resolver.h
│       │   │   ├── replica_base.h
│       │   │   ├── replica_envs.h
│       │   │   ├── replica_test_utils.h
│       │   │   ├── replication.codes.h
│       │   │   ├── replication_app_base.h
│       │   │   ├── replication_ddl_client.h
│       │   │   ├── replication_enums.h
│       │   │   ├── replication_other_types.h
│       │   │   ├── replication_service_app.h
│       │   │   ├── replication_types.h
│       │   │   └── storage_serverlet.h
│       │   └── replication.h
│       ├── http/
│       │   └── http_server.h
│       ├── perf_counter/
│       │   ├── perf_counter.h
│       │   ├── perf_counter_utils.h
│       │   ├── perf_counter_wrapper.h
│       │   └── perf_counters.h
│       ├── service_api_c.h
│       ├── service_api_cpp.h
│       ├── tool/
│       │   ├── nativerun.h
│       │   ├── node_scoper.h
│       │   ├── providers.common.h
│       │   └── simulator.h
│       ├── tool-api/
│       │   ├── aio_task.h
│       │   ├── async_calls.h
│       │   ├── auto_codes.h
│       │   ├── command_manager.h
│       │   ├── env_provider.h
│       │   ├── file_io.h
│       │   ├── future_types.h
│       │   ├── global_config.h
│       │   ├── gpid.h
│       │   ├── group_address.h
│       │   ├── logging_provider.h
│       │   ├── message_parser.h
│       │   ├── network.h
│       │   ├── rpc_address.h
│       │   ├── rpc_message.h
│       │   ├── task.h
│       │   ├── task_code.h
│       │   ├── task_queue.h
│       │   ├── task_spec.h
│       │   ├── task_tracker.h
│       │   ├── task_worker.h
│       │   ├── thread_access_checker.h
│       │   ├── threadpool_code.h
│       │   ├── threadpool_spec.h
│       │   ├── timer_service.h
│       │   ├── uniq_timestamp_us.h
│       │   └── zlocks.h
│       ├── tool_api.h
│       ├── toollet/
│       │   ├── fault_injector.h
│       │   ├── profiler.h
│       │   └── tracer.h
│       ├── utility/
│       │   ├── TokenBucket.h
│       │   ├── absl/
│       │   │   ├── base/
│       │   │   │   └── internal/
│       │   │   │       └── invoke.h
│       │   │   └── utility/
│       │   │       └── utility.h
│       │   ├── alloc.h
│       │   ├── apply.h
│       │   ├── autoref_ptr.h
│       │   ├── binary_reader.h
│       │   ├── binary_writer.h
│       │   ├── blob.h
│       │   ├── casts.h
│       │   ├── chrono_literals.h
│       │   ├── clock.h
│       │   ├── config_api.h
│       │   ├── config_helper.h
│       │   ├── configuration.h
│       │   ├── crc.h
│       │   ├── customizable_id.h
│       │   ├── defer.h
│       │   ├── dlib.h
│       │   ├── endians.h
│       │   ├── enum_helper.h
│       │   ├── error_code.h
│       │   ├── errors.h
│       │   ├── exp_delay.h
│       │   ├── extensible_object.h
│       │   ├── factory_store.h
│       │   ├── fail_point.h
│       │   ├── filesystem.h
│       │   ├── fixed_size_buffer_pool.h
│       │   ├── flags.h
│       │   ├── function_traits.h
│       │   ├── hpc_locks/
│       │   │   ├── autoresetevent.h
│       │   │   ├── autoreseteventcondvar.h
│       │   │   ├── benaphore.h
│       │   │   ├── bitfield.h
│       │   │   ├── readme.txt
│       │   │   ├── rwlock.h
│       │   │   └── sema.h
│       │   ├── join_point.h
│       │   ├── link.h
│       │   ├── long_adder.h
│       │   ├── math.h
│       │   ├── metrics.h
│       │   ├── nth_element.h
│       │   ├── optional.h
│       │   ├── output_utils.h
│       │   ├── ports.h
│       │   ├── preloadable.h
│       │   ├── priority_queue.h
│       │   ├── process_utils.h
│       │   ├── rand.h
│       │   ├── safe_strerror_posix.h
│       │   ├── singleton.h
│       │   ├── singleton_store.h
│       │   ├── smart_pointers.h
│       │   ├── string_conv.h
│       │   ├── string_splitter.h
│       │   ├── string_view.h
│       │   ├── strings.h
│       │   ├── synchronize.h
│       │   ├── sys_exit_hook.h
│       │   ├── timer.h
│       │   ├── utils.h
│       │   └── work_queue.h
│       └── utils/
│           ├── latency_tracer.h
│           ├── time_utils.h
│           ├── token_bucket_throttling_controller.h
│           └── token_buckets.h
├── run.sh
├── scripts/
│   └── linux/
│       ├── build.sh
│       ├── clear_zk.sh
│       ├── install.sh
│       ├── learn_stat.py
│       ├── run-clang-format.py
│       ├── run-clang-format.sh
│       ├── start_zk.sh
│       └── stop_zk.sh
├── src/
│   ├── CMakeLists.txt
│   ├── aio/
│   │   ├── CMakeLists.txt
│   │   ├── aio_provider.cpp
│   │   ├── aio_provider.h
│   │   ├── aio_task.cpp
│   │   ├── disk_engine.cpp
│   │   ├── disk_engine.h
│   │   ├── file_io.cpp
│   │   ├── native_linux_aio_provider.cpp
│   │   ├── native_linux_aio_provider.h
│   │   └── test/
│   │       ├── CMakeLists.txt
│   │       ├── aio.cpp
│   │       ├── clear.sh
│   │       ├── config.ini
│   │       ├── copy_source.txt
│   │       ├── main.cpp
│   │       └── run.sh
│   ├── block_service/
│   │   ├── CMakeLists.txt
│   │   ├── block_service_manager.cpp
│   │   ├── block_service_manager.h
│   │   ├── directio_writable_file.cpp
│   │   ├── directio_writable_file.h
│   │   ├── fds/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── fds_service.cpp
│   │   │   └── fds_service.h
│   │   ├── hdfs/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── hdfs_service.cpp
│   │   │   └── hdfs_service.h
│   │   ├── local/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── local_service.cpp
│   │   │   └── local_service.h
│   │   └── test/
│   │       ├── CMakeLists.txt
│   │       ├── block_service_manager_test.cpp
│   │       ├── block_service_mock.h
│   │       ├── clear.sh
│   │       ├── config-test.ini
│   │       ├── fds_service_test.cpp
│   │       ├── hdfs_service_test.cpp
│   │       ├── local_service_test.cpp
│   │       ├── main.cpp
│   │       └── run.sh
│   ├── client/
│   │   ├── CMakeLists.txt
│   │   ├── partition_resolver.cpp
│   │   ├── partition_resolver_manager.cpp
│   │   ├── partition_resolver_manager.h
│   │   ├── partition_resolver_simple.cpp
│   │   ├── partition_resolver_simple.h
│   │   └── replication_ddl_client.cpp
│   ├── common/
│   │   ├── CMakeLists.txt
│   │   ├── backup.thrift
│   │   ├── backup_common.cpp
│   │   ├── backup_common.h
│   │   ├── bulk_load.thrift
│   │   ├── bulk_load_common.cpp
│   │   ├── bulk_load_common.h
│   │   ├── common.cpp
│   │   ├── consensus.thrift
│   │   ├── duplication.thrift
│   │   ├── duplication_common.cpp
│   │   ├── fs_manager.cpp
│   │   ├── fs_manager.h
│   │   ├── manual_compact.h
│   │   ├── meta_admin.thrift
│   │   ├── metadata.thrift
│   │   ├── partition_split.thrift
│   │   ├── partition_split_common.h
│   │   ├── replica_admin.thrift
│   │   ├── replication_common.cpp
│   │   ├── replication_common.h
│   │   └── test/
│   │       ├── CMakeLists.txt
│   │       ├── common_test.cpp
│   │       ├── config-test.ini
│   │       ├── duplication_common_test.cpp
│   │       ├── fs_manager_test.cpp
│   │       ├── main.cpp
│   │       ├── replication_common_test.cpp
│   │       └── run.sh
│   ├── dsn.layer2.thrift
│   ├── dsn.thrift
│   ├── failure_detector/
│   │   ├── CMakeLists.txt
│   │   ├── failure_detector.cpp
│   │   ├── failure_detector_multimaster.cpp
│   │   ├── fd.thrift
│   │   └── test/
│   │       ├── CMakeLists.txt
│   │       ├── clear.sh
│   │       ├── config-test.ini
│   │       ├── config-whitelist-test-failed.ini
│   │       ├── config-whitelist-test.ini
│   │       ├── failure_detector.cpp
│   │       ├── gtest.filter
│   │       ├── main.cpp
│   │       └── run.sh
│   ├── http/
│   │   ├── CMakeLists.txt
│   │   ├── builtin_http_calls.cpp
│   │   ├── builtin_http_calls.h
│   │   ├── config_http_service.cpp
│   │   ├── http_call_registry.h
│   │   ├── http_message_parser.cpp
│   │   ├── http_message_parser.h
│   │   ├── http_server.cpp
│   │   ├── http_server_impl.h
│   │   ├── perf_counter_http_service.cpp
│   │   ├── pprof_http_service.cpp
│   │   ├── pprof_http_service.h
│   │   ├── service_version.cpp
│   │   ├── service_version.h
│   │   ├── test/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── http_server_test.cpp
│   │   │   ├── perf_counter_http_service_test.cpp
│   │   │   ├── run.sh
│   │   │   └── uri_decoder_test.cpp
│   │   ├── uri_decoder.cpp
│   │   └── uri_decoder.h
│   ├── meta/
│   │   ├── CMakeLists.txt
│   │   ├── app_balance_policy.cpp
│   │   ├── app_balance_policy.h
│   │   ├── app_env_validator.cpp
│   │   ├── app_env_validator.h
│   │   ├── backup_engine.cpp
│   │   ├── backup_engine.h
│   │   ├── cluster_balance_policy.cpp
│   │   ├── cluster_balance_policy.h
│   │   ├── distributed_lock_service_simple.cpp
│   │   ├── distributed_lock_service_simple.h
│   │   ├── dump_file.h
│   │   ├── duplication/
│   │   │   ├── duplication_info.cpp
│   │   │   ├── duplication_info.h
│   │   │   ├── meta_duplication_service.cpp
│   │   │   └── meta_duplication_service.h
│   │   ├── greedy_load_balancer.cpp
│   │   ├── greedy_load_balancer.h
│   │   ├── load_balance_policy.cpp
│   │   ├── load_balance_policy.h
│   │   ├── meta_backup_service.cpp
│   │   ├── meta_backup_service.h
│   │   ├── meta_bulk_load_ingestion_context.cpp
│   │   ├── meta_bulk_load_ingestion_context.h
│   │   ├── meta_bulk_load_service.cpp
│   │   ├── meta_bulk_load_service.h
│   │   ├── meta_data.cpp
│   │   ├── meta_data.h
│   │   ├── meta_http_service.cpp
│   │   ├── meta_http_service.h
│   │   ├── meta_options.cpp
│   │   ├── meta_options.h
│   │   ├── meta_rpc_types.h
│   │   ├── meta_server_failure_detector.cpp
│   │   ├── meta_server_failure_detector.h
│   │   ├── meta_service.cpp
│   │   ├── meta_service.h
│   │   ├── meta_service_app.cpp
│   │   ├── meta_split_service.cpp
│   │   ├── meta_split_service.h
│   │   ├── meta_state_service_simple.cpp
│   │   ├── meta_state_service_simple.h
│   │   ├── meta_state_service_utils.cpp
│   │   ├── meta_state_service_utils.h
│   │   ├── meta_state_service_utils_impl.h
│   │   ├── meta_state_service_zookeeper.cpp
│   │   ├── meta_state_service_zookeeper.h
│   │   ├── partition_guardian.cpp
│   │   ├── partition_guardian.h
│   │   ├── server_load_balancer.cpp
│   │   ├── server_load_balancer.h
│   │   ├── server_state.cpp
│   │   ├── server_state.h
│   │   ├── server_state_restore.cpp
│   │   └── test/
│   │       ├── CMakeLists.txt
│   │       ├── backup_test.cpp
│   │       ├── balancer_simulator/
│   │       │   ├── CMakeLists.txt
│   │       │   └── balancer_simulator.cpp
│   │       ├── balancer_validator.cpp
│   │       ├── clear.sh
│   │       ├── cluster_balance_policy_test.cpp
│   │       ├── config-test.ini
│   │       ├── copy_replica_operation_test.cpp
│   │       ├── dummy_balancer.h
│   │       ├── dump_file.cpp
│   │       ├── duplication_info_test.cpp
│   │       ├── ford_fulkerson_test.cpp
│   │       ├── json_compacity.cpp
│   │       ├── main.cpp
│   │       ├── meta_app_envs_test.cpp
│   │       ├── meta_app_operation_test.cpp
│   │       ├── meta_backup_test.cpp
│   │       ├── meta_bulk_load_ingestion_test.cpp
│   │       ├── meta_bulk_load_service_test.cpp
│   │       ├── meta_data.cpp
│   │       ├── meta_duplication_service_test.cpp
│   │       ├── meta_http_service_test.cpp
│   │       ├── meta_mauanl_compaction_test.cpp
│   │       ├── meta_partition_guardian_test.cpp
│   │       ├── meta_service_test.cpp
│   │       ├── meta_service_test_app.h
│   │       ├── meta_split_service_test.cpp
│   │       ├── meta_state/
│   │       │   ├── CMakeLists.txt
│   │       │   ├── clear.cmd
│   │       │   ├── clear.sh
│   │       │   ├── config-test.ini
│   │       │   ├── gtest.filter
│   │       │   ├── main.cpp
│   │       │   ├── meta_state_service.cpp
│   │       │   └── run.sh
│   │       ├── meta_state_service_utils_test.cpp
│   │       ├── meta_test_base.cpp
│   │       ├── meta_test_base.h
│   │       ├── misc/
│   │       │   ├── misc.cpp
│   │       │   └── misc.h
│   │       ├── run.sh
│   │       ├── server_state_restore_test.cpp
│   │       ├── server_state_test.cpp
│   │       ├── state_sync_test.cpp
│   │       ├── suite1
│   │       ├── suite2
│   │       └── update_configuration_test.cpp
│   ├── nfs/
│   │   ├── CMakeLists.txt
│   │   ├── nfs.thrift
│   │   ├── nfs_client_impl.cpp
│   │   ├── nfs_client_impl.h
│   │   ├── nfs_code_definition.h
│   │   ├── nfs_node.cpp
│   │   ├── nfs_node_impl.cpp
│   │   ├── nfs_node_simple.h
│   │   ├── nfs_server_impl.cpp
│   │   ├── nfs_server_impl.h
│   │   └── test/
│   │       ├── CMakeLists.txt
│   │       ├── clear.sh
│   │       ├── config.ini
│   │       ├── main.cpp
│   │       ├── nfs_test_file1
│   │       ├── nfs_test_file2
│   │       └── run.sh
│   ├── perf_counter/
│   │   ├── CMakeLists.txt
│   │   ├── builtin_counters.cpp
│   │   ├── builtin_counters.h
│   │   ├── perf_counter.cpp
│   │   ├── perf_counter_atomic.h
│   │   ├── perf_counters.cpp
│   │   └── test/
│   │       ├── CMakeLists.txt
│   │       ├── clear.sh
│   │       ├── main.cpp
│   │       ├── perf_counter_test.cpp
│   │       ├── perf_counters_test.cpp
│   │       └── run.sh
│   ├── remote_cmd/
│   │   ├── CMakeLists.txt
│   │   ├── command.thrift
│   │   └── remote_command.cpp
│   ├── replica/
│   │   ├── CMakeLists.txt
│   │   ├── backup/
│   │   │   ├── cold_backup_context.cpp
│   │   │   ├── cold_backup_context.h
│   │   │   ├── replica_backup_manager.cpp
│   │   │   ├── replica_backup_manager.h
│   │   │   ├── replica_backup_server.cpp
│   │   │   ├── replica_backup_server.h
│   │   │   └── test/
│   │   │       ├── CMakeLists.txt
│   │   │       ├── config-test.ini
│   │   │       ├── main.cpp
│   │   │       ├── replica_backup_manager_test.cpp
│   │   │       └── run.sh
│   │   ├── bulk_load/
│   │   │   ├── replica_bulk_loader.cpp
│   │   │   ├── replica_bulk_loader.h
│   │   │   └── test/
│   │   │       ├── CMakeLists.txt
│   │   │       ├── config-test.ini
│   │   │       ├── main.cpp
│   │   │       ├── replica_bulk_loader_test.cpp
│   │   │       └── run.sh
│   │   ├── disk_cleaner.cpp
│   │   ├── disk_cleaner.h
│   │   ├── duplication/
│   │   │   ├── duplication_pipeline.cpp
│   │   │   ├── duplication_pipeline.h
│   │   │   ├── duplication_sync_timer.cpp
│   │   │   ├── duplication_sync_timer.h
│   │   │   ├── load_from_private_log.cpp
│   │   │   ├── load_from_private_log.h
│   │   │   ├── mutation_batch.cpp
│   │   │   ├── mutation_batch.h
│   │   │   ├── replica_duplicator.cpp
│   │   │   ├── replica_duplicator.h
│   │   │   ├── replica_duplicator_manager.cpp
│   │   │   ├── replica_duplicator_manager.h
│   │   │   ├── replica_follower.cpp
│   │   │   ├── replica_follower.h
│   │   │   └── test/
│   │   │       ├── CMakeLists.txt
│   │   │       ├── config-test.ini
│   │   │       ├── duplication_sync_timer_test.cpp
│   │   │       ├── duplication_test_base.h
│   │   │       ├── load_from_private_log_test.cpp
│   │   │       ├── log.1.0.all_loaded_are_write_empties
│   │   │       ├── log.1.0.handle_real_private_log
│   │   │       ├── log.1.0.handle_real_private_log2
│   │   │       ├── main.cpp
│   │   │       ├── mutation_batch_test.cpp
│   │   │       ├── replica_duplicator_manager_test.cpp
│   │   │       ├── replica_duplicator_test.cpp
│   │   │       ├── replica_follower_test.cpp
│   │   │       ├── replica_http_service_test.cpp
│   │   │       ├── run.sh
│   │   │       └── ship_mutation_test.cpp
│   │   ├── log_block.cpp
│   │   ├── log_block.h
│   │   ├── log_file.cpp
│   │   ├── log_file.h
│   │   ├── log_file_stream.h
│   │   ├── mutation.cpp
│   │   ├── mutation.h
│   │   ├── mutation_cache.cpp
│   │   ├── mutation_cache.h
│   │   ├── mutation_log.cpp
│   │   ├── mutation_log.h
│   │   ├── mutation_log_replay.cpp
│   │   ├── mutation_log_utils.cpp
│   │   ├── mutation_log_utils.h
│   │   ├── prepare_list.cpp
│   │   ├── prepare_list.h
│   │   ├── replica.cpp
│   │   ├── replica.h
│   │   ├── replica_2pc.cpp
│   │   ├── replica_backup.cpp
│   │   ├── replica_check.cpp
│   │   ├── replica_chkpt.cpp
│   │   ├── replica_config.cpp
│   │   ├── replica_context.cpp
│   │   ├── replica_context.h
│   │   ├── replica_disk_migrator.cpp
│   │   ├── replica_disk_migrator.h
│   │   ├── replica_failover.cpp
│   │   ├── replica_http_service.cpp
│   │   ├── replica_http_service.h
│   │   ├── replica_init.cpp
│   │   ├── replica_learn.cpp
│   │   ├── replica_restore.cpp
│   │   ├── replica_stub.cpp
│   │   ├── replica_stub.h
│   │   ├── replica_test_utils.cpp
│   │   ├── replica_throttle.cpp
│   │   ├── replication_app_base.cpp
│   │   ├── replication_service_app.cpp
│   │   ├── split/
│   │   │   ├── replica_split_manager.cpp
│   │   │   ├── replica_split_manager.h
│   │   │   └── test/
│   │   │       ├── CMakeLists.txt
│   │   │       ├── config-test.ini
│   │   │       ├── main.cpp
│   │   │       ├── replica_split_test.cpp
│   │   │       └── run.sh
│   │   ├── storage/
│   │   │   ├── CMakeLists.txt
│   │   │   └── simple_kv/
│   │   │       ├── CMakeLists.txt
│   │   │       ├── clear.sh
│   │   │       ├── config.ini
│   │   │       ├── run.sh
│   │   │       ├── simple_kv.app.example.h
│   │   │       ├── simple_kv.client.h
│   │   │       ├── simple_kv.code.definition.h
│   │   │       ├── simple_kv.main.cpp
│   │   │       ├── simple_kv.server.h
│   │   │       ├── simple_kv.server.impl.cpp
│   │   │       ├── simple_kv.server.impl.h
│   │   │       ├── simple_kv.thrift
│   │   │       └── test/
│   │   │           ├── CMakeLists.txt
│   │   │           ├── README.md
│   │   │           ├── addcase.sh
│   │   │           ├── case-000.act
│   │   │           ├── case-000.ini
│   │   │           ├── case-001.act
│   │   │           ├── case-001.ini
│   │   │           ├── case-002.act
│   │   │           ├── case-002.ini
│   │   │           ├── case-003.act
│   │   │           ├── case-003.ini
│   │   │           ├── case-004.act
│   │   │           ├── case-004.ini
│   │   │           ├── case-005.act
│   │   │           ├── case-005.ini
│   │   │           ├── case-006.act
│   │   │           ├── case-006.ini
│   │   │           ├── case-100.act
│   │   │           ├── case-100.ini
│   │   │           ├── case-101.act
│   │   │           ├── case-101.ini
│   │   │           ├── case-102.act
│   │   │           ├── case-102.ini
│   │   │           ├── case-103.act
│   │   │           ├── case-103.ini
│   │   │           ├── case-104.act
│   │   │           ├── case-104.ini
│   │   │           ├── case-105.act
│   │   │           ├── case-105.ini
│   │   │           ├── case-106.act
│   │   │           ├── case-106.ini
│   │   │           ├── case-107.act
│   │   │           ├── case-107.ini
│   │   │           ├── case-108.act
│   │   │           ├── case-108.ini
│   │   │           ├── case-109.act
│   │   │           ├── case-109.ini
│   │   │           ├── case-200.act
│   │   │           ├── case-200.ini
│   │   │           ├── case-201.act
│   │   │           ├── case-201.ini
│   │   │           ├── case-202-0.act
│   │   │           ├── case-202-0.ini
│   │   │           ├── case-202-1.act
│   │   │           ├── case-202-1.ini
│   │   │           ├── case-203-0.act
│   │   │           ├── case-203-0.ini
│   │   │           ├── case-204.act
│   │   │           ├── case-204.ini
│   │   │           ├── case-205.act
│   │   │           ├── case-205.ini
│   │   │           ├── case-206.act
│   │   │           ├── case-206.ini
│   │   │           ├── case-207.act
│   │   │           ├── case-207.ini
│   │   │           ├── case-208.act
│   │   │           ├── case-208.ini
│   │   │           ├── case-209.act
│   │   │           ├── case-209.ini
│   │   │           ├── case-210.act
│   │   │           ├── case-210.ini
│   │   │           ├── case-211.act
│   │   │           ├── case-211.ini
│   │   │           ├── case-212.act
│   │   │           ├── case-212.ini
│   │   │           ├── case-213.act
│   │   │           ├── case-213.ini
│   │   │           ├── case-214.act
│   │   │           ├── case-214.ini
│   │   │           ├── case-215.act
│   │   │           ├── case-215.ini
│   │   │           ├── case-216.act
│   │   │           ├── case-216.ini
│   │   │           ├── case-300-0.act
│   │   │           ├── case-300-0.ini
│   │   │           ├── case-300-1.act
│   │   │           ├── case-300-1.ini
│   │   │           ├── case-300-2.act
│   │   │           ├── case-300-2.ini
│   │   │           ├── case-301.act
│   │   │           ├── case-301.ini
│   │   │           ├── case-302.act
│   │   │           ├── case-302.ini
│   │   │           ├── case-303.act
│   │   │           ├── case-303.ini
│   │   │           ├── case-304.act
│   │   │           ├── case-304.ini
│   │   │           ├── case-305.act
│   │   │           ├── case-305.ini
│   │   │           ├── case-306.act
│   │   │           ├── case-306.ini
│   │   │           ├── case-307.act
│   │   │           ├── case-307.ini
│   │   │           ├── case-400.act
│   │   │           ├── case-400.ini
│   │   │           ├── case-401.act
│   │   │           ├── case-401.ini
│   │   │           ├── case-402.act
│   │   │           ├── case-402.ini
│   │   │           ├── case-600.act
│   │   │           ├── case-600.ini
│   │   │           ├── case-601.act
│   │   │           ├── case-601.ini
│   │   │           ├── case-602.act
│   │   │           ├── case-602.ini
│   │   │           ├── case-603.act
│   │   │           ├── case-603.ini
│   │   │           ├── case.cpp
│   │   │           ├── case.h
│   │   │           ├── checker.cpp
│   │   │           ├── checker.h
│   │   │           ├── clear.sh
│   │   │           ├── client.cpp
│   │   │           ├── client.h
│   │   │           ├── common.cpp
│   │   │           ├── common.h
│   │   │           ├── config.ini
│   │   │           ├── injector.cpp
│   │   │           ├── injector.h
│   │   │           ├── run.sh
│   │   │           ├── simple_kv.main.cpp
│   │   │           ├── simple_kv.server.impl.cpp
│   │   │           └── simple_kv.server.impl.h
│   │   └── test/
│   │       ├── CMakeLists.txt
│   │       ├── backup_block_service_mock.h
│   │       ├── clear.sh
│   │       ├── cold_backup_context_test.cpp
│   │       ├── config-test.ini
│   │       ├── log_block_test.cpp
│   │       ├── log_file_test.cpp
│   │       ├── main.cpp
│   │       ├── mock_utils.h
│   │       ├── mutation_log_learn_test.cpp
│   │       ├── mutation_log_test.cpp
│   │       ├── open_replica_test.cpp
│   │       ├── replica_disk_migrate_test.cpp
│   │       ├── replica_disk_test.cpp
│   │       ├── replica_disk_test_base.h
│   │       ├── replica_learn_test.cpp
│   │       ├── replica_test.cpp
│   │       ├── replica_test_base.h
│   │       ├── replication_service_test_app.h
│   │       ├── run.sh
│   │       └── throttling_controller_test.cpp
│   ├── runtime/
│   │   ├── CMakeLists.txt
│   │   ├── build_config.h
│   │   ├── core_main.cpp
│   │   ├── dsn.layer2_types.cpp
│   │   ├── env.sim.cpp
│   │   ├── env.sim.h
│   │   ├── fault_injector.cpp
│   │   ├── global_config.cpp
│   │   ├── message_utils.cpp
│   │   ├── nativerun.cpp
│   │   ├── profiler.cpp
│   │   ├── profiler_header.h
│   │   ├── providers.common.cpp
│   │   ├── rpc/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── asio_net_provider.cpp
│   │   │   ├── asio_net_provider.h
│   │   │   ├── asio_rpc_session.cpp
│   │   │   ├── asio_rpc_session.h
│   │   │   ├── dsn_message_parser.cpp
│   │   │   ├── dsn_message_parser.h
│   │   │   ├── message_parser.cpp
│   │   │   ├── message_parser_manager.h
│   │   │   ├── network.cpp
│   │   │   ├── network.sim.cpp
│   │   │   ├── network.sim.h
│   │   │   ├── raw_message_parser.cpp
│   │   │   ├── raw_message_parser.h
│   │   │   ├── request_meta.thrift
│   │   │   ├── rpc_engine.cpp
│   │   │   ├── rpc_engine.h
│   │   │   ├── rpc_message.cpp
│   │   │   ├── rpc_task.cpp
│   │   │   ├── thrift_message_parser.cpp
│   │   │   └── thrift_message_parser.h
│   │   ├── scheduler.cpp
│   │   ├── scheduler.h
│   │   ├── security/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── access_controller.cpp
│   │   │   ├── access_controller.h
│   │   │   ├── client_negotiation.cpp
│   │   │   ├── client_negotiation.h
│   │   │   ├── init.cpp
│   │   │   ├── init.h
│   │   │   ├── kinit_context.cpp
│   │   │   ├── kinit_context.h
│   │   │   ├── meta_access_controller.cpp
│   │   │   ├── meta_access_controller.h
│   │   │   ├── negotiation.cpp
│   │   │   ├── negotiation.h
│   │   │   ├── negotiation_manager.cpp
│   │   │   ├── negotiation_manager.h
│   │   │   ├── negotiation_utils.h
│   │   │   ├── replica_access_controller.cpp
│   │   │   ├── replica_access_controller.h
│   │   │   ├── sasl_client_wrapper.cpp
│   │   │   ├── sasl_client_wrapper.h
│   │   │   ├── sasl_init.cpp
│   │   │   ├── sasl_init.h
│   │   │   ├── sasl_server_wrapper.cpp
│   │   │   ├── sasl_server_wrapper.h
│   │   │   ├── sasl_wrapper.cpp
│   │   │   ├── sasl_wrapper.h
│   │   │   ├── security.thrift
│   │   │   ├── server_negotiation.cpp
│   │   │   └── server_negotiation.h
│   │   ├── service_api_c.cpp
│   │   ├── service_engine.cpp
│   │   ├── service_engine.h
│   │   ├── sim_clock.h
│   │   ├── simulator.cpp
│   │   ├── task/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── hpc_task_queue.cpp
│   │   │   ├── hpc_task_queue.h
│   │   │   ├── simple_task_queue.cpp
│   │   │   ├── simple_task_queue.h
│   │   │   ├── task.cpp
│   │   │   ├── task_code.cpp
│   │   │   ├── task_engine.cpp
│   │   │   ├── task_engine.h
│   │   │   ├── task_engine.sim.cpp
│   │   │   ├── task_engine.sim.h
│   │   │   ├── task_queue.cpp
│   │   │   ├── task_spec.cpp
│   │   │   ├── task_tracker.cpp
│   │   │   └── task_worker.cpp
│   │   ├── test/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── async_call.cpp
│   │   │   ├── clear.sh
│   │   │   ├── client_negotiation_test.cpp
│   │   │   ├── command.txt
│   │   │   ├── config-test-corrupt-message.ini
│   │   │   ├── config-test-sim.ini
│   │   │   ├── config-test.ini
│   │   │   ├── corrupt_message.cpp
│   │   │   ├── gtest.filter
│   │   │   ├── lpc.cpp
│   │   │   ├── main.cpp
│   │   │   ├── message_reader_test.cpp
│   │   │   ├── message_utils_test.cpp
│   │   │   ├── meta_access_controller_test.cpp
│   │   │   ├── negotiation_manager_test.cpp
│   │   │   ├── netprovider.cpp
│   │   │   ├── pipeline_test.cpp
│   │   │   ├── replica_access_controller_test.cpp
│   │   │   ├── rpc.cpp
│   │   │   ├── rpc_holder_test.cpp
│   │   │   ├── rpc_message.cpp
│   │   │   ├── run.sh
│   │   │   ├── server_negotiation_test.cpp
│   │   │   ├── service_api_c.cpp
│   │   │   ├── sim_lock.cpp
│   │   │   ├── task_engine.cpp
│   │   │   ├── task_test.cpp
│   │   │   ├── test_utils.h
│   │   │   └── thrift_message_parser_test.cpp
│   │   ├── threadpool_code.cpp
│   │   ├── tool_api.cpp
│   │   ├── tracer.cpp
│   │   └── zlocks.cpp
│   ├── tools/
│   │   ├── CMakeLists.txt
│   │   └── mutation_log_tool.cpp
│   ├── utils/
│   │   ├── CMakeLists.txt
│   │   ├── alloc.cpp
│   │   ├── binary_reader.cpp
│   │   ├── binary_writer.cpp
│   │   ├── clock.cpp
│   │   ├── command_manager.cpp
│   │   ├── config_api.cpp
│   │   ├── configuration.cpp
│   │   ├── coredump.h
│   │   ├── coredump.posix.cpp
│   │   ├── crc.cpp
│   │   ├── error_code.cpp
│   │   ├── fail_point.cpp
│   │   ├── fail_point_impl.h
│   │   ├── filesystem.cpp
│   │   ├── flags.cpp
│   │   ├── gpid.cpp
│   │   ├── latency_tracer.cpp
│   │   ├── lockp.std.h
│   │   ├── logging.cpp
│   │   ├── long_adder.cpp
│   │   ├── long_adder_bench/
│   │   │   ├── CMakeLists.txt
│   │   │   └── long_adder_bench.cpp
│   │   ├── math.cpp
│   │   ├── memutil.h
│   │   ├── metrics.cpp
│   │   ├── output_utils.cpp
│   │   ├── process_utils.cpp
│   │   ├── rand.cpp
│   │   ├── rpc_address.cpp
│   │   ├── safe_strerror_posix.cpp
│   │   ├── shared_io_service.cpp
│   │   ├── shared_io_service.h
│   │   ├── simple_logger.cpp
│   │   ├── simple_logger.h
│   │   ├── string_view.cpp
│   │   ├── strings.cpp
│   │   ├── test/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── TokenBucketTest.cpp
│   │   │   ├── TokenBucketTest.h
│   │   │   ├── address.cpp
│   │   │   ├── autoref_ptr_test.cpp
│   │   │   ├── binary_reader_test.cpp
│   │   │   ├── clear.sh
│   │   │   ├── command_manager.cpp
│   │   │   ├── config-bad-section.ini
│   │   │   ├── config-dup-key.ini
│   │   │   ├── config-dup-section.ini
│   │   │   ├── config-empty.ini
│   │   │   ├── config-no-key.ini
│   │   │   ├── config-no-section.ini
│   │   │   ├── config-null-section.ini
│   │   │   ├── config-sample.ini
│   │   │   ├── config-unmatch-section.ini
│   │   │   ├── configuration.cpp
│   │   │   ├── endian_test.cpp
│   │   │   ├── env.cpp
│   │   │   ├── fail_point_test.cpp
│   │   │   ├── file_system_test.cpp
│   │   │   ├── file_utils.cpp
│   │   │   ├── flag_test.cpp
│   │   │   ├── fmt_logging_test.cpp
│   │   │   ├── hostname_test.cpp
│   │   │   ├── join_point_test.cpp
│   │   │   ├── json_helper_test.cpp
│   │   │   ├── latency_tracer_test.cpp
│   │   │   ├── lock.std.cpp
│   │   │   ├── logger.cpp
│   │   │   ├── logging.cpp
│   │   │   ├── long_adder_test.cpp
│   │   │   ├── main.cpp
│   │   │   ├── memutil_test.cpp
│   │   │   ├── metrics_test.cpp
│   │   │   ├── nth_element_bench/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── nth_element_bench.cpp
│   │   │   ├── nth_element_test.cpp
│   │   │   ├── nth_element_utils.h
│   │   │   ├── output_utils_test.cpp
│   │   │   ├── percentile_utils.h
│   │   │   ├── priority_queue.cpp
│   │   │   ├── rand_test.cpp
│   │   │   ├── run.sh
│   │   │   ├── sema.cpp
│   │   │   ├── smart_pointers_test.cpp
│   │   │   ├── string_conv_test.cpp
│   │   │   ├── string_view_test.cpp
│   │   │   ├── time_utils_test.cpp
│   │   │   ├── token_bucket_throttling_controller_test.cpp
│   │   │   ├── token_buckets_test.cpp
│   │   │   └── utils.cpp
│   │   ├── thread_access_checker.cpp
│   │   ├── throttling_controller.cpp
│   │   ├── throttling_controller.h
│   │   ├── time_utils.cpp
│   │   ├── token_bucket_throttling_controller.cpp
│   │   ├── token_buckets.cpp
│   │   ├── utils.cpp
│   │   └── zlock_provider.h
│   └── zookeeper/
│       ├── CMakeLists.txt
│       ├── distributed_lock_service_zookeeper.cpp
│       ├── distributed_lock_service_zookeeper.h
│       ├── lock_struct.cpp
│       ├── lock_struct.h
│       ├── lock_types.h
│       ├── test/
│       │   ├── CMakeLists.txt
│       │   ├── clear.sh
│       │   ├── config-test.ini
│       │   ├── distributed_lock_zookeeper.cpp
│       │   ├── main.cpp
│       │   └── run.sh
│       ├── zookeeper_error.cpp
│       ├── zookeeper_error.h
│       ├── zookeeper_session.cpp
│       ├── zookeeper_session.h
│       ├── zookeeper_session_mgr.cpp
│       └── zookeeper_session_mgr.h
└── thirdparty/
    ├── CMakeLists.txt
    ├── fix_fds_for_macos.patch
    ├── fix_s2_for_aarch64.patch
    └── fix_thrift_for_cpp11.patch
Download .txt
Showing preview only (307K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3337 symbols across 636 files)

FILE: compile_thrift.py
  class CompileError (line 58) | class CompileError(Exception):
    method __init__ (line 61) | def __init__(self, msg):
    method __str__ (line 64) | def __str__(self):
  function fix_include_file (line 68) | def fix_include_file(filename, fix_commands):
  function fix_include (line 100) | def fix_include(thrift_name, include_fix_dict):
  function compile_thrift_file (line 111) | def compile_thrift_file(thrift_info):
  function constructor_hook (line 164) | def constructor_hook(args):
  function replace_hook (line 193) | def replace_hook(args):
  function add_hook (line 212) | def add_hook(name, path, func, args):

FILE: include/dsn/c/api_layer1.h
  function dsn_now_us (line 266) | __inline uint64_t dsn_now_us() { return dsn_now_ns() / 1000; }
  function dsn_now_ms (line 267) | __inline uint64_t dsn_now_ms() { return dsn_now_ns() / 1000000; }
  function dsn_now_s (line 268) | __inline uint64_t dsn_now_s() { return dsn_now_ns() / 1000000000; }

FILE: include/dsn/c/api_task.h
  function namespace (line 48) | namespace dsn {

FILE: include/dsn/c/api_utilities.h
  type dsn_log_level_t (line 53) | typedef enum dsn_log_level_t {

FILE: include/dsn/cpp/json_helper.h
  function namespace (line 226) | namespace dsn {
  type has_json_state (line 547) | typedef decltype(check_json_state<T>(0)) has_json_state;
  type p_has_json_state (line 548) | typedef decltype(p_check_json_state<T>(0)) p_has_json_state;
  function encode_inner (line 551) | static void encode_inner(JsonWriter &out, const T &t, std::true_type, st...
  function encode_inner (line 555) | static void encode_inner(JsonWriter &out, const T &t, std::false_type, s...
  function encode_inner (line 559) | static void encode_inner(JsonWriter &out, const T &t, std::true_type, st...
  function encode_inner (line 563) | static void encode_inner(JsonWriter &out, const T &t, std::false_type, s...
  function decode_inner (line 569) | static bool decode_inner(const JsonObject &in, T &t, std::true_type, std...
  function decode_inner (line 573) | static bool decode_inner(const JsonObject &in, T &t, std::false_type, st...
  function decode_inner (line 577) | static bool decode_inner(const JsonObject &in, T &t, std::true_type, std...
  function decode_inner (line 581) | static bool decode_inner(const JsonObject &in, T &t, std::false_type, st...
  function encode (line 591) | static void encode(std::ostream &os, const T &t)
  function dsn (line 597) | static dsn::blob encode(const T &t)
  function decode (line 604) | static bool decode(const JsonObject &in, T &t)
  function decode (line 608) | static bool decode(const dsn::blob &bb, T &t)
  function decode (line 616) | static bool decode(const JsonObject &in, const T &t)
  function decode (line 621) | static bool decode(const dsn::blob &bb, const T &t)

FILE: include/dsn/cpp/message_utils.h
  function namespace (line 28) | namespace dsn {

FILE: include/dsn/cpp/pipeline.h
  function namespace (line 28) | namespace dsn {

FILE: include/dsn/cpp/rpc_holder.h
  function namespace (line 30) | namespace dsn {
  function namespace (line 342) | namespace rpc {

FILE: include/dsn/cpp/rpc_stream.h
  function namespace (line 37) | namespace dsn {
  type dsn (line 130) | typedef ::dsn::ref_ptr<rpc_write_stream> rpc_write_stream_ptr;

FILE: include/dsn/cpp/serialization.h
  function namespace (line 34) | namespace dsn {

FILE: include/dsn/cpp/serialization_helper/dsn.layer2_types.h
  function namespace (line 46) | namespace dsn {

FILE: include/dsn/cpp/serialization_helper/thrift_helper.h
  function namespace (line 51) | namespace dsn {

FILE: include/dsn/cpp/serverlet.h
  function namespace (line 32) | namespace dsn {
  function _name (line 151) | _name(nm)

FILE: include/dsn/cpp/service_app.h
  function namespace (line 46) | namespace dsn {

FILE: include/dsn/dist/block_service.h
  function namespace (line 27) | namespace dsn {

FILE: include/dsn/dist/common.h
  function namespace (line 22) | namespace dsn {

FILE: include/dsn/dist/distributed_lock_service.h
  function namespace (line 51) | namespace dsn {

FILE: include/dsn/dist/failure_detector/failure_detector.h
  function namespace (line 69) | namespace dsn {

FILE: include/dsn/dist/failure_detector/fd.client.h
  function namespace (line 42) | namespace dsn {

FILE: include/dsn/dist/failure_detector/fd.code.definition.h
  function namespace (line 42) | namespace dsn {

FILE: include/dsn/dist/failure_detector/fd.server.h
  function namespace (line 40) | namespace dsn {

FILE: include/dsn/dist/failure_detector_multimaster.h
  function namespace (line 43) | namespace dsn {

FILE: include/dsn/dist/meta_state_service.h
  function namespace (line 52) | namespace dsn {

FILE: include/dsn/dist/nfs_node.h
  function namespace (line 36) | namespace dsn {

FILE: include/dsn/dist/remote_command.h
  function namespace (line 23) | namespace dsn {

FILE: include/dsn/dist/replication/duplication_common.h
  function namespace (line 27) | namespace dsn {

FILE: include/dsn/dist/replication/meta_service_app.h
  function namespace (line 30) | namespace dsn {
  function namespace (line 42) | namespace dsn {

FILE: include/dsn/dist/replication/mutation_duplicator.h
  function namespace (line 25) | namespace dsn {
  type std (line 47) | typedef std::set<mutation_tuple, mutation_tuple_cmp> mutation_tuple_set;
  function class (line 52) | class mutation_duplicator : public replica_base
  function std (line 80) | inline std::unique_ptr<mutation_duplicator>

FILE: include/dsn/dist/replication/mutation_log_tool.h
  function namespace (line 43) | namespace dsn {

FILE: include/dsn/dist/replication/partition_resolver.h
  function namespace (line 36) | namespace dsn {
  type ref_ptr (line 136) | typedef ref_ptr<partition_resolver> partition_resolver_ptr;

FILE: include/dsn/dist/replication/replica_base.h
  function namespace (line 32) | namespace dsn {

FILE: include/dsn/dist/replication/replica_envs.h
  function namespace (line 32) | namespace dsn {

FILE: include/dsn/dist/replication/replica_test_utils.h
  function namespace (line 32) | namespace dsn {

FILE: include/dsn/dist/replication/replication.codes.h
  function DEFINE_THREAD_POOL_CODE (line 31) | DEFINE_THREAD_POOL_CODE(THREAD_POOL_META_SERVER)

FILE: include/dsn/dist/replication/replication_app_base.h
  function namespace (line 37) | namespace dsn {

FILE: include/dsn/dist/replication/replication_ddl_client.h
  function namespace (line 48) | namespace dsn {

FILE: include/dsn/dist/replication/replication_other_types.h
  function namespace (line 42) | namespace dsn {

FILE: include/dsn/dist/replication/replication_service_app.h
  function namespace (line 41) | namespace dsn {

FILE: include/dsn/dist/replication/storage_serverlet.h
  function namespace (line 35) | namespace dsn {

FILE: include/dsn/http/http_server.h
  function namespace (line 26) | namespace dsn {
  function class (line 95) | class http_service
  function is_http_message (line 126) | inline bool is_http_message(dsn::task_code code)

FILE: include/dsn/perf_counter/perf_counter.h
  type dsn_perf_counter_type_t (line 36) | typedef enum dsn_perf_counter_type_t {
  type dsn_perf_counter_percentile_type_t (line 45) | typedef enum dsn_perf_counter_percentile_type_t {
  function namespace (line 62) | namespace dsn {
  type ref_ptr (line 125) | typedef ref_ptr<perf_counter> perf_counter_ptr;

FILE: include/dsn/perf_counter/perf_counter_utils.h
  type perf_counter_info (line 40) | struct perf_counter_info

FILE: include/dsn/perf_counter/perf_counter_wrapper.h
  function namespace (line 32) | namespace dsn {

FILE: include/dsn/perf_counter/perf_counters.h
  function namespace (line 39) | namespace dsn {

FILE: include/dsn/tool-api/aio_task.h
  function namespace (line 32) | namespace dsn {
  type dsn (line 119) | typedef dsn::ref_ptr<aio_task> aio_task_ptr;

FILE: include/dsn/tool-api/async_calls.h
  function namespace (line 35) | namespace dsn {
  function namespace (line 106) | namespace rpc {

FILE: include/dsn/tool-api/command_manager.h
  function namespace (line 35) | namespace dsn {
  function std (line 83) | inline std::string remote_command_set_bool_flag(bool &flag,

FILE: include/dsn/tool-api/env_provider.h
  function namespace (line 43) | namespace dsn {

FILE: include/dsn/tool-api/file_io.h
  function namespace (line 33) | namespace dsn {

FILE: include/dsn/tool-api/future_types.h
  function namespace (line 32) | namespace dsn {

FILE: include/dsn/tool-api/global_config.h
  type network_client_config (line 54) | struct network_client_config
  type std (line 62) | typedef std::map<rpc_channel, network_client_config> network_client_conf...
  type network_server_config (line 64) | struct network_server_config
  type std (line 81) | typedef std::map<network_server_config, network_server_config> network_s...
  type service_app_spec (line 89) | struct service_app_spec
  type service_spec (line 139) | struct service_spec

FILE: include/dsn/tool-api/gpid.h
  function namespace (line 31) | namespace dsn {
  function namespace (line 93) | namespace std {

FILE: include/dsn/tool-api/group_address.h
  function namespace (line 46) | namespace dsn {
  function rpc_group_address (line 98) | inline rpc_group_address::rpc_group_address(const char *name)
  function rpc_group_address (line 105) | inline rpc_group_address::rpc_group_address(const rpc_group_address &other)
  function add (line 122) | inline bool rpc_group_address::add(rpc_address addr)
  function leader_forward (line 135) | inline void rpc_group_address::leader_forward()
  function set_leader (line 143) | inline void rpc_group_address::set_leader(rpc_address addr)
  function rpc_address (line 162) | inline rpc_address rpc_group_address::possible_leader()
  function remove (line 172) | inline bool rpc_group_address::remove(rpc_address addr)
  function contains (line 186) | inline bool rpc_group_address::contains(rpc_address addr)
  function count (line 192) | inline int rpc_group_address::count()
  function rpc_address (line 198) | inline rpc_address rpc_group_address::next(rpc_address current) const

FILE: include/dsn/tool-api/logging_provider.h
  function namespace (line 41) | namespace dsn {

FILE: include/dsn/tool-api/message_parser.h
  function namespace (line 39) | namespace dsn {

FILE: include/dsn/tool-api/network.h
  function namespace (line 38) | namespace dsn {

FILE: include/dsn/tool-api/rpc_address.h
  type dsn_host_type_t (line 34) | typedef enum dsn_host_type_t {
  function namespace (line 40) | namespace dsn {
  function assign_ipv4 (line 72) | void assign_ipv4(uint32_t ip, uint16_t port)
  function assign_ipv4 (line 80) | void assign_ipv4(const char *host, uint16_t port)
  function assign_ipv4_local_address (line 88) | void assign_ipv4_local_address(const char *network_interface, uint16_t p...
  function from_string_ipv4 (line 108) | bool from_string_ipv4(const char *s)
  function value (line 132) | uint64_t &value() { return _addr.value; }
  function set_port (line 140) | void set_port(uint16_t port) { _addr.v4.port = port; }
  function rpc_group_address (line 142) | rpc_group_address *group_address() const
  function rpc_address (line 153) | bool operator==(::dsn::rpc_address r) const
  function rpc_address (line 168) | bool operator!=(::dsn::rpc_address r) const { return !(*this == r); }
  function rpc_address (line 170) | bool operator<(::dsn::rpc_address r) const
  function namespace (line 210) | namespace std {

FILE: include/dsn/tool-api/rpc_message.h
  function namespace (line 48) | namespace dsn {
  type dsn (line 235) | typedef dsn::ref_ptr<message_ex> message_ptr;

FILE: include/dsn/tool-api/task.h
  function namespace (line 53) | namespace dsn {
  function set_tracker (line 225) | void set_tracker(task_tracker *tracker) { _context_tracker.set_tracker(t...
  function service_node (line 234) | service_node *node() const { return _node; }
  function task_tracker (line 235) | task_tracker *tracker() const { return _context_tracker.tracker(); }
  function set_task_id (line 258) | void set_task_id(uint64_t tid) { _task_id = tid; }
  function virtual (line 290) | virtual void clear_non_trivial_on_task_end() {}
  type dsn (line 321) | typedef dsn::ref_ptr<dsn::task> task_ptr;
  function class (line 323) | class raw_task : public task
  function class (line 351) | class timer_task : public task
  function class (line 419) | class rpc_request_task : public task
  type dsn (line 454) | typedef dsn::ref_ptr<rpc_request_task> rpc_request_task_ptr;
  function class (line 456) | class rpc_response_task : public task
  type dsn (line 532) | typedef dsn::ref_ptr<rpc_response_task> rpc_response_task_ptr;
  function check_tls_dsn (line 537) | __inline /*static*/ void task::check_tls_dsn()
  function task (line 544) | __inline /*static*/ task *task::get_current_task()
  function get_current_task_id (line 550) | __inline /*static*/ uint64_t task::get_current_task_id()
  function task_worker (line 558) | __inline /*static*/ task_worker *task::get_current_worker()
  function task_worker (line 564) | __inline /*static*/ task_worker *task::get_current_worker2()
  function service_node (line 569) | __inline /*static*/ service_node *task::get_current_node()
  function get_current_node_id (line 575) | __inline /*static*/ int task::get_current_node_id()
  function service_node (line 580) | __inline /*static*/ service_node *task::get_current_node2()
  function get_current_worker_index (line 585) | __inline /*static*/ int task::get_current_worker_index()
  function rpc_engine (line 591) | __inline /*static*/ rpc_engine *task::get_current_rpc()
  function env_provider (line 597) | __inline /*static*/ env_provider *task::get_current_env()

FILE: include/dsn/tool-api/task_code.h
  type dsn_task_type_t (line 34) | typedef enum dsn_task_type_t {
  function ENUM_REG (line 47) | ENUM_REG(TASK_TYPE_RPC_REQUEST)
  function ENUM_REG (line 63) | ENUM_REG(TASK_PRIORITY_LOW)

FILE: include/dsn/tool-api/task_queue.h
  function namespace (line 42) | namespace dsn {
  function std (line 87) | const std::string &get_name() { return _name; }
  function task_worker_pool (line 88) | task_worker_pool *pool() const { return _pool; }

FILE: include/dsn/tool-api/task_spec.h
  type task_state (line 60) | enum task_state
  function ENUM_REG (line 71) | ENUM_REG(TASK_STATE_READY)
  function ENUM_REG (line 86) | ENUM_REG(GRPC_TO_LEADER)
  function ENUM_REG (line 100) | ENUM_REG(TM_NONE)

FILE: include/dsn/tool-api/task_tracker.h
  function namespace (line 45) | namespace dsn {

FILE: include/dsn/tool-api/task_worker.h
  function namespace (line 45) | namespace dsn {

FILE: include/dsn/tool-api/thread_access_checker.h
  function namespace (line 28) | namespace dsn {

FILE: include/dsn/tool-api/threadpool_code.h
  function namespace (line 31) | namespace dsn {

FILE: include/dsn/tool-api/threadpool_spec.h
  type worker_priority_t (line 37) | enum worker_priority_t
  function ENUM_REG (line 49) | ENUM_REG(THREAD_xPRIORITY_LOWEST)

FILE: include/dsn/tool-api/timer_service.h
  function namespace (line 40) | namespace dsn {

FILE: include/dsn/tool-api/uniq_timestamp_us.h
  function namespace (line 33) | namespace dsn {

FILE: include/dsn/tool-api/zlocks.h
  function namespace (line 43) | namespace dsn {
  function namespace (line 116) | namespace dsn {
  function namespace (line 193) | namespace dsn {

FILE: include/dsn/tool/nativerun.h
  function namespace (line 40) | namespace dsn {

FILE: include/dsn/tool/node_scoper.h
  function namespace (line 40) | namespace dsn {

FILE: include/dsn/tool/providers.common.h
  function namespace (line 40) | namespace dsn {

FILE: include/dsn/tool/simulator.h
  function namespace (line 41) | namespace dsn {

FILE: include/dsn/tool_api.h
  function namespace (line 64) | namespace dsn {

FILE: include/dsn/toollet/fault_injector.h
  function namespace (line 93) | namespace dsn {

FILE: include/dsn/toollet/profiler.h
  function namespace (line 55) | namespace dsn {

FILE: include/dsn/toollet/tracer.h
  function namespace (line 103) | namespace dsn {

FILE: include/dsn/utility/TokenBucket.h
  function namespace (line 26) | namespace folly {
  function defaultClockNow (line 369) | static double defaultClockNow() noexcept(noexcept(Impl::defaultClockNow()))
  function setCapacity (line 405) | void setCapacity(double tokens, double nowInSeconds) noexcept
  function consume (line 424) | bool consume(double toConsume, double nowInSeconds = defaultClockNow())
  function consumeOrDrain (line 442) | double consumeOrDrain(double toConsume, double nowInSeconds = defaultClo...
  function returnTokens (line 450) | void returnTokens(double tokensToReturn)
  function consumeWithBorrowAndWait (line 469) | bool consumeWithBorrowAndWait(double toConsume, double nowInSeconds = de...
  function available (line 479) | double available(double nowInSeconds = defaultClockNow()) const

FILE: include/dsn/utility/absl/base/internal/invoke.h
  type MemFunAndRef (line 72) | struct MemFunAndRef
  type MemFunAndPtr (line 99) | struct MemFunAndPtr
  type DataMemAndRef (line 130) | struct DataMemAndRef
  type DataMemAndPtr (line 152) | struct DataMemAndPtr
  type typename (line 188) | typedef typename std::conditional<

FILE: include/dsn/utility/absl/utility/utility.h
  function namespace (line 50) | namespace dsn {
  function namespace (line 147) | namespace utility_internal {

FILE: include/dsn/utility/alloc.h
  function namespace (line 29) | namespace dsn {

FILE: include/dsn/utility/apply.h
  function namespace (line 31) | namespace dsn {

FILE: include/dsn/utility/autoref_ptr.h
  function namespace (line 43) | namespace dsn {

FILE: include/dsn/utility/binary_reader.h
  function namespace (line 33) | namespace dsn {

FILE: include/dsn/utility/binary_writer.h
  function namespace (line 32) | namespace dsn {
  function get_buffers (line 102) | inline void binary_writer::get_buffers(/*out*/ std::vector<blob> &buffers)
  function write (line 110) | inline void binary_writer::write(const std::string &val)
  function write (line 118) | inline void binary_writer::write(const blob &val)

FILE: include/dsn/utility/blob.h
  function namespace (line 32) | namespace dsn {

FILE: include/dsn/utility/casts.h
  function namespace (line 23) | namespace dsn {

FILE: include/dsn/utility/chrono_literals.h
  function namespace (line 36) | namespace dsn {

FILE: include/dsn/utility/clock.h
  function namespace (line 22) | namespace dsn {

FILE: include/dsn/utility/configuration.h
  function namespace (line 40) | namespace dsn {

FILE: include/dsn/utility/crc.h
  function namespace (line 34) | namespace dsn {

FILE: include/dsn/utility/customizable_id.h
  function namespace (line 45) | namespace dsn {

FILE: include/dsn/utility/defer.h
  function namespace (line 22) | namespace dsn {

FILE: include/dsn/utility/endians.h
  function namespace (line 25) | namespace dsn {

FILE: include/dsn/utility/enum_helper.h
  function namespace (line 67) | namespace dsn {

FILE: include/dsn/utility/error_code.h
  function namespace (line 32) | namespace dsn {

FILE: include/dsn/utility/errors.h
  function namespace (line 36) | namespace dsn {
  function if (line 146) | struct error_info
  function else (line 161) | else if (!_info) {
  function _err (line 193) | error_with(const error_s &status) : _err(status) { assert(!_err.is_ok()); }
  function T (line 195) | const T &get_value() const

FILE: include/dsn/utility/exp_delay.h
  function namespace (line 42) | namespace dsn {

FILE: include/dsn/utility/extensible_object.h
  function namespace (line 44) | namespace dsn {
  function get (line 156) | static uint64_t &get(TExtensibleObject *ctx) { return ctx->get_extension...
  function set (line 158) | static void set(TExtensibleObject *ctx, uint64_t ext) { ctx->set_extensi...
  function register_ext (line 175) | static uint32_t register_ext(extension_creator creator, extension_deleto...
  function TExtension (line 183) | static TExtension *get(TExtensibleObject *ctx)
  function set (line 189) | static void set(TExtensibleObject *ctx, TExtension *ext)
  function TExtension (line 194) | static TExtension *get_inited(TExtensibleObject *ctx)
  function clear (line 210) | static void clear(TExtensibleObject *ctx)

FILE: include/dsn/utility/factory_store.h
  function namespace (line 40) | namespace dsn {

FILE: include/dsn/utility/fail_point.h
  function namespace (line 64) | namespace dsn {

FILE: include/dsn/utility/filesystem.h
  function namespace (line 54) | namespace dsn {

FILE: include/dsn/utility/fixed_size_buffer_pool.h
  function fixed_size_buffer_pool (line 39) | unsigned int ChunkSize>

FILE: include/dsn/utility/flags.h
  function flag_tag (line 27) | enum class flag_tag

FILE: include/dsn/utility/function_traits.h
  function namespace (line 39) | namespace dsn {

FILE: include/dsn/utility/hpc_locks/autoresetevent.h
  function class (line 16) | class AutoResetEvent
  function signal (line 31) | void signal()
  function wait (line 48) | void wait()
  function wait (line 57) | bool wait(int timeout_milliseconds)

FILE: include/dsn/utility/hpc_locks/autoreseteventcondvar.h
  function class (line 16) | class AutoResetEventCondVar
  function signal (line 32) | void signal()
  function wait (line 44) | void wait()

FILE: include/dsn/utility/hpc_locks/benaphore.h
  function class (line 18) | class NonRecursiveBenaphore
  function class (line 55) | class RecursiveBenaphore

FILE: include/dsn/utility/hpc_locks/bitfield.h
  function class (line 77) | class Element
  function Element (line 116) | Element operator[](int i)
  function Element (line 122) | const Element operator[](int i) const

FILE: include/dsn/utility/hpc_locks/rwlock.h
  function class (line 18) | class NonRecursiveRWLock

FILE: include/dsn/utility/hpc_locks/sema.h
  function class (line 22) | class Semaphore
  function wait (line 39) | void wait() { WaitForSingleObject(m_hSema, INFINITE); }
  function wait (line 41) | bool wait(int timeout_milliseconds)
  function class (line 58) | class Semaphore
  function wait (line 75) | void wait() { semaphore_wait(m_sema); }
  function wait (line 77) | bool wait(int timeout_milliseconds)
  function signal (line 84) | void signal() { semaphore_signal(m_sema); }
  function signal (line 86) | void signal(int count)
  function class (line 102) | class Semaphore
  function wait (line 119) | void wait()
  function wait (line 128) | bool wait(int timeout_milliseconds)
  function signal (line 145) | void signal() { sem_post(&m_sema); }
  function signal (line 147) | void signal(int count)
  function class (line 164) | class LightweightSemaphore
  function tryWait (line 199) | bool tryWait()
  function wait (line 206) | void wait()
  function wait (line 213) | bool wait(int timeout_milliseconds)
  type LightweightSemaphore (line 235) | typedef LightweightSemaphore DefaultSemaphoreType;

FILE: include/dsn/utility/join_point.h
  function namespace (line 35) | namespace dsn {

FILE: include/dsn/utility/link.h
  function add (line 49) | void add(T *obj)
  function T (line 59) | T *pop_all()
  function T (line 96) | T *pop_one()
  function class (line 119) | class dlink

FILE: include/dsn/utility/long_adder.h
  function namespace (line 29) | namespace dsn {

FILE: include/dsn/utility/math.h
  function namespace (line 23) | namespace dsn {

FILE: include/dsn/utility/metrics.h
  function namespace (line 128) | namespace dsn {
  function class (line 184) | class metric_entity_prototype
  function class (line 202) | class metric_registry : public utils::singleton<metric_registry>
  function metric_unit (line 224) | enum class metric_unit
  function set (line 330) | void set(const T &val) { _value.store(val, std::memory_order_relaxed); }
  function increment (line 447) | void increment() { _adder.increment(); }
  function reset (line 449) | void reset() { _adder.reset(); }
  function kth_percentile_type (line 485) | enum class kth_percentile_type : size_t
  function find_nth_elements (line 664) | void find_nth_elements()
  function set_real_nths (line 693) | void set_real_nths(size_type real_sample_size)

FILE: include/dsn/utility/nth_element.h
  function namespace (line 34) | namespace dsn {

FILE: include/dsn/utility/optional.h
  type none_placeholder_t (line 40) | struct none_placeholder_t
  function none_placeholder_t (line 43) | constexpr none_placeholder_t none{}
  function optional (line 53) | optional(none_placeholder_t) : optional() {}
  function T (line 56) | new (_data_placeholder) T{reinterpret_cast<const T &>(that._data_placeho...
  function T (line 61) | new (_data_placeholder) T{std::move(reinterpret_cast<T &&>(that._data_pl...
  function _is_some (line 65) | _is_some(true)

FILE: include/dsn/utility/output_utils.h
  function namespace (line 29) | namespace dsn {

FILE: include/dsn/utility/preloadable.h
  function namespace (line 22) | namespace dsn {

FILE: include/dsn/utility/priority_queue.h
  function namespace (line 42) | namespace dsn {

FILE: include/dsn/utility/process_utils.h
  function namespace (line 24) | namespace dsn {

FILE: include/dsn/utility/rand.h
  function namespace (line 24) | namespace dsn {

FILE: include/dsn/utility/safe_strerror_posix.h
  function namespace (line 9) | namespace dsn {

FILE: include/dsn/utility/singleton.h
  function namespace (line 22) | namespace dsn {

FILE: include/dsn/utility/singleton_store.h
  function namespace (line 43) | namespace dsn {

FILE: include/dsn/utility/smart_pointers.h
  function namespace (line 19) | namespace dsn {

FILE: include/dsn/utility/string_conv.h
  function namespace (line 25) | namespace dsn {
  function buf2int32 (line 100) | inline bool buf2int32(string_view buf, int32_t &result)
  function buf2int64 (line 105) | inline bool buf2int64(string_view buf, int64_t &result)
  function buf2uint32 (line 110) | inline bool buf2uint32(string_view buf, uint32_t &result)
  function buf2uint64 (line 115) | inline bool buf2uint64(string_view buf, uint64_t &result)
  function buf2double (line 137) | inline bool buf2double(string_view buf, double &result)

FILE: include/dsn/utility/string_splitter.h
  function namespace (line 23) | namespace dsn {
  function not_end (line 160) | bool string_splitter::not_end(const char *p) const
  function to_int8 (line 165) | int string_splitter::to_int8(int8_t *pv) const
  function to_uint8 (line 175) | int string_splitter::to_uint8(uint8_t *pv) const
  function to_int (line 185) | int string_splitter::to_int(int *pv) const
  function to_uint (line 195) | int string_splitter::to_uint(unsigned int *pv) const
  function to_long (line 205) | int string_splitter::to_long(long *pv) const
  function to_ulong (line 212) | int string_splitter::to_ulong(unsigned long *pv) const
  function to_longlong (line 219) | int string_splitter::to_longlong(long long *pv) const
  function to_ulonglong (line 226) | int string_splitter::to_ulonglong(unsigned long long *pv) const
  function to_float (line 233) | int string_splitter::to_float(float *pv) const
  function to_double (line 240) | int string_splitter::to_double(double *pv) const

FILE: include/dsn/utility/string_view.h
  function namespace (line 49) | namespace dsn {
  function string_view (line 333) | string_view substr(size_type pos, size_type n = npos) const
  function compare (line 349) | int compare(string_view x) const noexcept
  function compare (line 368) | int compare(size_type pos1, size_type count1, string_view v) const
  function compare (line 375) | int
  function compare (line 383) | int compare(const char *s) const { return compare(string_view(s)); }
  function compare (line 387) | int compare(size_type pos1, size_type count1, const char *s) const
  function compare (line 394) | int compare(size_type pos1, size_type count1, const char *s, size_type c...

FILE: include/dsn/utility/strings.h
  function namespace (line 36) | namespace dsn {

FILE: include/dsn/utility/synchronize.h
  function namespace (line 34) | namespace dsn {

FILE: include/dsn/utility/sys_exit_hook.h
  function namespace (line 22) | namespace dsn {

FILE: include/dsn/utility/timer.h
  function namespace (line 22) | namespace dsn {

FILE: include/dsn/utility/utils.h
  type CompileAssert (line 60) | struct CompileAssert
  function namespace (line 66) | namespace dsn {

FILE: include/dsn/utility/work_queue.h
  function namespace (line 42) | namespace dsn {

FILE: include/dsn/utils/latency_tracer.h
  function namespace (line 25) | namespace dsn {

FILE: include/dsn/utils/time_utils.h
  function namespace (line 32) | namespace dsn {

FILE: include/dsn/utils/token_bucket_throttling_controller.h
  function namespace (line 23) | namespace dsn {

FILE: include/dsn/utils/token_buckets.h
  function namespace (line 25) | namespace dsn {

FILE: scripts/linux/run-clang-format.py
  class ExitStatus (line 61) | class ExitStatus:
  function excludes_from_file (line 66) | def excludes_from_file(ignore_file):
  function list_files (line 84) | def list_files(files, recursive=False, extensions=None, exclude=None):
  function make_diff (line 116) | def make_diff(file, original, reformatted):
  class DiffError (line 126) | class DiffError(Exception):
    method __init__ (line 127) | def __init__(self, message, errs=None):
  class UnexpectedError (line 132) | class UnexpectedError(Exception):
    method __init__ (line 133) | def __init__(self, message, exc=None):
  function run_clang_format_diff_wrapper (line 139) | def run_clang_format_diff_wrapper(args, file):
  function run_clang_format_diff (line 150) | def run_clang_format_diff(args, file):
  function bold_red (line 228) | def bold_red(s):
  function colorize (line 232) | def colorize(diff_lines):
  function print_diff (line 258) | def print_diff(diff_lines, use_color):
  function print_trouble (line 267) | def print_trouble(prog, message, use_colors):
  function main (line 274) | def main():

FILE: src/aio/aio_provider.cpp
  type dsn (line 30) | namespace dsn {
    type tools (line 39) | namespace tools {
      type internal_use_only (line 40) | namespace internal_use_only {
        function register_component_provider (line 41) | bool register_component_provider(const char *name, aio_provider::f...

FILE: src/aio/aio_provider.h
  function namespace (line 33) | namespace dsn {

FILE: src/aio/aio_task.cpp
  type dsn (line 23) | namespace dsn {

FILE: src/aio/disk_engine.cpp
  type dsn (line 37) | namespace dsn {
    type disk_engine_initializer (line 43) | struct disk_engine_initializer
      method disk_engine_initializer (line 45) | disk_engine_initializer() { disk_engine::instance(); }
    function aio_task (line 53) | aio_task *disk_write_queue::unlink_next_workload(void *plength)
    function aio_task (line 96) | aio_task *disk_file::read(aio_task *tsk)
    function aio_task (line 102) | aio_task *disk_file::write(aio_task *tsk, void *ctx)
    function aio_task (line 108) | aio_task *disk_file::on_read_completed(aio_task *wk, error_code err, s...
    function aio_task (line 118) | aio_task *disk_file::on_write_completed(aio_task *wk, void *ctx, error...
    class batch_write_io_task (line 155) | class batch_write_io_task : public aio_task
      method batch_write_io_task (line 158) | explicit batch_write_io_task(aio_task *tasks)
      method exec (line 163) | virtual void exec() override

FILE: src/aio/disk_engine.h
  function namespace (line 35) | namespace dsn {

FILE: src/aio/file_io.cpp
  type dsn (line 30) | namespace dsn {
    type file (line 31) | namespace file {
      function disk_file (line 33) | disk_file *open(const char *file_name, int flag, int pmode)
      function error_code (line 43) | error_code close(disk_file *file)
      function error_code (line 54) | error_code flush(disk_file *file)
      function aio_task_ptr (line 63) | aio_task_ptr read(disk_file *file,
      function aio_task_ptr (line 92) | aio_task_ptr write(disk_file *file,
      function aio_task_ptr (line 112) | aio_task_ptr write_vector(disk_file *file,
      function aio_context_ptr (line 136) | aio_context_ptr prepare_aio_context(aio_task *tsk)

FILE: src/aio/native_linux_aio_provider.cpp
  type dsn (line 39) | namespace dsn {
    function dsn_handle_t (line 45) | dsn_handle_t native_linux_aio_provider::open(const char *file_name, in...
    function error_code (line 54) | error_code native_linux_aio_provider::close(dsn_handle_t fh)
    function error_code (line 64) | error_code native_linux_aio_provider::flush(dsn_handle_t fh)
    function error_code (line 74) | error_code native_linux_aio_provider::write(const aio_context &aio_ctx,
    function error_code (line 116) | error_code native_linux_aio_provider::read(const aio_context &aio_ctx,
    function error_code (line 146) | error_code native_linux_aio_provider::aio_internal(aio_task *aio_tsk)

FILE: src/aio/native_linux_aio_provider.h
  function namespace (line 31) | namespace dsn {

FILE: src/aio/test/aio.cpp
  function TEST (line 39) | TEST(core, aio)
  function TEST (line 134) | TEST(core, aio_share)
  function TEST (line 148) | TEST(core, operation_failed)
  type aio_result (line 200) | struct aio_result
  function TEST (line 205) | TEST(core, dsn_file)

FILE: src/aio/test/main.cpp
  function GTEST_API_ (line 21) | GTEST_API_ int main(int argc, char **argv)

FILE: src/block_service/block_service_manager.cpp
  type dsn (line 27) | namespace dsn {
    type dist (line 28) | namespace dist {
      type block_service (line 29) | namespace block_service {
        function block_filesystem (line 61) | block_filesystem *block_service_manager::get_or_create_block_files...
        function create_file_response (line 101) | static create_file_response create_block_file_sync(const std::stri...
        function download_response (line 115) | static download_response
        function error_code (line 127) | error_code block_service_manager::download_file(const std::string ...
        function error_code (line 138) | error_code block_service_manager::download_file(const std::string ...

FILE: src/block_service/block_service_manager.h
  function namespace (line 24) | namespace dsn {

FILE: src/block_service/directio_writable_file.cpp
  type dsn (line 32) | namespace dsn {
    type dist (line 33) | namespace dist {
      type block_service (line 34) | namespace block_service {

FILE: src/block_service/directio_writable_file.h
  function namespace (line 22) | namespace dsn {

FILE: src/block_service/fds/fds_service.cpp
  type dsn (line 44) | namespace dsn {
    type dist (line 45) | namespace dist {
      type block_service (line 46) | namespace block_service {
        class utils (line 60) | class utils
        function error_code (line 147) | error_code fds_service::initialize(const std::vector<std::string> ...
        function error_code (line 401) | error_code fds_file_object::get_file_meta()
        function error_code (line 441) | error_code fds_file_object::get_content_in_batches(uint64_t start,
        function error_code (line 482) | error_code fds_file_object::get_content(uint64_t pos,
        function error_code (line 528) | error_code fds_file_object::put_content(/*in-out*/ std::istream &is,

FILE: src/block_service/fds/fds_service.h
  function namespace (line 23) | namespace folly {
  function namespace (line 30) | namespace galaxy {
  function namespace (line 37) | namespace dist {

FILE: src/block_service/hdfs/hdfs_service.cpp
  type dsn (line 35) | namespace dsn {
    type dist (line 36) | namespace dist {
      type block_service (line 37) | namespace block_service {
        function error_code (line 78) | error_code hdfs_service::initialize(const std::vector<std::string>...
        function error_code (line 92) | error_code hdfs_service::create_fs()
        function error_code (line 272) | error_code hdfs_file_object::get_file_meta()
        function error_code (line 291) | error_code hdfs_file_object::write_data_in_batches(const char *data,
        function error_code (line 395) | error_code hdfs_file_object::read_data_in_batches(uint64_t start_pos,

FILE: src/block_service/hdfs/hdfs_service.h
  function namespace (line 23) | namespace folly {
  function namespace (line 30) | namespace dsn {

FILE: src/block_service/local/local_service.cpp
  type dsn (line 35) | namespace dsn {
    type dist (line 36) | namespace dist {
      type block_service (line 37) | namespace block_service {
        type file_metadata (line 41) | struct file_metadata
        function file_metadata_from_json (line 48) | bool file_metadata_from_json(std::ifstream &fin, file_metadata &fm...
        function error_code (line 75) | error_code local_service::initialize(const std::vector<std::string...
        function error_code (line 260) | error_code local_file_object::load_metadata()
        function error_code (line 284) | error_code local_file_object::store_metadata()

FILE: src/block_service/local/local_service.h
  function namespace (line 24) | namespace dsn {

FILE: src/block_service/test/block_service_manager_test.cpp
  type dsn (line 27) | namespace dsn {
    type dist (line 28) | namespace dist {
      type block_service (line 29) | namespace block_service {
        class block_service_manager_test (line 31) | class block_service_manager_test : public ::testing::Test
          method block_service_manager_test (line 34) | block_service_manager_test()
          method error_code (line 43) | error_code test_download_file(uint64_t &download_size)
          method create_local_file (line 49) | void create_local_file(const std::string &file_name)
          method create_remote_file (line 63) | void create_remote_file(const std::string &file_name, int64_t si...
        function TEST_F (line 80) | TEST_F(block_service_manager_test, do_download_remote_file_not_exist)
        function TEST_F (line 91) | TEST_F(block_service_manager_test, do_download_same_name_file)
        function TEST_F (line 101) | TEST_F(block_service_manager_test, do_download_file_exist)
        function TEST_F (line 110) | TEST_F(block_service_manager_test, do_download_succeed)

FILE: src/block_service/test/block_service_mock.h
  function namespace (line 25) | namespace dsn {
  function file_exist (line 113) | void file_exist(const std::string &_md5, int64_t _size)
  function clear_file_exist (line 119) | void clear_file_exist()
  function set_context (line 125) | void set_context(const std::string &value)
  function clear_context (line 133) | void clear_context() { context = blob(); }
  function class (line 144) | class block_service_mock : public block_filesystem

FILE: src/block_service/test/fds_service_test.cpp
  function pipe_execute (line 42) | static void pipe_execute(const char *command, std::stringstream &output)
  function file_eq_compare (line 53) | static void file_eq_compare(const std::string &fname1, const std::string...
  class FDSClientTest (line 80) | class FDSClientTest : public testing::Test
    type file_desc (line 86) | struct file_desc
  function TEST_F (line 141) | TEST_F(FDSClientTest, test_basic_operation)
  function generate_file (line 643) | static void
  function TEST_F (line 662) | TEST_F(FDSClientTest, test_concurrent_upload_download)

FILE: src/block_service/test/hdfs_service_test.cpp
  class HDFSClientTest (line 49) | class HDFSClientTest : public testing::Test
  function TEST_F (line 102) | TEST_F(HDFSClientTest, test_basic_operation)
  function TEST_F (line 240) | TEST_F(HDFSClientTest, test_concurrent_upload_download)
  function TEST_F (line 369) | TEST_F(HDFSClientTest, test_rename_path_while_writing)
  function TEST_F (line 381) | TEST_F(HDFSClientTest, test_remove_path_while_writing)

FILE: src/block_service/test/local_service_test.cpp
  type dsn (line 26) | namespace dsn {
    type dist (line 27) | namespace dist {
      type block_service (line 28) | namespace block_service {
        function TEST (line 32) | TEST(local_service, store_metadata)
        function TEST (line 48) | TEST(local_service, load_metadata)

FILE: src/block_service/test/main.cpp
  class gtest_app (line 25) | class gtest_app : public dsn::service_app
    method gtest_app (line 28) | gtest_app(const dsn::service_app_info *info) : ::dsn::service_app(info...
    method start (line 30) | dsn::error_code start(const std::vector<std::string> &args) override
    method stop (line 37) | dsn::error_code stop(bool) override { return dsn::ERR_OK; }
  function GTEST_API_ (line 40) | GTEST_API_ int main(int argc, char **argv)

FILE: src/client/partition_resolver.cpp
  type dsn (line 33) | namespace dsn {
    type replication (line 34) | namespace replication {
      function partition_resolver_ptr (line 36) | partition_resolver_ptr partition_resolver::get_resolver(const char *...
      function error_retry (line 45) | static inline bool error_retry(error_code err)

FILE: src/client/partition_resolver_manager.cpp
  type dsn (line 33) | namespace dsn {
    type replication (line 34) | namespace replication {
      function vector_equal (line 37) | bool vector_equal(const std::vector<T> &a, const std::vector<T> &b)
      function partition_resolver_ptr (line 52) | partition_resolver_ptr partition_resolver_manager::find_or_create(

FILE: src/client/partition_resolver_manager.h
  function namespace (line 36) | namespace dsn {

FILE: src/client/partition_resolver_simple.cpp
  type dsn (line 33) | namespace dsn {
    type replication (line 34) | namespace replication {
      function task_ptr (line 231) | task_ptr partition_resolver_simple::query_config(int partition_index...
      function rpc_address (line 415) | rpc_address partition_resolver_simple::get_address(const partition_c...
      function error_code (line 428) | error_code partition_resolver_simple::get_address(int partition_inde...

FILE: src/client/partition_resolver_simple.h
  function namespace (line 35) | namespace dsn {

FILE: src/client/replication_ddl_client.cpp
  type dsn (line 52) | namespace dsn {
    type replication (line 53) | namespace replication {
      type list_nodes_helper (line 473) | struct list_nodes_helper
        method list_nodes_helper (line 479) | list_nodes_helper(const std::string &n, const std::string &s)
      function host_name_resolve (line 485) | std::string host_name_resolve(bool resolve_ip, std::string value)
      function print_set (line 1135) | std::string print_set(const std::set<T> &set)
      function print_policy_entry (line 1151) | static void print_policy_entry(const policy_entry &entry)
      function print_backup_entry (line 1164) | static void print_backup_entry(const backup_entry &bentry)
      function error_code (line 1621) | error_code replication_ddl_client::detect_hotkey(const dsn::rpc_addr...

FILE: src/common/backup_common.cpp
  type dsn (line 21) | namespace dsn {
    type replication (line 22) | namespace replication {
      type cold_backup (line 40) | namespace cold_backup {
        function get_backup_path (line 42) | std::string get_backup_path(const std::string &root, int64_t backu...
        function get_backup_info_file (line 47) | std::string get_backup_info_file(const std::string &root, int64_t ...
        function get_replica_backup_path (line 52) | std::string get_replica_backup_path(const std::string &root,
        function get_app_meta_backup_path (line 62) | std::string get_app_meta_backup_path(const std::string &root,
        function get_app_metadata_file (line 71) | std::string get_app_metadata_file(const std::string &root,
        function get_app_backup_status_file (line 80) | std::string get_app_backup_status_file(const std::string &root,
        function get_current_chkpt_file (line 89) | std::string get_current_chkpt_file(const std::string &root,
        function get_remote_chkpt_dirname (line 98) | std::string get_remote_chkpt_dirname()
        function get_remote_chkpt_dir (line 106) | std::string get_remote_chkpt_dir(const std::string &root,
        function get_remote_chkpt_meta_file (line 115) | std::string get_remote_chkpt_meta_file(const std::string &root,

FILE: src/common/backup_common.h
  function namespace (line 25) | namespace dsn {

FILE: src/common/bulk_load_common.cpp
  type dsn (line 20) | namespace dsn {
    type replication (line 21) | namespace replication {

FILE: src/common/bulk_load_common.h
  function namespace (line 23) | namespace dsn {

FILE: src/common/common.cpp
  type dsn (line 21) | namespace dsn {

FILE: src/common/duplication_common.cpp
  type dsn (line 25) | namespace dsn {
    type replication (line 26) | namespace replication {
      type internal (line 59) | namespace internal {
        class duplication_group_registry (line 61) | class duplication_group_registry : public utils::singleton<duplica...
          method get_cluster_id (line 64) | error_with<uint8_t> get_cluster_id(const std::string &cluster_na...
          method duplication_group_registry (line 85) | duplication_group_registry()
      function get_duplication_cluster_id (line 117) | error_with<uint8_t> get_duplication_cluster_id(const std::string &cl...
      function duplication_entry_to_json (line 124) | static nlohmann::json duplication_entry_to_json(const duplication_en...
      function duplication_entry_to_string (line 145) | std::string duplication_entry_to_string(const duplication_entry &ent)
      function duplication_query_response_to_string (line 150) | std::string duplication_query_response_to_string(const duplication_q...

FILE: src/common/fs_manager.cpp
  type dsn (line 42) | namespace dsn {
    type replication (line 43) | namespace replication {
      function dir_node (line 153) | dir_node *fs_manager::get_dir_node(const std::string &subdir)

FILE: src/common/fs_manager.h
  function namespace (line 29) | namespace dsn {

FILE: src/common/manual_compact.h
  function namespace (line 23) | namespace dsn {

FILE: src/common/partition_split_common.h
  function namespace (line 23) | namespace dsn {

FILE: src/common/replication_common.cpp
  type dsn (line 36) | namespace dsn {
    type replication (line 37) | namespace replication {

FILE: src/common/replication_common.h
  function namespace (line 32) | namespace dsn {

FILE: src/common/test/common_test.cpp
  type dsn (line 23) | namespace dsn {
    function TEST (line 24) | TEST(duplication_common, get_current_cluster_name)

FILE: src/common/test/duplication_common_test.cpp
  type dsn (line 30) | namespace dsn {
    type replication (line 31) | namespace replication {
      function TEST (line 33) | TEST(duplication_common, get_duplication_cluster_id)
      function TEST (line 42) | TEST(duplication_common, get_distinct_cluster_id_set)

FILE: src/common/test/fs_manager_test.cpp
  type dsn (line 25) | namespace dsn {
    type replication (line 26) | namespace replication {
      function TEST (line 28) | TEST(fs_manager, dir_update_disk_status)

FILE: src/common/test/main.cpp
  class gtest_app (line 34) | class gtest_app : public dsn::service_app
    method gtest_app (line 37) | explicit gtest_app(const dsn::service_app_info *info) : ::dsn::service...
    method start (line 39) | dsn::error_code start(const std::vector<std::string> &args) override
    method stop (line 46) | dsn::error_code stop(bool) override { return dsn::ERR_OK; }
  function GTEST_API_ (line 49) | GTEST_API_ int main(int argc, char **argv)

FILE: src/common/test/replication_common_test.cpp
  type dsn (line 27) | namespace dsn {
    type replication (line 28) | namespace replication {
      function TEST (line 30) | TEST(replication_common, get_data_dir_test)
      function TEST (line 70) | TEST(replication_common, get_black_list_test)
      function TEST (line 97) | TEST(replication_common, check_in_black_list_test)

FILE: src/failure_detector/failure_detector.cpp
  type dsn (line 41) | namespace dsn {
    type fd (line 42) | namespace fd {
      function error_code (line 79) | error_code failure_detector::start(uint32_t check_interval_seconds,

FILE: src/failure_detector/failure_detector_multimaster.cpp
  type dsn (line 42) | namespace dsn {
    type dist (line 43) | namespace dist {

FILE: src/failure_detector/test/failure_detector.cpp
  class worker_fd_test (line 45) | class worker_fd_test : public ::dsn::dist::slave_failure_detector_with_m...
    method send_beacon (line 54) | virtual void send_beacon(::dsn::rpc_address node, uint64_t time) override
    method on_master_disconnected (line 63) | virtual void on_master_disconnected(const std::vector<rpc_address> &no...
    method on_master_connected (line 69) | virtual void on_master_connected(rpc_address node) override
    method worker_fd_test (line 76) | worker_fd_test(replication::replica_stub *stub, std::vector<dsn::rpc_a...
    method toggle_send_ping (line 83) | void toggle_send_ping(bool toggle) { _send_ping_switch = toggle; }
    method when_connected (line 84) | void when_connected(const std::function<void(rpc_address addr)> &func)...
    method when_disconnected (line 85) | void when_disconnected(const std::function<void(const std::vector<rpc_...
    method clear (line 89) | void clear()
  class master_fd_test (line 96) | class master_fd_test : public replication::meta_server_failure_detector
    method on_ping (line 104) | virtual void on_ping(const beacon_msg &beacon, ::dsn::rpc_replier<beac...
    method on_worker_disconnected (line 116) | virtual void on_worker_disconnected(const std::vector<rpc_address> &wo...
    method on_worker_connected (line 121) | virtual void on_worker_connected(rpc_address node) override
    method master_fd_test (line 126) | master_fd_test() : meta_server_failure_detector(rpc_address(), false)
    method toggle_response_ping (line 130) | void toggle_response_ping(bool toggle) { _response_ping_switch = toggl...
    method when_connected (line 131) | void when_connected(const std::function<void(rpc_address addr)> &func)...
    method when_disconnected (line 132) | void when_disconnected(const std::function<void(const std::vector<rpc_...
    method test_register_worker (line 136) | void test_register_worker(rpc_address node)
    method clear (line 141) | void clear()
  class test_worker (line 148) | class test_worker : public service_app, public serverlet<test_worker>
    method test_worker (line 151) | test_worker(const service_app_info *info) : service_app(info), serverl...
    method error_code (line 153) | error_code start(const std::vector<std::string> &args) override
    method error_code (line 167) | error_code stop(bool) override { return ERR_OK; }
    method on_master_config (line 169) | void on_master_config(const config_master_message &request, bool &resp...
    method worker_fd_test (line 181) | worker_fd_test *fd() { return _worker_fd; }
  class test_master (line 186) | class test_master : public service_app
    method test_master (line 189) | test_master(const service_app_info *info) : ::dsn::service_app(info) {}
    method error_code (line 191) | error_code start(const std::vector<std::string> &args) override
    method error_code (line 217) | error_code stop(bool) override { return ERR_OK; }
    method master_fd_test (line 219) | master_fd_test *fd() { return _master_fd; }
  function spin_wait_condition (line 225) | bool spin_wait_condition(const std::function<bool()> &pred, int seconds)
  function fd_test_init (line 235) | void fd_test_init()
  function get_worker_and_master (line 242) | bool get_worker_and_master(test_worker *&worker, std::vector<test_master...
  function master_group_set_leader (line 272) | void master_group_set_leader(std::vector<test_master *> &master_group, i...
  function worker_set_leader (line 282) | void worker_set_leader(test_worker *worker, int leader_contact)
  function clear (line 296) | void clear(test_worker *worker, std::vector<test_master *> masters)
  function finish (line 317) | void finish(test_worker *worker, test_master *master, int master_index)
  function TEST (line 343) | TEST(fd, dummy_connect_disconnect)
  function TEST (line 374) | TEST(fd, master_redirect)
  function TEST (line 411) | TEST(fd, switch_new_master_suddenly)
  function TEST (line 468) | TEST(fd, old_master_died)
  function TEST (line 530) | TEST(fd, worker_died_when_switch_master)
  function TEST (line 597) | TEST(fd, update_stability)
  function TEST (line 704) | TEST(fd, not_in_whitelist)

FILE: src/failure_detector/test/main.cpp
  class test_client (line 42) | class test_client : public ::dsn::service_app
    method test_client (line 45) | test_client(const dsn::service_app_info *info) : ::dsn::service_app(in...
    method start (line 47) | ::dsn::error_code start(const std::vector<std::string> &args)
    method stop (line 60) | ::dsn::error_code stop(bool cleanup = false) { return ::dsn::ERR_OK; }
  function GTEST_API_ (line 63) | GTEST_API_ int main(int argc, char **argv)

FILE: src/http/builtin_http_calls.cpp
  type dsn (line 26) | namespace dsn {
    function get_help_handler (line 28) | void get_help_handler(const http_request &req, http_response &resp)
    function get_version_handler (line 41) | void get_version_handler(const http_request &req, http_response &resp)
    function get_recent_start_time_handler (line 54) | void get_recent_start_time_handler(const http_request &req, http_respo...
    function register_builtin_http_calls (line 67) | void register_builtin_http_calls()

FILE: src/http/builtin_http_calls.h
  function namespace (line 24) | namespace dsn {

FILE: src/http/config_http_service.cpp
  type dsn (line 22) | namespace dsn {
    function update_config (line 23) | void update_config(const http_request &req, http_response &resp)
    function list_all_configs (line 41) | void list_all_configs(const http_request &req, http_response &resp)
    function get_config (line 52) | void get_config(const http_request &req, http_response &resp)

FILE: src/http/http_call_registry.h
  function namespace (line 23) | namespace dsn {

FILE: src/http/http_message_parser.cpp
  type dsn (line 37) | namespace dsn {
    type parser_context (line 39) | struct parser_context
    function message_ex (line 153) | message_ex *http_message_parser::get_message_on_receive(message_reader...

FILE: src/http/http_message_parser.h
  type http_parser_stage (line 56) | enum http_parser_stage
  function _is_field_content_type (line 97) | bool _is_field_content_type{false};

FILE: src/http/http_server.cpp
  type dsn (line 31) | namespace dsn {
    function http_status_code_to_string (line 35) | std::string http_status_code_to_string(http_status_code code)
    function http_call (line 54) | http_call &register_http_call(std::string full_path)
    function deregister_http_call (line 63) | void deregister_http_call(const std::string &full_path)
    function http_response_reply (line 215) | void http_response_reply(const http_response &resp, message_ex *req)
    function start_http_server (line 236) | void start_http_server()
    function register_http_service (line 242) | void register_http_service(http_service *svc)

FILE: src/http/http_server_impl.h
  function namespace (line 24) | namespace dsn {

FILE: src/http/perf_counter_http_service.cpp
  type dsn (line 21) | namespace dsn {
    function get_perf_counter_handler (line 23) | void get_perf_counter_handler(const http_request &req, http_response &...

FILE: src/http/pprof_http_service.cpp
  type dsn (line 40) | namespace dsn {
    type lib_info (line 50) | struct lib_info
    function has_ext (line 58) | static bool has_ext(const std::string &name, const std::string &ext)
    function extract_symbols_from_binary (line 67) | static int extract_symbols_from_binary(std::map<uintptr_t, std::string...
    function load_symbols (line 168) | static void load_symbols()
    function find_symbols (line 268) | static void find_symbols(std::string *out, std::vector<uintptr_t> &add...
    function read_command_line (line 370) | ssize_t read_command_line(char *buf, size_t len, bool with_args)
    function get_cpu_profile (line 443) | static bool get_cpu_profile(std::string &result, useconds_t seconds)

FILE: src/http/pprof_http_service.h
  function namespace (line 24) | namespace dsn {

FILE: src/http/service_version.cpp
  type dsn (line 20) | namespace dsn {

FILE: src/http/service_version.h
  function namespace (line 22) | namespace dsn {

FILE: src/http/test/http_server_test.cpp
  type dsn (line 25) | namespace dsn {
    function TEST (line 27) | TEST(http_server, parse_url)
    function TEST (line 62) | TEST(bultin_http_calls_test, meta_query)
    function TEST (line 73) | TEST(bultin_http_calls_test, get_help)
    class http_message_parser_test (line 104) | class http_message_parser_test : public testing::Test
      method parse_bad_request (line 107) | void parse_bad_request()
      method parse_multiple_requests (line 142) | void parse_multiple_requests()
    function TEST_F (line 178) | TEST_F(http_message_parser_test, parse_request)
    function TEST_F (line 213) | TEST_F(http_message_parser_test, eof)
    function TEST_F (line 267) | TEST_F(http_message_parser_test, parse_bad_request) { parse_bad_reques...
    function TEST_F (line 269) | TEST_F(http_message_parser_test, parse_multiple_requests) { parse_mult...
    function TEST_F (line 271) | TEST_F(http_message_parser_test, parse_long_url)
    function TEST_F (line 291) | TEST_F(http_message_parser_test, parse_query_params)

FILE: src/http/test/perf_counter_http_service_test.cpp
  type dsn (line 24) | namespace dsn {
    function TEST (line 26) | TEST(perf_counter_http_service_test, get_perf_counter)

FILE: src/http/test/uri_decoder_test.cpp
  type dsn (line 22) | namespace dsn {
    type uri (line 23) | namespace uri {
      class uri_decoder_test (line 25) | class uri_decoder_test : public testing::Test
      function TEST_F (line 29) | TEST_F(uri_decoder_test, decode)

FILE: src/http/uri_decoder.cpp
  type dsn (line 21) | namespace dsn {
    type uri (line 22) | namespace uri {
      function from_hex (line 24) | error_with<char> from_hex(const char c)
      function decode_char (line 38) | error_with<char> decode_char(const string_view &hex)
      function decode (line 51) | error_with<std::string> decode(const string_view &encoded_uri)

FILE: src/http/uri_decoder.h
  function namespace (line 23) | namespace dsn {

FILE: src/meta/app_balance_policy.cpp
  type dsn (line 23) | namespace dsn {
    type replication (line 24) | namespace replication {
      function balance_type (line 203) | balance_type copy_secondary_operation::get_balance_type() { return b...

FILE: src/meta/app_balance_policy.h
  function namespace (line 22) | namespace dsn {

FILE: src/meta/app_env_validator.cpp
  type dsn (line 27) | namespace dsn {
    type replication (line 28) | namespace replication {
      function validate_app_env (line 30) | bool validate_app_env(const std::string &env_name,
      function check_slow_query (line 37) | bool check_slow_query(const std::string &env_value, std::string &hin...
      function check_deny_client (line 49) | bool check_deny_client(const std::string &env_value, std::string &hi...
      function check_rocksdb_iteration (line 69) | bool check_rocksdb_iteration(const std::string &env_value, std::stri...
      function check_throttling (line 79) | bool check_throttling(const std::string &env_value, std::string &hin...
      function check_bool_value (line 139) | bool check_bool_value(const std::string &env_value, std::string &hin...

FILE: src/meta/app_env_validator.h
  function namespace (line 25) | namespace dsn {

FILE: src/meta/backup_engine.cpp
  type dsn (line 25) | namespace dsn {
    type replication (line 26) | namespace replication {
      function error_code (line 35) | error_code backup_engine::init_backup(int32_t app_id)
      function error_code (line 63) | error_code backup_engine::set_block_service(const std::string &provi...
      function error_code (line 75) | error_code backup_engine::set_backup_path(const std::string &path)
      function error_code (line 85) | error_code backup_engine::write_backup_file(const std::string &file_...
      function error_code (line 117) | error_code backup_engine::backup_app_meta()
      function error_code (line 330) | error_code backup_engine::start()
      function backup_item (line 354) | backup_item backup_engine::get_backup_item() const

FILE: src/meta/backup_engine.h
  function namespace (line 24) | namespace dsn {

FILE: src/meta/cluster_balance_policy.cpp
  type dsn (line 23) | namespace dsn {
    type replication (line 24) | namespace replication {
      function get_partition_count (line 31) | uint32_t get_partition_count(const node_state &ns, balance_type type...
      function get_skew (line 55) | uint32_t get_skew(const std::map<rpc_address, uint32_t> &count_map)
      function get_min_max_set (line 69) | void get_min_max_set(const std::map<rpc_address, uint32_t> &node_cou...
      function select_random (line 339) | auto select_random(const S &s, size_t n)

FILE: src/meta/cluster_balance_policy.h
  function namespace (line 22) | namespace dsn {

FILE: src/meta/distributed_lock_service_simple.cpp
  type dsn (line 41) | namespace dsn {
    type dist (line 42) | namespace dist {
      function __lock_cb_bind_and_enqueue (line 45) | static void __lock_cb_bind_and_enqueue(task_ptr lock_task,
      function error_code (line 104) | error_code distributed_lock_service_simple::initialize(const std::ve...
      function task_ptr (line 187) | task_ptr distributed_lock_service_simple::cancel_pending_lock(const ...
      function task_ptr (line 222) | task_ptr distributed_lock_service_simple::unlock(const std::string &...
      function task_ptr (line 269) | task_ptr distributed_lock_service_simple::query_lock(const std::stri...
      function error_code (line 292) | error_code distributed_lock_service_simple::query_cache(const std::s...

FILE: src/meta/distributed_lock_service_simple.h
  function namespace (line 41) | namespace dsn {

FILE: src/meta/dump_file.h
  type block_header (line 53) | struct block_header
  function class (line 59) | class dump_file

FILE: src/meta/duplication/duplication_info.cpp
  type dsn (line 24) | namespace dsn {
    type replication (line 25) | namespace replication {
      function json_encode (line 27) | void json_encode(dsn::json::JsonWriter &out, const duplication_statu...
      function json_decode (line 32) | bool json_decode(const dsn::json::JsonObject &in, duplication_status...
      function json_encode (line 59) | void json_encode(dsn::json::JsonWriter &out, const duplication_fail_...
      function json_decode (line 64) | bool json_decode(const dsn::json::JsonObject &in, duplication_fail_m...
      function error_code (line 87) | error_code duplication_info::alter_status(duplication_status::type t...
      function blob (line 185) | blob duplication_info::to_json_blob() const
      function duplication_info_s_ptr (line 204) | duplication_info_s_ptr duplication_info::decode_from_blob(dupid_t du...

FILE: src/meta/duplication/duplication_info.h
  function namespace (line 30) | namespace dsn {
  function all_checkpoint_has_prepared (line 154) | bool all_checkpoint_has_prepared()
  function equals_to (line 177) | bool equals_to(const duplication_info &rhs) const { return to_string() =...
  type partition_progress (line 194) | struct partition_progress
  function last_progress_update_ms (line 199) | uint64_t last_progress_update_ms{0}
  function checkpoint_prepared (line 201) | bool checkpoint_prepared{false};
  function _last_progress_report_ms (line 207) | uint64_t _last_progress_report_ms{0}
  type json_helper (line 214) | struct json_helper
  function app_id (line 226) | const int32_t app_id{0}
  function partition_count (line 228) | const int32_t partition_count{0}
  function create_timestamp_ms (line 233) | const uint64_t create_timestamp_ms{0}

FILE: src/meta/duplication/meta_duplication_service.cpp
  type dsn (line 29) | namespace dsn {
    type replication (line 30) | namespace replication {

FILE: src/meta/duplication/meta_duplication_service.h
  function namespace (line 23) | namespace dsn {

FILE: src/meta/greedy_load_balancer.cpp
  type dsn (line 40) | namespace dsn {
    type replication (line 41) | namespace replication {

FILE: src/meta/greedy_load_balancer.h
  function namespace (line 39) | namespace dsn {

FILE: src/meta/load_balance_policy.cpp
  type dsn (line 25) | namespace dsn {
    type replication (line 26) | namespace replication {
      function dump_disk_load (line 29) | void dump_disk_load(app_id id, const rpc_address &node, bool only_pr...
      function calc_disk_load (line 47) | bool calc_disk_load(node_mapper &nodes,
      function get_node_loads (line 88) | std::unordered_map<dsn::rpc_address, disk_load>
      function generate_balancer_request (line 119) | std::shared_ptr<configuration_balancer_request>
      type flow_path (line 520) | struct flow_path
      function partition_set (line 656) | const partition_set *copy_replica_operation::get_all_partitions()
      function gpid (line 664) | gpid copy_replica_operation::select_max_load_gpid(const partition_se...
      function gpid (line 732) | gpid copy_replica_operation::select_partition(migration_list *result)
      type balance_type (line 787) | enum balance_type

FILE: src/meta/load_balance_policy.h
  type std (line 25) | typedef std::map<std::string, int> disk_load;
  type class (line 27) | enum class
  type flow_path (line 54) | struct flow_path
  function class (line 56) | class load_balance_policy
  type flow_path (line 121) | struct flow_path
  function class (line 136) | class ford_fulkerson

FILE: src/meta/meta_backup_service.cpp
  type dsn (line 30) | namespace dsn {
    type replication (line 31) | namespace replication {
      function policy (line 909) | policy policy_context::get_policy()
      function error_code (line 1108) | error_code backup_service::sync_policies_from_remote_storage()

FILE: src/meta/meta_backup_service.h
  function namespace (line 34) | namespace dsn {

FILE: src/meta/meta_bulk_load_ingestion_context.cpp
  type dsn (line 23) | namespace dsn {
    type replication (line 24) | namespace replication {

FILE: src/meta/meta_bulk_load_ingestion_context.h
  function namespace (line 23) | namespace dsn {

FILE: src/meta/meta_bulk_load_service.cpp
  type dsn (line 24) | namespace dsn {
    type replication (line 25) | namespace replication {
      function error_code (line 132) | error_code
      function erase_map_elem_by_id (line 1381) | inline void erase_map_elem_by_id(int32_t app_id, std::unordered_map<...

FILE: src/meta/meta_bulk_load_service.h
  function namespace (line 24) | namespace dsn {

FILE: src/meta/meta_data.cpp
  type dsn (line 43) | namespace dsn {
    type replication (line 44) | namespace replication {
      function when_update_replicas (line 81) | void when_update_replicas(config_type::type t, const std::function<v...
      function maintain_drops (line 99) | void maintain_drops(std::vector<rpc_address> &drops, const rpc_addre...
      function construct_replica (line 120) | bool construct_replica(meta_view view, const gpid &pid, int max_repl...
      function collect_replica (line 187) | bool collect_replica(meta_view view, const rpc_address &node, const ...
      function configuration_proposal_action (line 297) | const configuration_proposal_action *proposal_actions::front() const
      function partition_set (line 588) | const partition_set *node_state::get_partitions(int app_id, bool onl...
      function partition_set (line 603) | partition_set *node_state::get_partitions(app_id id, bool only_prima...
      function partition_set (line 622) | partition_set *node_state::partitions(app_id id, bool only_primary)
      function partition_set (line 627) | const partition_set *node_state::partitions(app_id id, bool only_pri...

FILE: src/meta/meta_data.h
  function config_status (line 57) | enum class config_status

FILE: src/meta/meta_http_service.cpp
  type dsn (line 36) | namespace dsn {
    type replication (line 37) | namespace replication {
      type list_nodes_helper (line 39) | struct list_nodes_helper
        method list_nodes_helper (line 45) | list_nodes_helper(const std::string &a, const std::string &s)
      function set_to_string (line 536) | std::string set_to_string(const std::set<int32_t> &s)

FILE: src/meta/meta_http_service.h
  function namespace (line 25) | namespace dsn {

FILE: src/meta/meta_options.cpp
  type dsn (line 39) | namespace dsn {
    type replication (line 40) | namespace replication {

FILE: src/meta/meta_options.h
  function namespace (line 40) | namespace dsn {

FILE: src/meta/meta_rpc_types.h
  function namespace (line 23) | namespace dsn {

FILE: src/meta/meta_server_failure_detector.cpp
  type dsn (line 47) | namespace dsn {
    type replication (line 48) | namespace replication {

FILE: src/meta/meta_server_failure_detector.h
  function namespace (line 44) | namespace dsn {

FILE: src/meta/meta_service.cpp
  type dsn (line 52) | namespace dsn {
    type replication (line 53) | namespace replication {
      function error_code (line 199) | error_code meta_service::remote_storage_initialize()
      function error_code (line 387) | error_code meta_service::start()

FILE: src/meta/meta_service.h
  function namespace (line 56) | namespace security {
  function namespace (line 67) | namespace test {
  function meta_op_status (line 73) | enum class meta_op_status

FILE: src/meta/meta_service_app.cpp
  type dsn (line 45) | namespace dsn {
    type service (line 46) | namespace service {
      function error_code (line 95) | error_code meta_service_app::start(const std::vector<std::string> &a...
      function error_code (line 104) | error_code meta_service_app::stop(bool /*cleanup*/)

FILE: src/meta/meta_split_service.cpp
  type dsn (line 25) | namespace dsn {
    type replication (line 26) | namespace replication {

FILE: src/meta/meta_split_service.h
  function namespace (line 21) | namespace dsn {

FILE: src/meta/meta_state_service_simple.cpp
  type dsn (line 38) | namespace dsn {
    type dist (line 39) | namespace dist {
      function error_code (line 50) | error_code meta_state_service_simple::extract_name_parent_from_path(...
      function __err_cb_bind_and_enqueue (line 66) | static void
      function error_code (line 110) | error_code meta_state_service_simple::create_node_internal(const std...
      function error_code (line 135) | error_code meta_state_service_simple::delete_node_internal(const std...
      function error_code (line 186) | error_code meta_state_service_simple::set_data_internal(const std::s...
      function error_code (line 197) | error_code meta_state_service_simple::apply_transaction(
      function error_code (line 226) | error_code meta_state_service_simple::initialize(const std::vector<s...
      function task_ptr (line 299) | task_ptr meta_state_service_simple::submit_transaction(
      function task_ptr (line 404) | task_ptr meta_state_service_simple::create_node(const std::string &n...
      function task_ptr (line 418) | task_ptr meta_state_service_simple::delete_node(const std::string &n...
      function task_ptr (line 432) | task_ptr meta_state_service_simple::node_exist(const std::string &node,
      function task_ptr (line 446) | task_ptr meta_state_service_simple::get_data(const std::string &node,
      function task_ptr (line 463) | task_ptr meta_state_service_simple::set_data(const std::string &node,
      function task_ptr (line 476) | task_ptr meta_state_service_simple::get_children(const std::string &...

FILE: src/meta/meta_state_service_simple.h
  function namespace (line 41) | namespace dsn {
  function write (line 226) | static void write(binary_writer &writer, const Head &head)
  function parse (line 230) | static void parse(binary_reader &reader, Head &head)
  type std (line 254) | typedef std::unordered_map<std::string, state_node *> quick_map;

FILE: src/meta/meta_state_service_utils.cpp
  type dsn (line 25) | namespace dsn {
    type replication (line 26) | namespace replication {
      type mss (line 27) | namespace mss {

FILE: src/meta/meta_state_service_utils.h
  function namespace (line 22) | namespace dsn {

FILE: src/meta/meta_state_service_utils_impl.h
  function namespace (line 25) | namespace dsn {

FILE: src/meta/meta_state_service_zookeeper.cpp
  type dsn (line 45) | namespace dsn {
    type dist (line 46) | namespace dist {
      class zoo_transaction (line 48) | class zoo_transaction : public meta_state_service::transaction_entries
        method packet (line 58) | std::shared_ptr<zookeeper_session::zoo_atomic_packet> packet() { r...
      function error_code (line 68) | error_code zoo_transaction::create_node(const std::string &path, con...
      function error_code (line 99) | error_code zoo_transaction::delete_node(const std::string &path)
      function error_code (line 117) | error_code zoo_transaction::set_data(const std::string &name, const ...
      function error_code (line 139) | error_code zoo_transaction::get_result(unsigned int entry_index)
      function error_code (line 157) | error_code meta_state_service_zookeeper::initialize(const std::vecto...
      function error_code (line 178) | error_code meta_state_service_zookeeper::finalize()
      function task_ptr (line 201) | task_ptr meta_state_service_zookeeper::create_node(const std::string...
      function task_ptr (line 218) | task_ptr meta_state_service_zookeeper::submit_transaction(
      function task_ptr (line 242) | task_ptr meta_state_service_zookeeper::delete_empty_node(const std::...
      function task_ptr (line 255) | task_ptr meta_state_service_zookeeper::delete_node(const std::string...
      function task_ptr (line 309) | task_ptr meta_state_service_zookeeper::get_data(const std::string &n...
      function task_ptr (line 323) | task_ptr meta_state_service_zookeeper::set_data(const std::string &n...
      function task_ptr (line 339) | task_ptr meta_state_service_zookeeper::node_exist(const std::string ...
      function task_ptr (line 353) | task_ptr meta_state_service_zookeeper::get_children(const std::strin...

FILE: src/meta/meta_state_service_zookeeper.h
  function namespace (line 43) | namespace dsn {

FILE: src/meta/partition_guardian.cpp
  type dsn (line 22) | namespace dsn {
    type replication (line 23) | namespace replication {
      function pc_status (line 44) | pc_status partition_guardian::cure(meta_view view,
      function pc_status (line 207) | pc_status partition_guardian::on_missing_primary(meta_view &view, co...
      function pc_status (line 473) | pc_status partition_guardian::on_missing_secondary(meta_view &view, ...
      function pc_status (line 623) | pc_status partition_guardian::on_redundant_secondary(meta_view &view...

FILE: src/meta/partition_guardian.h
  function namespace (line 22) | namespace dsn {

FILE: src/meta/server_load_balancer.cpp
  type dsn (line 34) | namespace dsn {
    type replication (line 35) | namespace replication {
      function newly_partitions (line 127) | newly_partitions *get_newly_partitions(node_mapper &mapper, const ds...
      class local_module_initializer (line 135) | class local_module_initializer
        method local_module_initializer (line 138) | local_module_initializer()

FILE: src/meta/server_load_balancer.h
  function namespace (line 51) | namespace dsn {

FILE: src/meta/server_state.cpp
  type dsn (line 58) | namespace dsn {
    type replication (line 59) | namespace replication {
      function error_code (line 310) | error_code server_state::dump_app_states(const char *local_path,
      function error_code (line 336) | error_code server_state::dump_from_remote_storage(const char *local_...
      function error_code (line 383) | error_code server_state::restore_from_local_storage(const char *loca...
      function error_code (line 441) | error_code server_state::initialize_default_apps()
      function error_code (line 491) | error_code server_state::sync_apps_to_remote_storage()
      function error_code (line 765) | error_code server_state::initialize_data_structure()
      function task_ptr (line 1580) | task_ptr server_state::update_configuration_on_remote(
      function error_code (line 2009) | error_code
      function error_code (line 2101) | error_code server_state::construct_partitions(
      function validate_target_max_replica_count_internal (line 2918) | bool validate_target_max_replica_count_internal(int32_t max_replica_...
      function task_ptr (line 3583) | task_ptr server_state::update_partition_max_replica_count_on_remote(

FILE: src/meta/server_state.h
  function namespace (line 50) | namespace dsn {

FILE: src/meta/server_state_restore.cpp
  type dsn (line 30) | namespace dsn {
    type replication (line 31) | namespace replication {

FILE: src/meta/test/backup_test.cpp
  type dsn (line 29) | namespace dsn {
    type replication (line 30) | namespace replication {
      type method_record (line 32) | struct method_record
        method method_record (line 40) | method_record() : event(), count(0), max_call_count(1000000), trig...
      class mock_base (line 43) | class mock_base
        method reset_records (line 46) | void reset_records() { _records.clear(); }
      class mock_policy (line 127) | class mock_policy : public policy_context, public mock_base
        method mock_policy (line 130) | mock_policy(backup_service *bs) : policy_context(bs) {}
        method start (line 138) | void start()
      class progress_liar (line 145) | class progress_liar : public meta_service
        method send_request (line 149) | virtual void send_request(dsn::message_ex *req,
        method check_progress (line 178) | int32_t check_progress(const gpid &pid)
      class policy_context_test (line 197) | class policy_context_test : public meta_test_base
        method policy_context_test (line 200) | policy_context_test() : _service(new progress_liar()), _mp(nullptr...
        method SetUp (line 202) | void SetUp() override
      function TEST_F (line 249) | TEST_F(policy_context_test, test_app_dropped_during_backup)
      function TEST_F (line 540) | TEST_F(policy_context_test, test_disable_backup_policy)
      function TEST_F (line 562) | TEST_F(policy_context_test, test_backup_failed)
      function TEST_F (line 596) | TEST_F(policy_context_test, test_should_start_backup)
      class meta_backup_service_test (line 705) | class meta_backup_service_test : public meta_test_base
        method meta_backup_service_test (line 708) | meta_backup_service_test() : _meta_svc(new fake_receiver_meta_serv...
        method SetUp (line 712) | void SetUp() override
      function TEST_F (line 733) | TEST_F(meta_backup_service_test, test_add_backup_policy)

FILE: src/meta/test/balancer_simulator/balancer_simulator.cpp
  class simple_priority_queue (line 52) | class simple_priority_queue
    method simple_priority_queue (line 55) | simple_priority_queue(const std::vector<dsn::rpc_address> &nl,
    method push (line 61) | void push(const dsn::rpc_address &addr)
    method pop (line 66) | dsn::rpc_address pop()
    method top (line 73) | dsn::rpc_address top() const { return container.front(); }
    method empty (line 74) | bool empty() const { return container.empty(); }
  function generate_balanced_apps (line 80) | void generate_balanced_apps(/*out*/ app_mapper &apps,
  function random_move_primary (line 150) | void random_move_primary(app_mapper &apps, node_mapper &nodes, int prima...
  function greedy_balancer_perfect_move_primary (line 165) | void greedy_balancer_perfect_move_primary()
  function main (line 195) | int main(int, char **)

FILE: src/meta/test/balancer_validator.cpp
  type dsn (line 44) | namespace dsn {
    type replication (line 45) | namespace replication {
      function check_cure (line 64) | static void check_cure(app_mapper &apps, node_mapper &nodes, ::dsn::...
      function get_rpc_address (line 282) | dsn::rpc_address get_rpc_address(const std::string &ip_port)
      function load_apps_and_nodes (line 289) | static void load_apps_and_nodes(const char *file, app_mapper &apps, ...

FILE: src/meta/test/cluster_balance_policy_test.cpp
  type dsn (line 23) | namespace dsn {
    type replication (line 24) | namespace replication {
      function TEST (line 26) | TEST(cluster_balance_policy, app_migration_info)
      function TEST (line 45) | TEST(cluster_balance_policy, node_migration_info)
      function TEST (line 72) | TEST(cluster_balance_policy, get_skew)
      function TEST (line 81) | TEST(cluster_balance_policy, get_partition_count)
      function TEST (line 94) | TEST(cluster_balance_policy, get_app_migration_info)
      function TEST (line 136) | TEST(cluster_balance_policy, get_node_migration_info)
      function TEST (line 177) | TEST(cluster_balance_policy, get_min_max_set)
      function TEST (line 195) | TEST(cluster_balance_policy, get_disk_partitions_map)
      function TEST (line 227) | TEST(cluster_balance_policy, get_max_load_disk_set)
      function TEST (line 277) | TEST(cluster_balance_policy, apply_move)
      function TEST (line 370) | TEST(cluster_balance_policy, pick_up_partition)
      function balance_func (line 435) | bool balance_func(const std::shared_ptr<app_state> &app, bool only_m...
      function TEST (line 440) | TEST(cluster_balance_policy, execute_balance)
      function TEST (line 484) | TEST(cluster_balance_policy, calc_potential_moving)

FILE: src/meta/test/copy_replica_operation_test.cpp
  type dsn (line 22) | namespace dsn {
    type replication (line 23) | namespace replication {
      function TEST (line 25) | TEST(copy_primary_operation, misc)
      function TEST (line 151) | TEST(copy_primary_operation, can_select)
      function TEST (line 168) | TEST(copy_primary_operation, only_copy_primary)
      function TEST (line 179) | TEST(copy_secondary_operation, misc)

FILE: src/meta/test/dummy_balancer.h
  function namespace (line 23) | namespace dsn {

FILE: src/meta/test/dump_file.cpp
  function TEST (line 30) | TEST(dump_file, read_write)

FILE: src/meta/test/duplication_info_test.cpp
  type dsn (line 32) | namespace dsn {
    type replication (line 33) | namespace replication {
      class duplication_info_test (line 35) | class duplication_info_test : public testing::Test
        method force_update_status (line 38) | void force_update_status(duplication_info &dup, duplication_status...
        method test_alter_progress (line 43) | static void test_alter_progress()
        method test_init_and_start (line 97) | static void test_init_and_start()
        method test_persist_status (line 127) | static void test_persist_status()
        method test_encode_and_decode (line 145) | static void test_encode_and_decode()
      function TEST_F (line 180) | TEST_F(duplication_info_test, alter_status_when_busy)
      function TEST_F (line 195) | TEST_F(duplication_info_test, alter_status)
      function TEST_F (line 274) | TEST_F(duplication_info_test, alter_progress) { test_alter_progress(...
      function TEST_F (line 276) | TEST_F(duplication_info_test, persist_status) { test_persist_status(...
      function TEST_F (line 278) | TEST_F(duplication_info_test, init_and_start) { test_init_and_start(...
      function TEST_F (line 280) | TEST_F(duplication_info_test, encode_and_decode) { test_encode_and_d...
      function TEST_F (line 282) | TEST_F(duplication_info_test, is_valid)

FILE: src/meta/test/ford_fulkerson_test.cpp
  type dsn (line 21) | namespace dsn {
    type replication (line 22) | namespace replication {
      function TEST (line 23) | TEST(ford_fulkerson, build_failure)
      function TEST (line 43) | TEST(ford_fulkerson, add_edge)
      function TEST (line 76) | TEST(ford_fulkerson, update_decree)
      function TEST (line 113) | TEST(ford_fulkerson, find_shortest_path)
      function TEST (line 204) | TEST(ford_fulkerson, max_value_pos)
      function TEST (line 242) | TEST(ford_fulkerson, select_node)

FILE: src/meta/test/json_compacity.cpp
  type dsn (line 37) | namespace dsn {
    type replication (line 38) | namespace replication {

FILE: src/meta/test/main.cpp
  type dsn (line 30) | namespace dsn {
    type replication (line 31) | namespace replication {
      function TEST (line 49) | TEST(meta, state_sync) { g_app->state_sync_test(); }
      function TEST (line 51) | TEST(meta, update_configuration) { g_app->update_configuration_test(...
      function TEST (line 53) | TEST(meta, balancer_validator) { g_app->balancer_validator(); }
      function TEST (line 55) | TEST(meta, apply_balancer) { g_app->apply_balancer_test(); }
      function TEST (line 57) | TEST(meta, cannot_run_balancer_test) { g_app->cannot_run_balancer_te...
      function TEST (line 59) | TEST(meta, construct_apps_test) { g_app->construct_apps_test(); }
      function TEST (line 61) | TEST(meta, balance_config_file) { g_app->balance_config_file(); }
      function TEST (line 63) | TEST(meta, json_compacity) { g_app->json_compacity(); }
      function TEST (line 65) | TEST(meta, adjust_dropped_size) { g_app->adjust_dropped_size(); }
      function TEST (line 67) | TEST(meta, app_envs_basic_test) { g_app->app_envs_basic_test(); }
  function GTEST_API_ (line 94) | GTEST_API_ int main(int argc, char **argv)

FILE: src/meta/test/meta_app_envs_test.cpp
  type dsn (line 32) | namespace dsn {
    type replication (line 33) | namespace replication {
      class meta_app_envs_test (line 34) | class meta_app_envs_test : public meta_test_base
        method meta_app_envs_test (line 37) | meta_app_envs_test() {}
        method SetUp (line 39) | void SetUp() override
        method TearDown (line 45) | void TearDown() override { drop_app(app_name); }
      function TEST_F (line 50) | TEST_F(meta_app_envs_test, update_app_envs_test)

FILE: src/meta/test/meta_app_operation_test.cpp
  type dsn (line 29) | namespace dsn {
    type replication (line 30) | namespace replication {
      class meta_app_operation_test (line 36) | class meta_app_operation_test : public meta_test_base
        method meta_app_operation_test (line 39) | meta_app_operation_test() {}
        method error_code (line 41) | error_code create_app_test(int32_t partition_count,
        method error_code (line 60) | error_code drop_app_test(const std::string &app_name)
        method error_code (line 75) | error_code recall_app_test(const std::string &new_app_name, int32_...
        method update_app_status (line 90) | void update_app_status(app_status::type status)
        method drop_app_with_expired (line 96) | void drop_app_with_expired()
        method clear_nodes (line 108) | void clear_nodes() { _ss->_nodes.clear(); }
        method configuration_get_max_replica_count_response (line 110) | configuration_get_max_replica_count_response get_max_replica_count...
        method set_partition_max_replica_count (line 122) | void set_partition_max_replica_count(const std::string &app_name,
        method set_max_replica_count_env (line 133) | void set_max_replica_count_env(const std::string &app_name, const ...
        method configuration_set_max_replica_count_response (line 157) | configuration_set_max_replica_count_response set_max_replica_count...
        method set_app_and_all_partitions_max_replica_count (line 171) | void set_app_and_all_partitions_max_replica_count(const std::strin...
        method verify_all_partitions_max_replica_count (line 212) | void verify_all_partitions_max_replica_count(const std::string &ap...
        method verify_app_max_replica_count (line 246) | void verify_app_max_replica_count(const std::string &app_name,
      function TEST_F (line 284) | TEST_F(meta_app_operation_test, create_app)
      function TEST_F (line 475) | TEST_F(meta_app_operation_test, drop_app)
      function TEST_F (line 505) | TEST_F(meta_app_operation_test, recall_app)
      function TEST_F (line 551) | TEST_F(meta_app_operation_test, get_max_replica_count)
      function TEST_F (line 595) | TEST_F(meta_app_operation_test, set_max_replica_count)
      function TEST_F (line 786) | TEST_F(meta_app_operation_test, recover_from_max_replica_count_env)

FILE: src/meta/test/meta_backup_test.cpp
  type dsn (line 28) | namespace dsn {
    type replication (line 29) | namespace replication {
      class backup_service_test (line 31) | class backup_service_test : public meta_test_base
        method backup_service_test (line 34) | backup_service_test()
        method SetUp (line 42) | void SetUp() override
        method start_backup_app_response (line 53) | start_backup_app_response
        method query_backup_status_response (line 69) | query_backup_status_response query_backup(int32_t app_id, int64_t ...
        method write_metadata_succeed (line 82) | bool write_metadata_succeed(int32_t app_id,
        method test_specific_backup_path (line 99) | void test_specific_backup_path(int32_t test_app_id, const std::str...
      function TEST_F (line 124) | TEST_F(backup_service_test, test_invalid_backup_request)
      function TEST_F (line 136) | TEST_F(backup_service_test, test_init_backup)
      function TEST_F (line 152) | TEST_F(backup_service_test, test_write_backup_metadata_failed)
      function TEST_F (line 164) | TEST_F(backup_service_test, test_backup_app_with_no_specific_path) {...
      function TEST_F (line 166) | TEST_F(backup_service_test, test_backup_app_with_user_specified_path)
      function TEST_F (line 171) | TEST_F(backup_service_test, test_query_backup_status)
      class backup_engine_test (line 189) | class backup_engine_test : public meta_test_base
        method backup_engine_test (line 192) | backup_engine_test()
        method SetUp (line 202) | void SetUp() override
        method mock_backup_app_partitions (line 221) | void mock_backup_app_partitions()
        method mock_on_backup_reply (line 229) | void mock_on_backup_reply(int32_t partition_index,
        method mock_on_backup_reply_when_timeout (line 246) | void mock_on_backup_reply_when_timeout(int32_t partition_index, er...
        method is_backup_failed (line 254) | bool is_backup_failed() const
        method reset_backup_engine (line 260) | void reset_backup_engine()
      function TEST_F (line 275) | TEST_F(backup_engine_test, test_on_backup_reply)
      function TEST_F (line 321) | TEST_F(backup_engine_test, test_backup_completed)
      function TEST_F (line 334) | TEST_F(backup_engine_test, test_write_backup_info_failed)

FILE: src/meta/test/meta_bulk_load_ingestion_test.cpp
  type dsn (line 27) | namespace dsn {
    type replication (line 28) | namespace replication {
      class node_context_test (line 30) | class node_context_test : public meta_test_base
        method SetUp (line 33) | void SetUp()
        method TearDown (line 42) | void TearDown()
        method mock_context (line 48) | void mock_context(const std::string &disk_tag,
        method init_disk (line 56) | void init_disk(const std::string &disk_tag) { _context.init_disk(d...
        method get_disk_count (line 58) | uint32_t get_disk_count(const std::string &disk_tag)
        method mock_get_max_disk_ingestion_count (line 66) | void mock_get_max_disk_ingestion_count(const uint32_t node_min_dis...
        method get_max_disk_ingestion_count (line 76) | uint32_t get_max_disk_ingestion_count(const uint32_t max_node_coun...
        method check_if_add (line 81) | bool check_if_add() { return _context.check_if_add(TAG); }
      function TEST_F (line 90) | TEST_F(node_context_test, init_disk_test)
      function TEST_F (line 104) | TEST_F(node_context_test, get_max_disk_ingestion_count_test)
      function TEST_F (line 132) | TEST_F(node_context_test, check_if_add_test)
      class ingestion_context_test (line 153) | class ingestion_context_test : public meta_test_base
        method SetUp (line 162) | void SetUp()
        method TearDown (line 171) | void TearDown() { _context->reset_all(); }
        method update_max_node_count (line 173) | void update_max_node_count(const uint32_t max_node_count)
        method check_node_ingestion (line 178) | bool check_node_ingestion(const uint32_t max_node_count,
        method mock_app (line 189) | void mock_app()
        method mock_partition (line 219) | void mock_partition(const uint32_t pidx,
        method add_node_context (line 239) | void add_node_context(std::vector<rpc_address> nodes)
        method try_partition_ingestion (line 248) | bool try_partition_ingestion(const uint32_t pidx)
        method add_partition (line 254) | void add_partition(const uint32_t pidx)
        method remove_partition (line 261) | void remove_partition(const uint32_t pidx) { _context->remove_part...
        method is_partition_ingesting (line 263) | bool is_partition_ingesting(const uint32_t pidx) const
        method get_app_ingesting_count (line 269) | uint32_t get_app_ingesting_count() const { return _context->get_ap...
        method reset_app (line 271) | void reset_app() { return _context->reset_app(APP_ID); }
        method get_node_running_count (line 273) | int32_t get_node_running_count(const rpc_address &node)
        method get_disk_running_count (line 281) | uint32_t get_disk_running_count(const rpc_address &node, const std...
        method validate_count (line 293) | bool validate_count(const rpc_address &node,
      function TEST_F (line 318) | TEST_F(ingestion_context_test, check_node_ingestion_test)
      function TEST_F (line 333) | TEST_F(ingestion_context_test, try_partition_ingestion_test)
      function TEST_F (line 351) | TEST_F(ingestion_context_test, operation_test)

FILE: src/meta/test/meta_bulk_load_service_test.cpp
  type dsn (line 29) | namespace dsn {
    type replication (line 30) | namespace replication {
      class bulk_load_service_test (line 31) | class bulk_load_service_test : public meta_test_base
        method bulk_load_service_test (line 34) | bulk_load_service_test() {}
        method start_bulk_load_response (line 38) | start_bulk_load_response start_bulk_load(const std::string &app_name)
        method error_code (line 52) | error_code check_start_bulk_load_request_params(const std::string ...
        method validate_ingest_behind (line 68) | bool validate_ingest_behind(bool mock_value, const std::string &ap...
        method error_code (line 77) | error_code control_bulk_load(int32_t app_id,
        method error_code (line 93) | error_code query_bulk_load(const std::string &app_name)
        method error_code (line 104) | error_code
        method mock_meta_bulk_load_context (line 118) | void mock_meta_bulk_load_context(int32_t app_id,
        method mock_partition_bulk_load (line 135) | void mock_partition_bulk_load(const std::string &app_name, const g...
        method gpid (line 140) | gpid before_check_partition_status(bulk_load_status::type status)
        method check_partition_status (line 156) | bool check_partition_status(const std::string name,
        method set_partition_bulk_load_info (line 180) | void set_partition_bulk_load_info(const gpid &pid,
        method test_check_ever_ingestion (line 197) | bool test_check_ever_ingestion(const gpid &pid,
        method on_partition_bulk_load_reply (line 223) | void on_partition_bulk_load_reply(error_code err,
        method app_is_bulk_loading (line 230) | bool app_is_bulk_loading(const std::string &app_name)
        method need_update_metadata (line 235) | bool need_update_metadata(gpid pid)
        method get_app_bulk_load_status (line 240) | bulk_load_status::type get_app_bulk_load_status(int32_t app_id)
        method partition_bulk_load_info (line 245) | const partition_bulk_load_info &get_partition_bulk_load_info(const...
        method get_partition_bulk_load_status (line 250) | bulk_load_status::type get_partition_bulk_load_status(const gpid &...
        method error_code (line 255) | error_code get_app_bulk_load_err(int32_t app_id)
        method test_on_partition_ingestion_reply (line 260) | void test_on_partition_ingestion_reply(ingestion_response &resp,
        method reset_local_bulk_load_states (line 268) | void reset_local_bulk_load_states(int32_t app_id, const std::strin...
        method get_app_in_process_count (line 273) | int32_t get_app_in_process_count(int32_t app_id)
        method set_app_ingesting_count (line 279) | void set_app_ingesting_count(int32_t app_id, int32_t count)
        method get_app_ingesting_count (line 290) | int32_t get_app_ingesting_count(int32_t app_id)
        method initialize_meta_server_with_mock_bulk_load (line 297) | void initialize_meta_server_with_mock_bulk_load(
        method mock_bulk_load_on_remote_storage (line 332) | void mock_bulk_load_on_remote_storage(
        method mock_app_bulk_load_info_on_remote_storage (line 365) | void mock_app_bulk_load_info_on_remote_storage(
        method mock_partition_bulk_load_info_on_remote_storage (line 388) | void mock_partition_bulk_load_info_on_remote_storage(const gpid &pid,
        method mock_app_on_remote_storage (line 402) | void mock_app_on_remote_storage(const app_info &info)
        method get_app_id_set_size (line 446) | int32_t get_app_id_set_size() { return bulk_svc()._bulk_load_app_i...
        method get_partition_bulk_load_info_size (line 448) | int32_t get_partition_bulk_load_info_size(int32_t app_id)
        method is_app_bulk_load_states_reset (line 459) | bool is_app_bulk_load_states_reset(int32_t app_id)
        method meta_op_status (line 464) | meta_op_status get_op_status() { return _ms->get_op_status(); }
        method unlock_meta_op_status (line 466) | void unlock_meta_op_status() { return _ms->unlock_meta_op_status(); }
      function TEST_F (line 482) | TEST_F(bulk_load_service_test, start_bulk_load_with_not_existed_app)
      function TEST_F (line 490) | TEST_F(bulk_load_service_test, start_bulk_load_with_wrong_provider)
      function TEST_F (line 499) | TEST_F(bulk_load_service_test, start_bulk_load_succeed)
      function TEST_F (line 517) | TEST_F(bulk_load_service_test, check_partition_status_app_wrong_test)
      function TEST_F (line 533) | TEST_F(bulk_load_service_test, check_partition_status_test)
      function TEST_F (line 574) | TEST_F(bulk_load_service_test, validate_ingest_behind_test)
      function TEST_F (line 597) | TEST_F(bulk_load_service_test, check_ever_ingestion_test)
      function TEST_F (line 632) | TEST_F(bulk_load_service_test, control_bulk_load_test)
      function TEST_F (line 664) | TEST_F(bulk_load_service_test, query_bulk_load_status_with_wrong_state)
      function TEST_F (line 670) | TEST_F(bulk_load_service_test, query_bulk_load_status_success)
      function TEST_F (line 679) | TEST_F(bulk_load_service_test, clear_bulk_load_test)
      class bulk_load_process_test (line 708) | class bulk_load_process_test : public bulk_load_service_test
        method SetUp (line 711) | void SetUp()
        method TearDown (line 729) | void TearDown()
        method create_request (line 736) | void create_request(bulk_load_status::type status)
        method create_basic_response (line 746) | void create_basic_response(error_code err, bulk_load_status::type ...
        method mock_response_progress (line 754) | void mock_response_progress(error_code progress_err, bool finish_d...
        method mock_response_bulk_load_metadata (line 772) | void mock_response_bulk_load_metadata()
        method mock_response_ingestion_status (line 788) | void mock_response_ingestion_status(ingestion_status::type seconda...
        method mock_response_cleaned_up_flag (line 804) | void mock_response_cleaned_up_flag(bool all_cleaned_up, bulk_load_...
        method mock_response_paused (line 818) | void mock_response_paused(bool is_group_paused)
        method test_on_partition_bulk_load_reply (line 832) | void test_on_partition_bulk_load_reply(int32_t in_progress_count,
        method mock_ingestion_context (line 845) | void mock_ingestion_context(error_code err,
      function TEST_F (line 868) | TEST_F(bulk_load_process_test, downloading_fs_error)
      function TEST_F (line 876) | TEST_F(bulk_load_process_test, downloading_busy)
      function TEST_F (line 883) | TEST_F(bulk_load_process_test, downloading_corrupt)
      function TEST_F (line 891) | TEST_F(bulk_load_process_test, downloading_report_metadata)
      function TEST_F (line 900) | TEST_F(bulk_load_process_test, normal_downloading)
      function TEST_F (line 907) | TEST_F(bulk_load_process_test, downloaded_succeed)
      function TEST_F (line 914) | TEST_F(bulk_load_process_test, start_ingesting)
      function TEST_F (line 922) | TEST_F(bulk_load_process_test, ingestion_running)
      function TEST_F (line 930) | TEST_F(bulk_load_process_test, ingestion_error)
      function TEST_F (line 939) | TEST_F(bulk_load_process_test, ingestion_one_succeed)
      function TEST_F (line 951) | TEST_F(bulk_load_process_test, ingestion_one_succeed_update)
      function TEST_F (line 967) | TEST_F(bulk_load_process_test, normal_succeed)
      function TEST_F (line 976) | TEST_F(bulk_load_process_test, succeed_not_all_finished)
      function TEST_F (line 984) | TEST_F(bulk_load_process_test, succeed_all_finished)
      function TEST_F (line 992) | TEST_F(bulk_load_process_test, cancel_not_all_finished)
      function TEST_F (line 999) | TEST_F(bulk_load_process_test, cancel_all_finished)
      function TEST_F (line 1006) | TEST_F(bulk_load_process_test, failed_not_all_finished)
      function TEST_F (line 1014) | TEST_F(bulk_load_process_test, failed_all_finished)
      function TEST_F (line 1022) | TEST_F(bulk_load_process_test, pausing)
      function TEST_F (line 1029) | TEST_F(bulk_load_process_test, pause_succeed)
      function TEST_F (line 1036) | TEST_F(bulk_load_process_test, rpc_error)
      function TEST_F (line 1046) | TEST_F(bulk_load_process_test, response_invalid_state)
      function TEST_F (line 1054) | TEST_F(bulk_load_process_test, response_object_not_found)
      function TEST_F (line 1062) | TEST_F(bulk_load_process_test, rollback_count_exceed)
      function TEST_F (line 1071) | TEST_F(bulk_load_process_test, response_ingestion_error)
      function TEST_F (line 1082) | TEST_F(bulk_load_process_test, ingest_rpc_error)
      function TEST_F (line 1090) | TEST_F(bulk_load_process_test, repeated_ingest_rpc)
      function TEST_F (line 1098) | TEST_F(bulk_load_process_test, ingest_wrong_state)
      function TEST_F (line 1106) | TEST_F(bulk_load_process_test, ingest_empty_write_error)
      function TEST_F (line 1115) | TEST_F(bulk_load_process_test, ingest_wrong)
      function TEST_F (line 1125) | TEST_F(bulk_load_process_test, ingest_succeed)
      class bulk_load_failover_test (line 1133) | class bulk_load_failover_test : public bulk_load_service_test
        method bulk_load_failover_test (line 1136) | bulk_load_failover_test() {}
        method SetUp (line 1138) | void SetUp()
        method TearDown (line 1145) | void TearDown()
        method try_to_continue_bulk_load (line 1152) | void try_to_continue_bulk_load(bulk_load_status::type app_status, ...
        method prepare_bulk_load_structures (line 1166) | void
        method mock_app_bulk_load_info (line 1180) | void mock_app_bulk_load_info(int32_t app_id,
        method mock_partition_bulk_load_info (line 1199) | void
        method add_to_app_info_list (line 1215) | void add_to_app_info_list(int32_t app_id,
        method mock_pstatus_map (line 1232) | void mock_pstatus_map(bulk_load_status::type status, int32_t end_i...
        method clean_up (line 1239) | void clean_up()
      function TEST_F (line 1260) | TEST_F(bulk_load_failover_test, sync_bulk_load)
      function TEST_F (line 1304) | TEST_F(bulk_load_failover_test, app_info_inconsistency)
      function TEST_F (line 1321) | TEST_F(bulk_load_failover_test, app_downloading_test)
      function TEST_F (line 1361) | TEST_F(bulk_load_failover_test, app_downloaded_test)
      function TEST_F (line 1399) | TEST_F(bulk_load_failover_test, app_ingesting_test)
      function TEST_F (line 1440) | TEST_F(bulk_load_failover_test, app_succeed_test)
      function TEST_F (line 1470) | TEST_F(bulk_load_failover_test, app_pausing_test)
      function TEST_F (line 1511) | TEST_F(bulk_load_failover_test, app_paused_test)
      function TEST_F (line 1542) | TEST_F(bulk_load_failover_test, app_failed_test)
      function TEST_F (line 1574) | TEST_F(bulk_load_failover_test, app_cancel_test)
      function TEST_F (line 1607) | TEST_F(bulk_load_failover_test, status_inconsistency_wrong_app_flag)
      function TEST_F (line 1619) | TEST_F(bulk_load_failover_test, status_inconsistency_wrong_bulk_load...

FILE: src/meta/test/meta_data.cpp
  function TEST (line 33) | TEST(meta_data, dropped_cmp)
  function vec_equal (line 79) | static bool vec_equal(const std::vector<dropped_replica> &vec1,
  function TEST (line 99) | TEST(meta_data, collect_replica)
  function TEST (line 342) | TEST(meta_data, construct_replica)

FILE: src/meta/test/meta_duplication_service_test.cpp
  type dsn (line 42) | namespace dsn {
    type replication (line 43) | namespace replication {
      class meta_duplication_service_test (line 45) | class meta_duplication_service_test : public meta_test_base
        method meta_duplication_service_test (line 48) | meta_duplication_service_test() {}
        method duplication_add_response (line 50) | duplication_add_response create_dup(const std::string &app_name,
        method duplication_query_response (line 64) | duplication_query_response query_dup_info(const std::string &app_n...
        method duplication_modify_response (line 75) | duplication_modify_response
        method duplication_modify_response (line 90) | duplication_modify_response
        method duplication_sync_response (line 105) | duplication_sync_response
        method recover_from_meta_state (line 120) | void recover_from_meta_state()
        method create_follower_app_for_duplication (line 126) | void create_follower_app_for_duplication(const std::shared_ptr<dup...
        method check_follower_app_if_create_completed (line 132) | void check_follower_app_if_create_completed(const std::shared_ptr<...
        method next_status (line 137) | duplication_status::type next_status(const std::shared_ptr<duplica...
        method force_update_dup_status (line 142) | void force_update_dup_status(const std::shared_ptr<duplication_inf...
        method test_new_dup_from_init (line 150) | void test_new_dup_from_init()
        method test_recover_from_meta_state (line 179) | void test_recover_from_meta_state()
        method mock_test_case_and_recover (line 239) | std::shared_ptr<app_state> mock_test_case_and_recover(std::vector<...
        method test_recover_from_corrupted_meta_data (line 267) | void test_recover_from_corrupted_meta_data()
        method test_add_duplication (line 332) | void test_add_duplication()
      function TEST_F (line 385) | TEST_F(meta_duplication_service_test, dup_op_upon_unavail_app)
      function TEST_F (line 418) | TEST_F(meta_duplication_service_test, add_duplication) { test_add_du...
      function TEST_F (line 422) | TEST_F(meta_duplication_service_test, dont_create_if_existed)
      function TEST_F (line 444) | TEST_F(meta_duplication_service_test, change_duplication_status)
      function TEST_F (line 478) | TEST_F(meta_duplication_service_test, new_dup_from_init) { test_new_...
      function TEST_F (line 480) | TEST_F(meta_duplication_service_test, remove_dup)
      function TEST_F (line 515) | TEST_F(meta_duplication_service_test, duplication_sync)
      function TEST_F (line 623) | TEST_F(meta_duplication_service_test, recover_from_meta_state) { tes...
      function TEST_F (line 625) | TEST_F(meta_duplication_service_test, query_duplication_info)
      function TEST_F (line 648) | TEST_F(meta_duplication_service_test, re_add_duplication)
      function TEST_F (line 686) | TEST_F(meta_duplication_service_test, recover_from_corrupted_meta_data)
      function TEST_F (line 691) | TEST_F(meta_duplication_service_test, query_duplication_handler)
      function TEST_F (line 721) | TEST_F(meta_duplication_service_test, fail_mode)
      function TEST_F (line 770) | TEST_F(meta_duplication_service_test, create_follower_app_for_duplic...
      function TEST_F (line 816) | TEST_F(meta_duplication_service_test, check_follower_app_if_create_c...

FILE: src/meta/test/meta_http_service_test.cpp
  type dsn (line 30) | namespace dsn {
    type replication (line 31) | namespace replication {
      class meta_http_service_test (line 33) | class meta_http_service_test : public meta_test_base
        method SetUp (line 36) | void SetUp() override
        method test_get_app_from_primary (line 46) | void test_get_app_from_primary()
        method test_get_app_envs (line 60) | void test_get_app_envs()
      class meta_backup_test_base (line 85) | class meta_backup_test_base : public meta_test_base
        method SetUp (line 88) | void SetUp() override
        method add_backup_policy (line 111) | void add_backup_policy(const std::string &policy_name)
        method test_get_backup_policy (line 134) | void test_get_backup_policy(const std::string &name,
      function TEST_F (line 154) | TEST_F(meta_http_service_test, get_app_from_primary) { test_get_app_...
      function TEST_F (line 156) | TEST_F(meta_http_service_test, get_app_envs) { test_get_app_envs(); }
      function TEST_F (line 158) | TEST_F(meta_backup_test_base, get_backup_policy)
      class meta_bulk_load_http_test (line 195) | class meta_bulk_load_http_test : public meta_test_base
        method SetUp (line 198) | void SetUp() override
        method TearDown (line 206) | void TearDown() override
        method http_response (line 213) | http_response test_start_bulk_load(std::string req_body_json)
        method test_query_bulk_load (line 222) | std::string test_query_bulk_load(const std::string &app_name)
        method http_response (line 231) | http_response test_start_compaction(std::string req_body_json)
        method http_response (line 240) | http_response test_update_scenario(std::string req_body_json)
        method mock_bulk_load_context (line 249) | void mock_bulk_load_context(const bulk_load_status::type &status)
        method reset_local_bulk_load_states (line 263) | void reset_local_bulk_load_states()
      function TEST_F (line 275) | TEST_F(meta_bulk_load_http_test, start_bulk_load_request)
      function TEST_F (line 307) | TEST_F(meta_bulk_load_http_test, query_bulk_load_request)
      function TEST_F (line 333) | TEST_F(meta_bulk_load_http_test, start_compaction_test)
      function TEST_F (line 371) | TEST_F(meta_bulk_load_http_test, update_scenario_test)

FILE: src/meta/test/meta_mauanl_compaction_test.cpp
  type dsn (line 23) | namespace dsn {
    type replication (line 24) | namespace replication {
      class meta_app_compaction_test (line 25) | class meta_app_compaction_test : public meta_test_base
        method meta_app_compaction_test (line 28) | meta_app_compaction_test() {}
        method SetUp (line 30) | void SetUp() override
        method prepare (line 36) | void prepare()
        method error_code (line 53) | error_code start_manual_compaction(std::string app_name,
        method check_after_start_compaction (line 79) | void check_after_start_compaction(std::string bottommost,
        method query_app_manual_compact_response (line 106) | query_app_manual_compact_response query_manual_compaction(int32_t ...
      function TEST_F (line 143) | TEST_F(meta_app_compaction_test, test_start_compaction)
      function TEST_F (line 177) | TEST_F(meta_app_compaction_test, test_query_compaction)

FILE: src/meta/test/meta_partition_guardian_test.cpp
  type dsn (line 44) | namespace dsn {
    type replication (line 45) | namespace replication {
      function apply_update_request (line 50) | static void apply_update_request(/*in-out*/ configuration_update_req...
      class meta_partition_guardian_test (line 94) | class meta_partition_guardian_test : public meta_test_base
        method call_update_configuration (line 101) | void call_update_configuration(
      class message_filter (line 118) | class message_filter : public dsn::replication::meta_service
        method message_filter (line 122) | message_filter(meta_partition_guardian_test *app) : meta_service()...
        method set_filter (line 123) | void set_filter(const filter &f) { _filter = f; }
        method reply_message (line 124) | virtual void reply_message(dsn::message_ex *request, dsn::message_...
        method send_message (line 129) | virtual void send_message(const dsn::rpc_address &target, dsn::mes...
      function check_nodes_loads (line 732) | static void check_nodes_loads(node_mapper &nodes)

FILE: src/meta/test/meta_service_test.cpp
  type dsn (line 24) | namespace dsn {
    type replication (line 25) | namespace replication {
      class meta_service_test (line 27) | class meta_service_test : public meta_test_base
        method check_status_failure (line 30) | void check_status_failure()
        method check_status_success (line 62) | void check_status_success()
        method check_op_status_lock (line 79) | void check_op_status_lock()
        method app_env_rpc (line 103) | app_env_rpc create_fake_rpc()
      function TEST_F (line 117) | TEST_F(meta_service_test, check_status_failure) { check_status_failu...
      function TEST_F (line 119) | TEST_F(meta_service_test, check_status_success) { check_status_succe...
      function TEST_F (line 121) | TEST_F(meta_service_test, check_op_status_lock) { check_op_status_lo...

FILE: src/meta/test/meta_service_test_app.h
  function namespace (line 39) | namespace dsn {

FILE: src/meta/test/meta_split_service_test.cpp
  type dsn (line 37) | namespace dsn {
    type replication (line 38) | namespace replication {
      class meta_split_service_test (line 39) | class meta_split_service_test : public meta_test_base
        method meta_split_service_test (line 42) | meta_split_service_test() {}
        method SetUp (line 44) | void SetUp() override
        method TearDown (line 51) | void TearDown()
        method error_code (line 57) | error_code start_partition_split(const std::string &app_name, int ...
        method query_split_response (line 69) | query_split_response query_partition_split(const std::string &app_...
        method error_code (line 80) | error_code control_partition_split(const std::string &app_name,
        method error_code (line 98) | error_code register_child(int32_t parent_index, ballot req_parent_...
        method error_code (line 132) | error_code notify_stop_split(split_status::type req_split_status)
        method query_child_state_response (line 147) | query_child_state_response query_child_state()
        method on_config_sync (line 161) | int32_t on_config_sync(configuration_query_by_node_request req)
        method mock_app_partition_split_context (line 176) | void mock_app_partition_split_context()
        method clear_app_partition_split_context (line 195) | void clear_app_partition_split_context()
        method mock_only_one_partition_split (line 204) | void mock_only_one_partition_split(split_status::type split_status)
        method mock_child_registered (line 223) | void mock_child_registered()
        method mock_split_states (line 230) | void mock_split_states(split_status::type status, int32_t parent_i...
        method check_split_status (line 242) | bool check_split_status(split_status::type expected_status, int32_...
        method initialize_meta_server_with_mock_app (line 257) | void initialize_meta_server_with_mock_app()
        method create_splitting_app_on_remote_stroage (line 280) | void create_splitting_app_on_remote_stroage(const std::string &app...
        method create_partition_configuration_on_remote_storage (line 323) | void create_partition_configuration_on_remote_storage(const std::s...
      function TEST_F (line 352) | TEST_F(meta_split_service_test, start_split_test)
      function TEST_F (line 384) | TEST_F(meta_split_service_test, query_split_test)
      function TEST_F (line 418) | TEST_F(meta_split_service_test, register_child_test)
      function TEST_F (line 459) | TEST_F(meta_split_service_test, on_config_sync_test)
      function TEST_F (line 506) | TEST_F(meta_split_service_test, pause_or_restart_single_partition_test)
      function TEST_F (line 599) | TEST_F(meta_split_service_test, pause_or_restart_multi_partitions_test)
      function TEST_F (line 639) | TEST_F(meta_split_service_test, cancel_split_test)
      function TEST_F (line 675) | TEST_F(meta_split_service_test, notify_stop_split_test)
      function TEST_F (line 768) | TEST_F(meta_split_service_test, query_child_state_test)
      class meta_split_service_failover_test (line 800) | class meta_split_service_failover_test : public meta_split_service_test
        method SetUp (line 803) | void SetUp() {}
        method TearDown (line 804) | void TearDown() { meta_test_base::TearDown(); }
      function TEST_F (line 807) | TEST_F(meta_split_service_failover_test, half_split_test)

FILE: src/meta/test/meta_state/main.cpp
  class test_client (line 49) | class test_client : public ::dsn::service_app
    method test_client (line 52) | test_client(const dsn::service_app_info *info) : ::dsn::service_app(in...
    method start (line 54) | ::dsn::error_code start(const std::vector<std::string> &args)
    method stop (line 75) | ::dsn::error_code stop(bool cleanup = false) { return ::dsn::ERR_OK; }
  function GTEST_API_ (line 78) | GTEST_API_ int main(int argc, char **argv)

FILE: src/meta/test/meta_state/meta_state_service.cpp
  function provider_basic_test (line 48) | void provider_basic_test(const service_creator_func &service_creator,
  function recursively_create_node_callback (line 224) | void recursively_create_node_callback(meta_state_service *service,
  function provider_recursively_create_delete_test (line 249) | void provider_recursively_create_delete_test(const service_creator_func ...
  function TEST (line 277) | TEST(meta_state_service, simple)
  function TEST (line 290) | TEST(meta_state_service, zookeeper)

FILE: src/meta/test/meta_state_service_utils_test.cpp
  type meta_state_service_utils_test (line 37) | struct meta_state_service_utils_test : ::testing::Test
    method SetUp (line 39) | void SetUp() override
    method TearDown (line 50) | void TearDown() override
  function TEST_F (line 62) | TEST_F(meta_state_service_utils_test, create_recursively)
  function TEST_F (line 86) | TEST_F(meta_state_service_utils_test, delete_and_get)
  function TEST_F (line 98) | TEST_F(meta_state_service_utils_test, delete_recursively)
  function TEST_F (line 114) | TEST_F(meta_state_service_utils_test, concurrent)
  function TEST_F (line 145) | TEST_F(meta_state_service_utils_test, get_children)

FILE: src/meta/test/meta_test_base.cpp
  type dsn (line 30) | namespace dsn {
    type replication (line 31) | namespace replication {
      function configuration_update_app_env_response (line 204) | configuration_update_app_env_response
      function meta_duplication_service (line 226) | meta_duplication_service &meta_test_base::dup_svc() { return *(_ms->...
      function meta_split_service (line 228) | meta_split_service &meta_test_base::split_svc() { return *(_ms->_spl...
      function bulk_load_service (line 230) | bulk_load_service &meta_test_base::bulk_svc() { return *(_ms->_bulk_...

FILE: src/meta/test/meta_test_base.h
  function namespace (line 24) | namespace dsn {

FILE: src/meta/test/misc/misc.cpp
  function random32 (line 41) | uint32_t random32(uint32_t min, uint32_t max)
  function generate_node_list (line 47) | void generate_node_list(std::vector<dsn::rpc_address> &output_list, int ...
  function verbose_apps (line 55) | void verbose_apps(const app_mapper &input_apps)
  function generate_node_mapper (line 72) | void generate_node_mapper(
  function generate_app (line 99) | void generate_app(/*out*/ std::shared_ptr<app_state> &app,
  function generate_app_serving_replica_info (line 123) | void generate_app_serving_replica_info(/*out*/ std::shared_ptr<dsn::repl...
  function generate_apps (line 144) | void generate_apps(/*out*/ dsn::replication::app_mapper &mapper,
  function generate_node_fs_manager (line 172) | void generate_node_fs_manager(const app_mapper &apps,
  function track_disk_info_check_and_apply (line 212) | void track_disk_info_check_and_apply(const dsn::replication::configurati...
  function proposal_action_check_and_apply (line 258) | void proposal_action_check_and_apply(const configuration_proposal_action...
  function migration_check_and_apply (line 352) | void migration_check_and_apply(app_mapper &apps,
  function app_mapper_compare (line 389) | void app_mapper_compare(const app_mapper &mapper1, const app_mapper &map...
  function spin_wait_condition (line 412) | bool spin_wait_condition(const std::function<bool()> &pred, int seconds)

FILE: src/meta/test/misc/misc.h
  type std (line 35) | typedef std::map<dsn::rpc_address, std::shared_ptr<dsn::replication::fs_...
  function dsn (line 37) | inline dsn::replication::fs_manager *get_fs_manager(nodes_fs_manager &nfm,

FILE: src/meta/test/server_state_restore_test.cpp
  type dsn (line 27) | namespace dsn {
    type replication (line 28) | namespace replication {
      class server_state_restore_test (line 30) | class server_state_restore_test : public meta_test_base
        method server_state_restore_test (line 33) | server_state_restore_test()
        method SetUp (line 41) | void SetUp() override
        method start_backup_app_response (line 49) | start_backup_app_response start_backup(int64_t app_id,
        method configuration_restore_request (line 67) | configuration_restore_request create_restore_request(
        method test_restore_app (line 83) | void test_restore_app(const std::string user_specified_path = "")
      function TEST_F (line 156) | TEST_F(server_state_restore_test, test_restore_app) { test_restore_a...
      function TEST_F (line 158) | TEST_F(server_state_restore_test, test_restore_app_with_specific_path)

FILE: src/meta/test/server_state_test.cpp
  type dsn (line 35) | namespace dsn {
    type replication (line 36) | namespace replication {
      function acquire_prefix (line 61) | static std::string acquire_prefix(const std::string &str)

FILE: src/meta/test/state_sync_test.cpp
  type dsn (line 42) | namespace dsn {
    type replication (line 43) | namespace replication {
      function random_assign_partition_config (line 45) | static void random_assign_partition_config(std::shared_ptr<app_state...
      function file_data_compare (line 73) | static void file_data_compare(const char *fname1, const char *fname2)
      function create_app_info (line 332) | static dsn::app_info create_app_info(dsn::app_status::type status,

FILE: src/meta/test/update_configuration_test.cpp
  type dsn (line 42) | namespace dsn {
    type replication (line 43) | namespace replication {
      class fake_sender_meta_service (line 47) | class fake_sender_meta_service : public dsn::replication::meta_service
        method fake_sender_meta_service (line 53) | fake_sender_meta_service(meta_service_test_app *app) : meta_servic...
        method reply_message (line 55) | virtual void reply_message(dsn::message_ex *request, dsn::message_...
        method send_message (line 59) | virtual void send_message(const dsn::rpc_address &target, dsn::mes...
      class null_meta_service (line 107) | class null_meta_service : public dsn::replication::meta_service
        method send_message (line 110) | void send_message(const dsn::rpc_address &target, dsn::message_ex ...
      class dummy_partition_guardian (line 118) | class dummy_partition_guardian : public partition_guardian
        method dummy_partition_guardian (line 121) | explicit dummy_partition_guardian(meta_service *s) : partition_gua...
        method pc_status (line 123) | pc_status cure(meta_view view, const dsn::gpid &gpid, configuratio...
      function clone_app_mapper (line 353) | static void clone_app_mapper(app_mapper &output, const app_mapper &i...

FILE: src/nfs/nfs_client_impl.cpp
  type dsn (line 36) | namespace dsn {
    type service (line 37) | namespace service {

FILE: src/nfs/nfs_client_impl.h
  function namespace (line 45) | namespace dsn {

FILE: src/nfs/nfs_code_definition.h
  function namespace (line 37) | namespace dsn {

FILE: src/nfs/nfs_node.cpp
  type dsn (line 33) | namespace dsn {
    function aio_task_ptr (line 40) | aio_task_ptr nfs_node::copy_remote_directory(const rpc_address &remote,
    function aio_task_ptr (line 66) | aio_task_ptr nfs_node::copy_remote_files(const rpc_address &remote,
    function aio_task_ptr (line 95) | aio_task_ptr nfs_node::copy_remote_files(std::shared_ptr<remote_copy_r...

FILE: src/nfs/nfs_node_impl.cpp
  type dsn (line 40) | namespace dsn {
    type service (line 41) | namespace service {
      function error_code (line 56) | error_code nfs_node_simple::start()
      function error_code (line 65) | error_code nfs_node_simple::stop()

FILE: src/nfs/nfs_node_simple.h
  function namespace (line 40) | namespace dsn {

FILE: src/nfs/nfs_server_impl.cpp
  type dsn (line 37) | namespace dsn {
    type service (line 38) | namespace service {
      type stat (line 217) | struct stat

FILE: src/nfs/nfs_server_impl.h
  function namespace (line 40) | namespace dsn {

FILE: src/nfs/test/main.cpp
  type aio_result (line 38) | struct aio_result
  function TEST (line 44) | TEST(nfs, basic)
  function GTEST_API_ (line 180) | GTEST_API_ int main(int argc, char **argv)

FILE: src/perf_counter/builtin_counters.cpp
  type dsn (line 22) | namespace dsn {

FILE: src/perf_counter/builtin_counters.h
  function namespace (line 20) | namespace dsn {

FILE: src/perf_counter/perf_counter.cpp
  function dsn_perf_counter_type_t (line 39) | dsn_perf_counter_type_t dsn_counter_type_from_string(const char *str)
  function dsn_perf_counter_percentile_type_t (line 56) | dsn_perf_counter_percentile_type_t dsn_percentile_type_from_string(const...

FILE: src/perf_counter/perf_counter_atomic.h
  function namespace (line 27) | namespace dsn {
  function class (line 103) | class perf_counter_volatile_number_atomic : public perf_counter_number_a...
  function virtual (line 124) | virtual int64_t get_integer_value()
  function class (line 136) | class perf_counter_rate_atomic : public perf_counter
  function virtual (line 153) | virtual void increment()
  function virtual (line 158) | virtual void decrement()
  function virtual (line 163) | virtual void add(int64_t val)
  function virtual (line 168) | virtual void set(int64_t val) { dassert(false, "invalid execution flow"); }
  function virtual (line 169) | virtual double get_value()
  function virtual (line 185) | virtual int64_t get_integer_value() { return (int64_t)get_value(); }
  function virtual (line 186) | virtual double get_percentile(dsn_perf_counter_percentile_type_t type)
  function class (line 206) | class perf_counter_number_percentile_atomic : public perf_counter
  function virtual (line 247) | virtual void increment() { dassert(false, "invalid execution flow"); }
  function virtual (line 248) | virtual void decrement() { dassert(false, "invalid execution flow"); }
  function virtual (line 249) | virtual void add(int64_t val) { dassert(false, "invalid execution flow"); }
  function virtual (line 250) | virtual void set(int64_t val)
  function virtual (line 256) | virtual double get_value()
  function virtual (line 261) | virtual int64_t get_integer_value() { return (int64_t)get_value(); }
  function virtual (line 263) | virtual double get_percentile(dsn_perf_counter_percentile_type_t type)
  function virtual (line 272) | virtual int get_latest_samples(int required_sample_count,
  function virtual (line 296) | virtual int64_t get_latest_sample() const override
  function find_mid (line 328) | int64_t find_mid(const boost::shared_ptr<compute_context> &ctx, int left...
  function select (line 348) | void select(const boost::shared_ptr<compute_context> &ctx,
  function calc (line 405) | void calc(const boost::shared_ptr<compute_context> &ctx)
  function on_timer (line 438) | void on_timer(std::shared_ptr<boost::asio::deadline_timer> timer,

FILE: src/perf_counter/perf_counters.cpp
  type dsn (line 45) | namespace dsn {
    function perf_counter_ptr (line 107) | perf_counter_ptr perf_counters::get_app_counter(const char *section,
    function perf_counter_ptr (line 118) | perf_counter_ptr perf_counters::get_global_counter(const char *app,
    function perf_counter_ptr (line 176) | perf_counter_ptr perf_counters::get_counter(const std::string &full_name)
    function perf_counter (line 186) | perf_counter *perf_counters::new_counter(const char *app,

FILE: src/perf_counter/test/main.cpp
  function GTEST_API_ (line 21) | GTEST_API_ int main(int argc, char **argv)

FILE: src/perf_counter/test/perf_counter_test.cpp
  function adder_function (line 49) | static void adder_function(perf_counter_ptr pc, int id, const std::vecto...
  function perf_counter_inc_dec (line 55) | static void perf_counter_inc_dec(perf_counter_ptr pc)
  function perf_counter_add (line 75) | static void perf_counter_add(perf_counter_ptr pc, const std::vector<int>...
  function TEST (line 86) | TEST(perf_counter, perf_counter_atomic)
  function TEST (line 128) | TEST(perf_counter, print_type)

FILE: src/perf_counter/test/perf_counters_test.cpp
  function TEST (line 43) | TEST(perf_counters_test, counter_create_remove)
  function check_map_contains (line 108) | bool check_map_contains(const std::map<K, V> &super, const std::map<K, V...
  function TEST (line 122) | TEST(perf_counters_test, snapshot)
  function TEST (line 255) | TEST(perf_counters_test, query_snapshot_by_regexp)
  function TEST (line 321) | TEST(perf_counters_test, get_by_fullname)

FILE: src/remote_cmd/remote_command.cpp
  type dsn (line 26) | namespace dsn {
    type dist (line 27) | namespace dist {
      type cmd (line 28) | namespace cmd {
        function task_ptr (line 34) | task_ptr async_call_remote(rpc_address remote,
        function register_remote_command_rpc (line 49) | bool register_remote_command_rpc()

FILE: src/replica/backup/cold_backup_context.cpp
  type dsn (line 26) | namespace dsn {
    type replication (line 27) | namespace replication {

FILE: src/replica/backup/cold_backup_context.h
  function namespace (line 28) | namespace dsn {
  type dsn (line 370) | typedef dsn::ref_ptr<cold_backup_context> cold_backup_context_ptr;

FILE: src/replica/backup/replica_backup_manager.cpp
  type dsn (line 26) | namespace dsn {
    type replication (line 27) | namespace replication {
      function is_policy_checkpoint (line 30) | static bool is_policy_checkpoint(const std::string &chkpt_dirname, c...
      function get_policy_checkpoint_dirs (line 41) | static bool get_policy_checkpoint_dirs(const std::string &dir,

FILE: src/replica/backup/replica_backup_manager.h
  function namespace (line 23) | namespace dsn {

FILE: src/replica/backup/replica_backup_server.cpp
  type dsn (line 23) | namespace dsn {
    type replication (line 24) | namespace replication {

FILE: src/replica/backup/replica_backup_server.h
  function namespace (line 25) | namespace dsn {

FILE: src/replica/backup/test/main.cpp
  class gtest_app (line 25) | class gtest_app : public dsn::service_app
    method gtest_app (line 28) | gtest_app(const dsn::service_app_info *info) : ::dsn::service_app(info...
    method start (line 30) | dsn::error_code start(const std::vector<std::string> &args) override
    method stop (line 37) | dsn::error_code stop(bool) override { return dsn::ERR_OK; }
  function GTEST_API_ (line 40) | GTEST_API_ int main(int argc, char **argv)

FILE: src/replica/backup/test/replica_backup_manager_test.cpp
  type dsn (line 21) | namespace dsn {
    type replication (line 22) | namespace replication {
      class replica_backup_manager_test (line 24) | class replica_backup_manager_test : public replica_test_base
        method clear_backup_checkpoint (line 27) | void clear_backup_checkpoint(const std::string &policy_name)
      function TEST_F (line 33) | TEST_F(replica_backup_manager_test, clear_cold_backup)

FILE: src/replica/bulk_load/replica_bulk_loader.cpp
  type dsn (line 27) | namespace dsn {
    type replication (line 28) | namespace replication {
      function error_code (line 235) | error_code replica_bulk_loader::do_bulk_load(const std::string &app_...
      function error_code (line 298) | error_code
      function error_code (line 350) | error_code replica_bulk_loader::start_download(const std::string &re...
      function error_code (line 525) | error_code replica_bulk_loader::parse_bulk_load_metadata(const std::...

FILE: src/replica/bulk_load/replica_bulk_loader.h
  function std (line 123) | inline std::string get_remote_bulk_load_dir(const std::string &app_name,
  function set_bulk_load_status (line 135) | inline void set_bulk_load_status(bulk_load_status::type status) { _statu...
  function task_tracker (line 154) | task_tracker *tracker() { return _replica->tracker(); }
  function _bulk_load_start_time_ms (line 178) | uint64_t _bulk_load_start_time_ms{0}

FILE: src/replica/bulk_load/test/main.cpp
  class gtest_app (line 25) | class gtest_app : public dsn::service_app
    method gtest_app (line 28) | gtest_app(const dsn::service_app_info *info) : ::dsn::service_app(info...
    method start (line 30) | dsn::error_code start(const std::vector<std::string> &args) override
    method stop (line 37) | dsn::error_code stop(bool) override { return dsn::ERR_OK; }
  function GTEST_API_ (line 40) | GTEST_API_ int main(int argc, char **argv)

FILE: src/replica/bulk_load/test/replica_bulk_loader_test.cpp
  type dsn (line 27) | namespace dsn {
    type replication (line 28) | namespace replication {
      class replica_bulk_loader_test (line 30) | class replica_bulk_loader_test : public replica_test_base
        method replica_bulk_loader_test (line 33) | replica_bulk_loader_test()
        method error_code (line 44) | error_code test_on_bulk_load()
        method error_code (line 51) | error_code test_on_group_bulk_load(bulk_load_status::type status, ...
        method error_code (line 59) | error_code test_start_downloading()
        method test_rollback_to_downloading (line 68) | void test_rollback_to_downloading(bulk_load_status::type cur_status)
        method error_code (line 88) | error_code test_parse_bulk_load_metadata(const std::string &file_p...
        method test_update_download_progress (line 93) | void test_update_download_progress(uint64_t file_size)
        method test_start_ingestion (line 100) | void test_start_ingestion() { _bulk_loader->start_ingestion(); }
        method test_handle_bulk_load_finish (line 102) | void test_handle_bulk_load_finish(bulk_load_status::type status,
        method test_pause_bulk_load (line 113) | void test_pause_bulk_load(bulk_load_status::type status, int32_t p...
        method test_report_group_download_progress (line 120) | int32_t test_report_group_download_progress(bulk_load_status::type...
        method test_report_group_ingestion_status (line 131) | bool test_report_group_ingestion_status(ingestion_status::type pri...
        method test_report_group_cleaned_up (line 145) | bool test_report_group_cleaned_up()
        method test_report_group_is_paused (line 152) | bool test_report_group_is_paused(bulk_load_status::type status)
        method test_on_group_bulk_load_reply (line 165) | void test_on_group_bulk_load_reply(bulk_load_status::type req_status,
        method validate_status (line 176) | bool validate_status(const bulk_load_status::type meta_status,
        method create_bulk_load_request (line 184) | void
        method create_bulk_load_request (line 197) | void create_bulk_load_request(bulk_load_status::type status, int32...
        method create_group_bulk_load_request (line 205) | void create_group_bulk_load_request(bulk_load_status::type status,...
        method mock_replica_config (line 214) | void mock_replica_config(partition_status::type status)
        method mock_primary_states (line 224) | void mock_primary_states()
        method create_local_file (line 237) | void create_local_file(const std::string &file_name)
        method error_code (line 251) | error_code create_local_metadata_file()
        method validate_metadata (line 277) | bool validate_metadata()
        method mock_downloading_progress (line 300) | void mock_downloading_progress(uint64_t file_total_size,
        method mock_replica_bulk_load_varieties (line 310) | void mock_replica_bulk_load_varieties(bulk_load_status::type status,
        method mock_secondary_progress (line 323) | void mock_secondary_progress(int32_t secondary_progress1, int32_t ...
        method mock_group_progress (line 335) | void mock_group_progress(bulk_load_status::type p_status,
        method mock_group_progress (line 349) | void mock_group_progress(bulk_load_status::type p_status)
        method mock_secondary_ingestion_states (line 358) | void mock_secondary_ingestion_states(ingestion_status::type status1,
        method mock_group_ingestion_states (line 372) | void mock_group_ingestion_states(ingestion_status::type s1_status,
        method mock_group_cleanup_flag (line 381) | void mock_group_cleanup_flag(bulk_load_status::type primary_status,
        method get_bulk_load_status (line 399) | bulk_load_status::type get_bulk_load_status() const { return _bulk...
        method is_cleaned_up (line 400) | bool is_cleaned_up() { return _bulk_loader->is_cleaned_up(); }
        method get_download_progress (line 401) | int32_t get_download_progress() { return _bulk_loader->_download_p...
        method is_secondary_bulk_load_state_reset (line 402) | bool is_secondary_bulk_load_state_reset()
      function TEST_F (line 442) | TEST_F(replica_bulk_loader_test, on_bulk_load_not_primary)
      function TEST_F (line 448) | TEST_F(replica_bulk_loader_test, on_bulk_load_ballot_change)
      function TEST_F (line 456) | TEST_F(replica_bulk_loader_test, on_group_bulk_load_test)
      function TEST_F (line 483) | TEST_F(replica_bulk_loader_test, start_downloading_test)
      function TEST_F (line 510) | TEST_F(replica_bulk_loader_test, rollback_to_downloading_test)
      function TEST_F (line 530) | TEST_F(replica_bulk_loader_test, bulk_load_metadata_not_exist)
      function TEST_F (line 535) | TEST_F(replica_bulk_loader_test, bulk_load_metadata_corrupt)
      function TEST_F (line 546) | TEST_F(replica_bulk_loader_test, bulk_load_metadata_parse_succeed)
      function TEST_F (line 560) | TEST_F(replica_bulk_loader_test, finish_download_test)
      function TEST_F (line 571) | TEST_F(replica_bulk_loader_test, start_ingestion_test)
      function TEST_F (line 579) | TEST_F(replica_bulk_loader_test, bulk_load_finish_test)
      function TEST_F (line 662) | TEST_F(replica_bulk_loader_test, pause_bulk_load_test)
      function TEST_F (line 693) | TEST_F(replica_bulk_loader_test, report_group_download_progress_test)
      function TEST_F (line 718) | TEST_F(replica_bulk_loader_test, report_group_ingestion_status_test)
      function TEST_F (line 792) | TEST_F(replica_bulk_loader_test, report_group_cleanup_flag_in_unheal...
      function TEST_F (line 799) | TEST_F(replica_bulk_loader_test, report_group_cleanup_flag_not_clean...
      function TEST_F (line 805) | TEST_F(replica_bulk_loader_test, report_group_cleanup_flag_all_clean...
      function TEST_F (line 812) | TEST_F(replica_bulk_loader_test, report_group_is_paused_test)
      function TEST_F (line 826) | TEST_F(replica_bulk_loader_test, on_group_bulk_load_reply_downloadin...
      function TEST_F (line 833) | TEST_F(replica_bulk_loader_test, on_group_bulk_load_reply_downloaded...
      function TEST_F (line 840) | TEST_F(replica_bulk_loader_test, on_group_bulk_load_reply_ingestion_...
      function TEST_F (line 848) | TEST_F(replica_bulk_loader_test, on_group_bulk_load_reply_succeed_er...
      function TEST_F (line 856) | TEST_F(replica_bulk_loader_test, on_group_bulk_load_reply_failed_error)
      function TEST_F (line 863) | TEST_F(replica_bulk_loader_test, on_group_bulk_load_reply_pausing_er...
      function TEST_F (line 871) | TEST_F(replica_bulk_loader_test, on_group_bulk_load_reply_rpc_error)
      function TEST_F (line 879) | TEST_F(replica_bulk_loader_test, validate_status_test)

FILE: src/replica/disk_cleaner.cpp
  type dsn (line 27) | namespace dsn {
    type replication (line 28) | namespace replication {
      function error_s (line 64) | error_s disk_remove_useless_dirs(const std::vector<std::string> &dat...

FILE: src/replica/disk_cleaner.h
  function namespace (line 25) | namespace dsn {

FILE: src/replica/duplication/duplication_pipeline.cpp
  type dsn (line 26) | namespace dsn {
    type replication (line 27) | namespace replication {

FILE: src/replica/duplication/duplication_pipeline.h
  function namespace (line 27) | namespace dsn {

FILE: src/replica/duplication/duplication_sync_timer.cpp
  type dsn (line 29) | namespace dsn {
    type replication (line 30) | namespace replication {

FILE: src/replica/duplication/duplication_sync_timer.h
  function namespace (line 27) | namespace dsn {

FILE: src/replica/duplication/load_from_private_log.cpp
  type dsn (line 27) | namespace dsn {
    type replication (line 28) | namespace replication {

FILE: src/replica/duplication/load_from_private_log.h
  function namespace (line 28) | namespace dsn {

FILE: src/replica/duplication/mutation_batch.cpp
  type dsn (line 24) | namespace dsn {
    type replication (line 25) | namespace replication {
      function error_s (line 87) | error_s mutation_batch::add(mutation_ptr mu)
      function decree (line 115) | decree mutation_batch::last_decree() const { return _mutation_buffer...
      function mutation_tuple_set (line 121) | mutation_tuple_set mutation_batch::move_all_mutations()

FILE: src/replica/duplication/mutation_batch.h
  function namespace (line 26) | namespace dsn {

FILE: src/replica/duplication/replica_duplicator.cpp
  type dsn (line 27) | namespace dsn {
    type replication (line 28) | namespace replication {
      function error_s (line 183) | error_s replica_duplicator::update_progress(const duplication_progre...
      function decree (line 227) | decree replica_duplicator::get_max_gced_decree() const

FILE: src/replica/duplication/replica_duplicator.h
  function decree (line 35) | decree confirmed_decree{invalid_decree};

FILE: src/replica/duplication/replica_duplicator_manager.cpp
  type dsn (line 23) | namespace dsn {
    type replication (line 24) | namespace replication {
      function decree (line 86) | decree replica_duplicator_manager::min_confirmed_decree() const

FILE: src/replica/duplication/replica_duplicator_manager.h
  function namespace (line 28) | namespace dsn {

FILE: src/replica/duplication/replica_follower.cpp
  type dsn (line 30) | namespace dsn {
    type replication (line 31) | namespace replication {
      function error_code (line 67) | error_code replica_follower::duplicate_checkpoint()
      function error_code (line 123) | error_code
      function error_code (line 192) | error_code replica_follower::nfs_copy_checkpoint(error_code err, lea...

FILE: src/replica/duplication/replica_follower.h
  function class (line 26) | class replica_follower : replica_base

FILE: src/replica/duplication/test/duplication_sync_timer_test.cpp
  type dsn (line 24) | namespace dsn {
    type replication (line 25) | namespace replication {
      class duplication_sync_timer_test (line 27) | class duplication_sync_timer_test : public duplication_test_base
        method SetUp (line 30) | void SetUp() override { dup_sync = make_unique<duplication_sync_ti...
        method TearDown (line 32) | void TearDown() override { stub.reset(); }
        method test_on_duplication_sync_reply (line 34) | void test_on_duplication_sync_reply()
        method test_duplication_sync (line 60) | void test_duplication_sync()
        method test_update_duplication_map (line 141) | void test_update_duplication_map()
        method test_update_on_non_primary (line 215) | void test_update_on_non_primary()
        method test_update_confirmed_points (line 233) | void test_update_confirmed_points()
        method test_replica_status_transition (line 271) | void test_replica_status_transition()
        method test_receive_illegal_duplication_status (line 333) | void test_receive_illegal_duplication_status()
      function TEST_F (line 363) | TEST_F(duplication_sync_timer_test, duplication_sync) { test_duplica...
      function TEST_F (line 365) | TEST_F(duplication_sync_timer_test, update_duplication_map) { test_u...
      function TEST_F (line 367) | TEST_F(duplication_sync_timer_test, update_on_non_primary) { test_up...
      function TEST_F (line 369) | TEST_F(duplication_sync_timer_test, update_confirmed_points) { test_...
      function TEST_F (line 371) | TEST_F(duplication_sync_timer_test, on_duplication_sync_reply) { tes...
      function TEST_F (line 373) | TEST_F(duplication_sync_timer_test, replica_status_transition) { tes...
      function TEST_F (line 375) | TEST_F(duplication_sync_timer_test, receive_illegal_duplication_status)

FILE: src/replica/duplication/test/duplication_test_base.h
  function namespace (line 26) | namespace dsn {

FILE: src/replica/duplication/test/load_from_private_log_test.cpp
  type dsn (line 30) | namespace dsn {
    type replication (line 31) | namespace replication {
      class load_from_private_log_test (line 35) | class load_from_private_log_test : public duplication_test_base
        method load_from_private_log_test (line 38) | load_from_private_log_test()
        method generate_multiple_log_files (line 45) | int generate_multiple_log_files(uint files_num = 3)
        method test_find_log_file_to_start (line 62) | void test_find_log_file_to_start()
        method test_start_duplication (line 99) | void test_start_duplication(int num_entries, int private_log_size_mb)
        method mutation_tuple_set (line 131) | mutation_tuple_set
        method mutation_tuple_set (line 138) | mutation_tuple_set load_and_wait_all_entries_loaded(int total, int...
        method mutation_tuple_set (line 143) | mutation_tuple_set load_and_wait_all_entries_loaded(
        method test_restart_duplication (line 186) | void test_restart_duplication()
        method mutation_log_ptr (line 208) | mutation_log_ptr create_private_log(gpid id) { return create_priva...
        method mutation_log_ptr (line 210) | mutation_log_ptr create_private_log(int private_log_size_mb = 1, g...
      function TEST_F (line 234) | TEST_F(load_from_private_log_test, find_log_file_to_start) { test_fi...
      function TEST_F (line 236) | TEST_F(load_from_private_log_test, start_duplication_10000_4MB)
      function TEST_F (line 241) | TEST_F(load_from_private_log_test, start_duplication_50000_4MB)
      function TEST_F (line 246) | TEST_F(load_from_private_log_test, start_duplication_10000_1MB)
      function TEST_F (line 251) | TEST_F(load_from_private_log_test, start_duplication_50000_1MB)
      function TEST_F (line 256) | TEST_F(load_from_private_log_test, start_duplication_100000_4MB)
      function TEST_F (line 262) | TEST_F(load_from_private_log_test, handle_real_private_log)
      function TEST_F (line 295) | TEST_F(load_from_private_log_test, restart_duplication) { test_resta...
      function TEST_F (line 297) | TEST_F(load_from_private_log_test, ignore_useless)
      class load_fail_mode_test (line 332) | class load_fail_mode_test : public load_from_private_log_test
        method SetUp (line 335) | void SetUp() override
      function TEST_F (line 363) | TEST_F(load_fail_mode_test, fail_skip)
      function TEST_F (line 381) | TEST_F(load_fail_mode_test, fail_slow)
      function TEST_F (line 400) | TEST_F(load_fail_mode_test, fail_skip_real_corrupted_file)

FILE: src/replica/duplication/test/main.cpp
  class gtest_app (line 25) | class gtest_app : public dsn::service_app
    method gtest_app (line 28) | gtest_app(const dsn::service_app_info *info) : ::dsn::service_app(info...
    method start (line 30) | dsn::error_code start(const std::vector<std::string> &args) override
    method stop (line 37) | dsn::error_code stop(bool) override { return dsn::ERR_OK; }
  function GTEST_API_ (line 40) | GTEST_API_ int main(int argc, char **argv)

FILE: src/replica/duplication/test/mutation_batch_test.cpp
  type dsn (line 21) | namespace dsn {
    type replication (line 22) | namespace replication {
      class mutation_batch_test (line 24) | class mutation_batch_test : public duplication_test_base
        method reset_buffer (line 27) | void
        method commit_buffer (line 35) | void commit_buffer(const mutation_batch &batcher, const decree cur...
      function TEST_F (line 41) | TEST_F(mutation_batch_test, add_mutation_if_valid)
      function TEST_F (line 71) | TEST_F(mutation_batch_test, ignore_non_idempotent_write)
      function TEST_F (line 84) | TEST_F(mutation_batch_test, mutation_buffer_commit)

FILE: src/replica/duplication/test/replica_duplicator_manager_test.cpp
  type dsn (line 20) | namespace dsn {
    type replication (line 21) | namespace replication {
      class replica_duplicator_manager_test (line 23) | class replica_duplicator_manager_test : public duplication_test_base
        method SetUp (line 26) | void SetUp() override { stub = make_unique<mock_replica_stub>(); }
        method TearDown (line 28) | void TearDown() override { stub.reset(); }
        method test_remove_non_existed_duplications (line 30) | void test_remove_non_existed_duplications()
        method test_set_confirmed_decree_non_primary (line 52) | void test_set_confirmed_decree_non_primary()
        method test_get_duplication_confirms (line 89) | void test_get_duplication_confirms()
        method test_min_confirmed_decree (line 122) | void test_min_confirmed_decree()
      function TEST_F (line 170) | TEST_F(replica_duplicator_manager_test, get_duplication_confirms)
      function TEST_F (line 175) | TEST_F(replica_duplicator_manager_test, set_confirmed_decree_non_pri...
      function TEST_F (line 180) | TEST_F(replica_duplicator_manager_test, remove_non_existed_duplicati...
      function TEST_F (line 185) | TEST_F(replica_duplicator_manager_test, min_confirmed_decree) { test...
      function TEST_F (line 187) | TEST_F(replica_duplicator_manager_test, update_checkpoint_prepared)

FILE: src/replica/duplication/test/replica_duplicator_test.cpp
  type dsn (line 25) | namespace dsn {
    type apps (line 26) | namespace apps {
    type replication (line 35) | namespace replication {
      class replica_duplicator_test (line 37) | class replica_duplicator_test : public duplication_test_base
        method replica_duplicator_test (line 40) | replica_duplicator_test()
        method mock_replica (line 46) | mock_replica *replica() { return _replica.get(); }
        method decree (line 48) | decree last_durable_decree() const { return _replica->last_durable...
        method decree (line 50) | decree log_dup_start_decree(const std::unique_ptr<replica_duplicat...
        method test_new_duplicator (line 55) | void test_new_duplicator()
        method test_pause_start_duplication (line 80) | void test_pause_start_duplication()
      function TEST_F (line 122) | TEST_F(replica_duplicator_test, new_duplicator) { test_new_duplicato...
      function TEST_F (line 124) | TEST_F(replica_duplicator_test, pause_start_duplication) { test_paus...
      function TEST_F (line 126) | TEST_F(replica_duplicator_test, duplication_progress)
      function TEST_F (line 155) | TEST_F(replica_duplicator_test, prapre_dup)
  type dsn (line 34) | namespace dsn {
    type apps (line 26) | namespace apps {
    type replication (line 35) | namespace replication {
      class replica_duplicator_test (line 37) | class replica_duplicator_test : public duplication_test_base
        method replica_duplicator_test (line 40) | replica_duplicator_test()
        method mock_replica (line 46) | mock_replica *replica() { return _replica.get(); }
        method decree (line 48) | decree last_durable_decree() const { return _replica->last_durable...
        method decree (line 50) | decree log_dup_start_decree(const std::unique_ptr<replica_duplicat...
        method test_new_duplicator (line 55) | void test_new_duplicator()
        method test_pause_start_duplication (line 80) | void test_pause_start_duplication()
      function TEST_F (line 122) | TEST_F(replica_duplicator_test, new_duplicator) { test_new_duplicato...
      function TEST_F (line 124) | TEST_F(replica_duplicator_test, pause_start_duplication) { test_paus...
      function TEST_F (line 126) | TEST_F(replica_duplicator_test, duplication_progress)
      function TEST_F (line 155) | TEST_F(replica_duplicator_test, prapre_dup)

FILE: src/replica/duplication/test/replica_follower_test.cpp
  type dsn (line 25) | namespace dsn {
    type apps (line 26) | namespace apps {
    type replication (line 32) | namespace replication {
      class replica_follower_test (line 34) | class replica_follower_test : public duplication_test_base
        method replica_follower_test (line 37) | replica_follower_test()
        method update_mock_replica (line 47) | void update_mock_replica(const dsn::app_info &app)
        method set_duplicating (line 57) | void set_duplicating(bool duplicating, replica_follower *follower)
        method get_duplicating (line 62) | bool get_duplicating(replica_follower *follower) { return follower...
        method async_duplicate_checkpoint_from_master_replica (line 64) | void async_duplicate_checkpoint_from_master_replica(replica_follow...
        method wait_follower_task_completed (line 69) | bool wait_follower_task_completed(replica_follower *follower)
        method mark_tracker_tasks_success (line 75) | void mark_tracker_tasks_success(replica_follower *follower)
        method error_code (line 80) | error_code update_master_replica_config(replica_follower *follower,
        method partition_configuration (line 86) | const partition_configuration &master_replica_config(replica_follo...
        method error_code (line 91) | error_code nfs_copy_checkpoint(replica_follower *follower, error_c...
        method init_nfs (line 96) | void init_nfs()
      function TEST_F (line 107) | TEST_F(replica_follower_test, test_init_master_info)
      function TEST_F (line 131) | TEST_F(replica_follower_test, test_duplicate_checkpoint)
      function TEST_F (line 151) | TEST_F(replica_follower_test, test_async_duplicate_checkpoint_from_m...
      function TEST_F (line 173) | TEST_F(replica_follower_test, test_update_master_replica_config)
      function TEST_F (line 220) | TEST_F(replica_follower_test, test_nfs_copy_checkpoint)
  type dsn (line 31) | namespace dsn {
    type apps (line 26) | namespace apps {
    type replication (line 32) | namespace replication {
      class replica_follower_test (line 34) | class replica_follower_test : public duplication_test_base
        method replica_follower_test (line 37) | replica_follower_test()
        method update_mock_replica (line 47) | void update_mock_replica(const dsn::app_info &app)
        method set_duplicating (line 57) | void set_duplicating(bool duplicating, replica_follower *follower)
        method get_duplicating (line 62) | bool get_duplicating(replica_follower *follower) { return follower...
        method async_duplicate_checkpoint_from_master_replica (line 64) | void async_duplicate_checkpoint_from_master_replica(replica_follow...
        method wait_follower_task_completed (line 69) | bool wait_follower_task_completed(replica_follower *follower)
        method mark_tracker_tasks_success (line 75) | void mark_tracker_tasks_success(replica_follower *follower)
        method error_code (line 80) | error_code update_master_replica_config(replica_follower *follower,
        method partition_configuration (line 86) | const partition_configuration &master_replica_config(replica_follo...
        method error_code (line 91) | error_code nfs_copy_checkpoint(replica_follower *follower, error_c...
        method init_nfs (line 96) | void init_nfs()
      function TEST_F (line 107) | TEST_F(replica_follower_test, test_init_master_info)
      function TEST_F (line 131) | TEST_F(replica_follower_test, test_duplicate_checkpoint)
      function TEST_F (line 151) | TEST_F(replica_follower_test, test_async_duplicate_checkpoint_from_m...
      function TEST_F (line 173) | TEST_F(replica_follower_test, test_update_master_replica_config)
      function TEST_F (line 220) | TEST_F(replica_follower_test, test_nfs_copy_checkpoint)

FILE: src/replica/duplication/test/replica_http_service_test.cpp
  type dsn (line 21) | namespace dsn {
    type replication (line 22) | namespace replication {
      class replica_http_service_test (line 24) | class replica_http_service_test : public duplication_test_base
      function TEST_F (line 28) | TEST_F(replica_http_service_test, query_duplication_handler)

FILE: src/replica/duplication/test/ship_mutation_test.cpp
  type dsn (line 22) | namespace dsn {
    type replication (line 23) | namespace replication {
      type mock_stage (line 27) | struct mock_stage : pipeline::when<>
        method run (line 29) | void run() override {}
      class ship_mutation_test (line 32) | class ship_mutation_test : public duplication_test_base
        method ship_mutation_test (line 35) | ship_mutation_test()
        method test_ship_mutation_tuple_set (line 44) | void test_ship_mutation_tuple_set()
        method ship_mutation (line 83) | ship_mutation *mock_ship_mutation()
      function TEST_F (line 92) | TEST_F(ship_mutation_test, ship_mutation_tuple_set) { test_ship_muta...
      function retry (line 94) | void retry(pipeline::base *base)
      function TEST_F (line 99) | TEST_F(ship_mutation_test, pause)

FILE: src/replica/log_block.cpp
  type dsn (line 20) | namespace dsn {
    type replication (line 21) | namespace replication {

FILE: src/replica/log_block.h
  function namespace (line 22) | namespace dsn {

FILE: src/replica/log_file.cpp
  type dsn (line 37) | namespace dsn {
    type replication (line 38) | namespace replication {
      function log_file_ptr (line 41) | log_file_ptr log_file::open_read(const char *path, /*out*/ error_cod...
      function log_file_ptr (line 131) | log_file_ptr log_file::create_write(const char *dir, int index, int6...
      function error_code (line 198) | error_code log_file::read_next_log_block(/*out*/ ::dsn::blob &bb)
      function aio_task_ptr (line 248) | aio_task_ptr log_file::commit_log_block(log_block &block,
      function aio_task_ptr (line 258) | aio_task_ptr log_file::commit_log_blocks(log_appender &pending,
      function decree (line 347) | decree log_file::previous_log_max_decree(const dsn::gpid &pid)

FILE: src/replica/log_file.h
  function namespace (line 33) | namespace dsn {

FILE: src/replica/log_file_stream.h
  function reset (line 53) | void reset(size_t file_offset)
  function error_code (line 76) | error_code read_next(size_t size, /*out*/ blob &result)

FILE: src/replica/mutation.cpp
  type dsn (line 42) | namespace dsn {
    type replication (line 43) | namespace replication {
      function mutation_ptr (line 68) | mutation_ptr mutation::copy_no_reply(const mutation_ptr &old_mu)
      function mutation_ptr (line 225) | mutation_ptr mutation::read_from(binary_reader &reader, dsn::message...
      function mutation_ptr (line 350) | mutation_ptr mutation_queue::add_work(task_code code, dsn::message_e...
      function mutation_ptr (line 406) | mutation_ptr mutation_queue::check_possible_work(int current_running...

FILE: src/replica/mutation.h
  function namespace (line 44) | namespace dsn {

FILE: src/replica/mutation_cache.cpp
  type dsn (line 30) | namespace dsn {
    type replication (line 31) | namespace replication {
      function error_code (line 59) | error_code mutation_cache::put(mutation_ptr &mu)
      function mutation_ptr (line 105) | mutation_ptr mutation_cache::pop_min()
      function mutation_ptr (line 141) | mutation_ptr mutation_cache::get_mutation_by_decree(decree decree)

FILE: src/replica/mutation_cache.h
  function namespace (line 34) | namespace dsn {

FILE: src/replica/mutation_log.cpp
  type dsn (line 39) | namespace dsn {
    type replication (line 40) | namespace replication {
      function error_code (line 504) | error_code mutation_log::open(replay_callback read_callback,
      function error_code (line 511) | error_code mutation_log::open(replay_callback read_callback,
      function error_code (line 728) | error_code mutation_log::create_new_log_file()
      function decree (line 860) | decree mutation_log::max_decree(gpid gpid) const
      function decree (line 875) | decree mutation_log::max_commit_on_disk() const
      function decree (line 882) | decree mutation_log::max_gced_decree(gpid gpid) const
      function decree (line 888) | decree mutation_log::max_gced_decree_no_lock(gpid gpid) const
      function error_code (line 936) | error_code mutation_log::reset_from(const std::string &dir,
      function should_reserve_file (line 1253) | static bool should_reserve_file(log_file_ptr log,

FILE: src/replica/mutation_log.h
  function class (line 50) | class mutation_log : public ref_counter

FILE: src/replica/mutation_log_replay.cpp
  type dsn (line 24) | namespace dsn {
    type replication (line 25) | namespace replication {
      function error_code (line 27) | error_code mutation_log::replay(log_file_ptr log,
      function error_s (line 58) | error_s mutation_log::replay_block(log_file_ptr &log,
      function error_code (line 115) | error_code mutation_log::replay(std::vector<std::string> &log_files,
      function error_code (line 141) | error_code mutation_log::replay(std::map<int, log_file_ptr> &logs,

FILE: src/replica/mutation_log_utils.cpp
  type dsn (line 32) | namespace dsn {
    type replication (line 33) | namespace replication {
      type log_utils (line 34) | namespace log_utils {
        function error_s (line 36) | error_s open_read(string_view path, /*out*/ log_file_ptr &file)
        function error_s (line 50) | error_s list_all_files(const std::string &dir, /*out*/ std::vector...
        function error_s (line 64) | error_s check_log_files_continuity(const std::map<int, log_file_pt...

FILE: src/replica/mutation_log_utils.h
  function namespace (line 35) | namespace dsn {

FILE: src/replica/prepare_list.cpp
  type dsn (line 32) | namespace dsn {
    type replication (line 33) | namespace replication {
      function error_code (line 71) | error_code prepare_list::prepare(mutation_ptr &mu,

FILE: src/replica/prepare_list.h
  function namespace (line 33) | namespace dsn {

FILE: src/replica/replica.cpp
  type dsn (line 51) | namespace dsn {
    type replication (line 52) | namespace replication {
      function mutation_ptr (line 408) | mutation_ptr replica::new_mutation(decree decree)
      function decree (line 418) | decree replica::last_durable_decree() const { return _app->last_dura...
      function decree (line 420) | decree replica::last_flushed_decree() const { return _app->last_flus...
      function decree (line 422) | decree replica::last_prepared_decree() const
      function error_code (line 573) | error_code replica::store_app_info(app_info &info, const std::string...

FILE: src/replica/replica.h
  function namespace (line 60) | namespace security {
  type dsn (line 75) | typedef dsn::ref_ptr<cold_backup_context> cold_backup_context_ptr;
  type cold_backup_metadata (line 76) | struct cold_backup_metadata
  function namespace (line 78) | namespace test {
  type deny_client (line 103) | struct deny_client
  function write (line 106) | bool write{false};
  function set_disk_status (line 260) | void set_disk_status(disk_status::type status) { _disk_status = status; }
  function disk_space_insufficient (line 261) | bool disk_space_insufficient() { return _disk_status == disk_status::SPA...
  function _bulk_load_ingestion_start_time_ms (line 606) | uint64_t _bulk_load_ingestion_start_time_ms{0}
  function _validate_partition_hash (line 610) | bool _validate_partition_hash{false};

FILE: src/replica/replica_2pc.cpp
  type dsn (line 38) | namespace dsn {
    type replication (line 39) | namespace replication {

FILE: src/replica/replica_backup.cpp
  type dsn (line 33) | namespace dsn {
    type replication (line 34) | namespace replication {
      function backup_get_dir_name (line 228) | static std::string backup_get_dir_name(const std::string &policy_name,
      function backup_get_tmp_dir_name (line 244) | static std::string
      function is_related_or_valid_checkpoint (line 257) | static int is_related_or_valid_checkpoint(const std::string &chkpt_d...
      function filter_checkpoint (line 306) | static bool filter_checkpoint(const std::string &dir,
      function statistic_file_infos_under_dir (line 337) | static bool
      function backup_parse_dir_name (line 366) | static bool backup_parse_dir_name(const char *name,

FILE: src/replica/replica_check.cpp
  type dsn (line 48) | namespace dsn {
    type replication (line 49) | namespace replication {

FILE: src/replica/replica_chkpt.cpp
  type dsn (line 48) | namespace dsn {
    type replication (line 49) | namespace replication {
      function checkpoint_folder (line 53) | static std::string checkpoint_folder(int64_t decree)
      function error_code (line 135) | error_code replica::trigger_manual_emergency_checkpoint(decree old_d...
      function error_code (line 231) | error_code replica::background_async_checkpoint(bool is_emergency)
      function error_code (line 299) | error_code replica::background_sync_checkpoint()

FILE: src/replica/replica_config.cpp
  type dsn (line 50) | namespace dsn {
    type replication (line 51) | namespace replication {
      function get_bool_envs (line 53) | bool get_bool_envs(const std::map<std::string, std::string> &envs,
      function error_code (line 1200) | error_code replica::update_init_info_ballot_and_decree()

FILE: src/replica/replica_context.cpp
  type dsn (line 46) | namespace dsn {
    type replication (line 47) | namespace replication {

FILE: src/replica/replica_context.h
  type remote_learner_state (line 43) | struct remote_learner_state
  type std (line 51) | typedef std::unordered_map<::dsn::rpc_address, remote_learner_state> lea...
  function ingestion_is_empty_prepare_sent (line 175) | bool ingestion_is_empty_prepare_sent{false};
  function class (line 181) | class secondary_context
  function decree (line 233) | decree first_learn_start_decree{invalid_decree};
  function class (line 243) | class partition_split_context

FILE: src/replica/replica_disk_migrator.cpp
  type dsn (line 29) | namespace dsn {
    type replication (line 30) | namespace replication {

FILE: src/replica/replica_disk_migrator.h
  function namespace (line 22) | namespace dsn {

FILE: src/replica/replica_failover.cpp
  type dsn (line 41) | namespace dsn {
    type replication (line 42) | namespace replication {

FILE: src/replica/replica_http_service.cpp
  type dsn (line 24) | namespace dsn {
    type replication (line 25) | namespace replication {

FILE: src/replica/replica_http_service.h
  function namespace (line 22) | namespace dsn {

FILE: src/replica/replica_init.cpp
  type dsn (line 39) | namespace dsn {
    type replication (line 40) | namespace replication {
      function error_code (line 42) | error_code replica::initialize_on_new()
      function replica (line 69) | replica *replica::newr(replica_stub *stub,
      function replica (line 109) | replica *replica::clear_on_failure(replica_stub *stub,
      function error_code (line 124) | error_code replica::initialize_on_load()
      function replica (line 136) | replica *replica::load(replica_stub *stub, const char *dir)
      function decree (line 211) | decree replica::get_replay_start_decree()
      function error_code (line 218) | error_code replica::init_app_and_prepare_list(bool create_new)

FILE: src/replica/replica_learn.cpp
  type dsn (line 46) | namespace dsn {
    type replication (line 47) | namespace replication {
      function decree (line 236) | decree replica::get_max_gced_decree_for_learn() const // on learner
      function decree (line 260) | decree replica::max_gced_decree_no_lock() const
      function decree (line 266) | decree replica::get_learn_start_decree(const learn_request &request)...
      function error_code (line 1299) | error_code replica::handle_learning_succeeded_on_primary(::dsn::rpc_...
      function error_code (line 1509) | error_code replica::apply_learned_state_from_private_log(learn_state...

FILE: src/replica/replica_restore.cpp
  type dsn (line 37) | namespace dsn {
    type replication (line 38) | namespace replication {
      function error_code (line 114) | error_code replica::download_checkpoint(const configuration_restore_...
      function error_code (line 178) | error_code replica::get_backup_metadata(block_filesystem *fs,

FILE: src/replica/replica_stub.cpp
  type dsn (line 64) | namespace dsn {
    type replication (line 65) | namespace replication {
      function replica_ptr (line 873) | replica_ptr replica_stub::get_replica(gpid id) const
      type gc_info (line 1710) | struct gc_info
      function task_ptr (line 1926) | task_ptr replica_stub::begin_open_replica(
      function task_ptr (line 2129) | task_ptr replica_stub::begin_close_replica(replica_ptr r)
      function get_tcmalloc_numeric_property (line 2709) | static int64_t get_tcmalloc_numeric_property(const char *prop)
      function replica_ptr (line 2790) | replica_ptr replica_stub::create_child_replica_if_not_found(gpid chi...

FILE: src/replica/replica_stub.h
  type rpc_holder (line 52) | typedef rpc_holder<group_check_response, learn_notify_response> learn_co...
  type rpc_holder (line 53) | typedef rpc_holder<group_check_request, group_check_response> group_chec...
  type rpc_holder (line 54) | typedef rpc_holder<query_replica_decree_request, query_replica_decree_re...
  type rpc_holder (line 56) | typedef rpc_holder<query_replica_info_request, query_replica_info_respon...
  type rpc_holder (line 57) | typedef rpc_holder<learn_request, learn_response> query_last_checkpoint_...
  type rpc_holder (line 58) | typedef rpc_holder<query_disk_info_request, query_disk_info_response> qu...
  type rpc_holder (line 59) | typedef rpc_holder<replica_disk_migrate_request, replica_disk_migrate_re...
  type rpc_holder (line 61) | typedef rpc_holder<query_app_info_request, query_app_info_response> quer...
  type rpc_holder (line 62) | typedef rpc_holder<notify_catch_up_request, notify_cacth_up_response> no...
  type rpc_holder (line 63) | typedef rpc_holder<update_child_group_partition_count_request,
  type rpc_holder (line 66) | typedef rpc_holder<group_bulk_load_request, group_bulk_load_response> gr...
  type rpc_holder (line 67) | typedef rpc_holder<detect_hotkey_request, detect_hotkey_response> detect...
  type rpc_holder (line 68) | typedef rpc_holder<add_new_disk_request, add_new_disk_response> add_new_...
  function namespace (line 71) | namespace test {
  type std (line 77) | typedef std::unordered_map<gpid, replica_ptr> replicas;
  type std (line 78) | typedef std::function<void(
  type dsn (line 83) | typedef dsn::ref_ptr<replica_stub> replica_stub_ptr;
  function set_options (line 106) | void set_options(const replication_options &opts) { _options = opts; }
  function set_meta_server_disconnected_for_test (line 152) | void set_meta_server_disconnected_for_test() { on_meta_server_disconnect...
  type std (line 203) | typedef std::function<void(replica_split_manager *split_mgr)> local_exec...
  type replica_node_state (line 236) | enum replica_node_state
  type replica_life_cycle (line 243) | enum replica_life_cycle
  function get_app_id_from_replicas (line 293) | int get_app_id_from_replicas(std::string app_name)

FILE: src/replica/replica_test_utils.cpp
  type dsn (line 32) | namespace dsn {
    type replication (line 33) | namespace replication {
      class mock_replica (line 35) | class mock_replica : public replica
        method mock_replica (line 38) | mock_replica(replica_stub *stub,
      function replica (line 49) | replica *create_test_replica(replica_stub *stub,
      function replica_stub (line 59) | replica_stub *create_test_replica_stub() { return new replica_stub(); }
      function destroy_replica (line 61) | void destroy_replica(replica *r) { delete r; }
      function destroy_replica_stub (line 63) | void destroy_replica_stub(replica_stub *rs) { delete rs; }

FILE: src/replica/replica_throttle.cpp
  type dsn (line 27) | namespace dsn {
    type replication (line 28) | namespace replication {

FILE: src/replica/replication_app_base.cpp
  type dsn (line 45) | namespace dsn {
    type replication (line 46) | namespace replication {
      function error_code (line 53) | error_code write_blob_to_file(const std::string &file, const blob &d...
      function error_code (line 91) | error_code replica_init_info::load(const std::string &dir)
      function error_code (line 101) | error_code replica_init_info::store(const std::string &dir)
      function error_code (line 116) | error_code replica_init_info::load_json(const std::string &file)
      function error_code (line 142) | error_code replica_init_info::store_json(const std::string &file)
      function error_code (line 157) | error_code replica_app_info::load(const std::string &file)
      function error_code (line 184) | error_code replica_app_info::store(const std::string &file)
      function replication_app_base (line 214) | replication_app_base *replication_app_base::new_storage_instance(con...
      function ballot (line 248) | const ballot &replication_app_base::get_ballot() const { return _rep...
      function error_code (line 250) | error_code replication_app_base::open_internal(replica *r)
      function error_code (line 276) | error_code replication_app_base::open_new_internal(replica *r,
      function error_code (line 297) | error_code replication_app_base::open()
      function error_code (line 328) | error_code replication_app_base::close(bool clear_state)
      function error_code (line 337) | error_code replication_app_base::apply_checkpoint(chkpt_apply_mode m...
      function error_code (line 365) | error_code replication_app_base::apply_mutation(const mutation *mu)
      function error_code (line 459) | error_code replication_app_base::update_init_info(replica *r,
      function error_code (line 477) | error_code replication_app_base::update_init_info_ballot_and_decree(...
      function app_info (line 485) | const app_info *replication_app_base::get_app_info() const { return ...

FILE: src/replica/replication_service_app.cpp
  type dsn (line 35) | namespace dsn {
    type replication (line 36) | namespace replication {
      function error_code (line 54) | error_code replication_service_app::start(const std::vector<std::str...
      function error_code (line 70) | error_code replication_service_app::stop(bool cleanup)

FILE: src/replica/split/replica_split_manager.cpp
  type dsn (line 27) | namespace dsn {
    type replication (line 28) | namespace replication {
      function error_code (line 383) | error_code

FILE: src/replica/split/replica_split_manager.h
  function set_child_gpid (line 35) | void set_child_gpid(gpid pid) { _child_gpid = pid; }
  function task_tracker (line 182) | task_tracker *tracker() { return _replica->tracker(); }
  function check_partition_hash (line 184) | bool check_partition_hash(const uint64_t &partition_hash, const std::str...
  function gpid (line 212) | gpid _child_gpid{0, 0};

FILE: src/replica/split/test/main.cpp
  class gtest_app (line 25) | class gtest_app : public dsn::service_app
    method gtest_app (line 28) | gtest_app(const dsn::service_app_info *info) : ::dsn::service_app(info...
    method start (line 30) | dsn::error_code start(const std::vector<std::string> &args) override
    method stop (line 37) | dsn::error_code stop(bool) override { return dsn::ERR_OK; }
  function GTEST_API_ (line 40) | GTEST_API_ int main(int argc, char **argv)

FILE: src/replica/split/test/replica_split_test.cpp
  type dsn (line 24) | namespace dsn {
    type replication (line 25) | namespace replication {
      class replica_split_test (line 27) | class replica_split_test : public replica_test_base
        method replica_split_test (line 30) | replica_split_test()
        method mock_app_info (line 44) | void mock_app_info()
        method generate_child (line 54) | void generate_child()
        method generate_child (line 61) | void generate_child(bool is_prepare_list_copied, bool is_caught_up)
        method mock_child_split_context (line 69) | void mock_child_split_context(bool is_prepare_list_copied, bool is...
        method mock_parent_split_context (line 77) | void mock_parent_split_context(partition_status::type status)
        method mock_primary_parent_split_context (line 85) | void mock_primary_parent_split_context(bool sync_send_write_request,
        method mock_shared_log (line 102) | void mock_shared_log()
        method mock_private_log (line 108) | void mock_private_log(gpid pid, mock_replica_ptr rep, bool mock_lo...
        method mock_prepare_list (line 119) | void mock_prepare_list(mock_replica_ptr rep, bool add_to_plog)
        method mock_parent_states (line 135) | void mock_parent_states()
        method mock_mutation_list (line 142) | void mock_mutation_list(decree min_decree)
        method mock_child_async_learn_states (line 153) | void
        method mock_parent_primary_configuration (line 168) | void mock_parent_primary_configuration(bool lack_of_secondary = fa...
        method mock_update_child_partition_count_request (line 182) | void mock_update_child_partition_count_request(update_child_group_...
        method test_parent_start_split (line 192) | void test_parent_start_split(ballot b, gpid req_child_gpid, split_...
        method test_child_init_replica (line 205) | void test_child_init_replica()
        method test_parent_check_states (line 220) | bool test_parent_check_states()
        method test_child_copy_prepare_list (line 227) | void test_child_copy_prepare_list()
        method test_child_learn_states (line 240) | void test_child_learn_states()
        method test_child_apply_private_logs (line 248) | void test_child_apply_private_logs()
        method test_child_catch_up_states (line 256) | void test_child_catch_up_states(decree local_decree, decree goal_d...
        method error_code (line 270) | error_code test_parent_handle_child_catch_up(ballot child_ballot)
        method test_update_child_group_partition_count (line 286) | void test_update_child_group_partition_count()
        method error_code (line 293) | error_code test_on_update_child_group_partition_count(ballot b)
        method error_code (line 304) | error_code test_on_update_child_group_partition_count_reply(error_...
        method test_register_child_on_meta (line 320) | void test_register_child_on_meta()
        method test_on_register_child_reply (line 327) | void test_on_register_child_reply(partition_status::type status, d...
        method test_trigger_primary_parent_split (line 359) | void test_trigger_primary_parent_split(split_status::type meta_spl...
        method group_check_response (line 369) | group_check_response test_trigger_secondary_parent_split(split_sta...
        method test_primary_parent_handle_stop_split (line 395) | void test_primary_parent_handle_stop_split(split_status::type meta...
        method test_on_query_child_state_reply (line 428) | void test_on_query_child_state_reply()
        method test_check_partition_hash (line 452) | bool test_check_partition_hash(const int32_t &partition_version, c...
        method cleanup_prepare_list (line 459) | void cleanup_prepare_list(mock_replica_ptr rep) { rep->_prepare_li...
        method cleanup_child_split_context (line 460) | void cleanup_child_split_context()
        method child_get_prepare_list_count (line 466) | int32_t child_get_prepare_list_count() { return _child_replica->ge...
        method child_is_prepare_list_copied (line 467) | bool child_is_prepare_list_copied()
        method child_is_caught_up (line 471) | bool child_is_caught_up() { return _child_replica->_split_states.i...
        method parent_get_split_status (line 473) | split_status::type parent_get_split_status() { return _parent_spli...
        method parent_set_split_status (line 474) | void parent_set_split_status(split_status::type status)
        method primary_context (line 479) | primary_context get_replica_primary_context(mock_replica_ptr rep)
        method parent_sync_send_write_request (line 483) | bool parent_sync_send_write_request()
        method parent_stopped_split_size (line 487) | int32_t parent_stopped_split_size()
        method is_parent_not_in_split (line 491) | bool is_parent_not_in_split()
        method primary_parent_not_in_split (line 497) | bool primary_parent_not_in_split()
      function TEST_F (line 533) | TEST_F(replica_split_test, parent_start_split_tests)
      function TEST_F (line 569) | TEST_F(replica_split_test, child_init_replica_test)
      function TEST_F (line 579) | TEST_F(replica_split_test, parent_check_states_tests)
      function TEST_F (line 599) | TEST_F(replica_split_test, copy_prepare_list_succeed)
      function TEST_F (line 616) | TEST_F(replica_split_test, child_learn_states_tests)
      function TEST_F (line 648) | TEST_F(replica_split_test, child_apply_private_logs_succeed)
      function TEST_F (line 662) | TEST_F(replica_split_test, child_catch_up_states_tests)
      function TEST_F (line 687) | TEST_F(replica_split_test, parent_handle_catch_up_test)
      function TEST_F (line 713) | TEST_F(replica_split_test, update_child_group_partition_count_test)
      function TEST_F (line 749) | TEST_F(replica_split_test, child_update_partition_count_test)
      function TEST_F (line 776) | TEST_F(replica_split_test, parent_on_update_partition_reply_test)
      function TEST_F (line 810) | TEST_F(replica_split_test, register_child_test)
      function TEST_F (line 819) | TEST_F(replica_split_test, register_child_reply_test)
      function TEST_F (line 852) | TEST_F(replica_split_test, trigger_primary_parent_split_test)
      function TEST_F (line 897) | TEST_F(replica_split_test, secondary_handle_split_test)
      function TEST_F (line 944) | TEST_F(replica_split_test, primary_parent_handle_stop_test)
      function TEST_F (line 976) | TEST_F(replica_split_test, query_child_state_reply_test)
      function TEST_F (line 988) | TEST_F(replica_split_test, check_partition_hash_test)

FILE: src/replica/storage/simple_kv/simple_kv.app.example.h
  function namespace (line 40) | namespace dsn {

FILE: src/replica/storage/simple_kv/simple_kv.client.h
  function namespace (line 35) | namespace dsn {

FILE: src/replica/storage/simple_kv/simple_kv.code.definition.h
  function namespace (line 39) | namespace dsn {

FILE: src/replica/storage/simple_kv/simple_kv.main.cpp
  function dsn_app_registration_simple_kv (line 45) | static void dsn_app_registration_simple_kv()
  function main (line 58) | int main(int argc, char **argv)

FILE: src/replica/storage/simple_kv/simple_kv.server.h
  function namespace (line 45) | namespace dsn {

FILE: src/replica/storage/simple_kv/simple_kv.server.impl.cpp
  type dsn (line 41) | namespace dsn {
    type replication (line 42) | namespace replication {
      type application (line 43) | namespace application {

FILE: src/replica/storage/simple_kv/simple_kv.server.impl.h
  function namespace (line 41) | namespace dsn {

FILE: src/replica/storage/simple_kv/test/case.cpp
  type dsn (line 54) | namespace dsn {
    type replication (line 55) | namespace replication {
      type test (line 56) | namespace test {
        function parse_kv_map (line 58) | static bool
        type event_type_helper (line 306) | struct event_type_helper
          method event_type_helper (line 311) | event_type_helper()
          method add (line 324) | void add(event_type type, const std::string &name, bool is_suppo...
          method get (line 337) | bool get(const std::string &name, event_type &type)
          method is_support_inject_fault (line 345) | bool is_support_inject_fault(event_type type)
        function event_type_from_string (line 354) | bool event_type_from_string(const std::string &name, event_type &t...
        function event_type_support_inject_fault (line 359) | bool event_type_support_inject_fault(event_type type)
        function event (line 375) | event *event::parse(int line_no, const std::string &params)

FILE: src/replica/storage/simple_kv/test/case.h
  function namespace (line 45) | namespace dsn {
  function class (line 319) | class event_on_aio_enqueue : public event_on_aio
  function class (line 334) | class event_case_line : public case_line

FILE: src/replica/storage/simple_kv/test/checker.cpp
  type dsn (line 55) | namespace dsn {
    type replication (line 56) | namespace replication {
      type test (line 57) | namespace test {
        class checker_partition_guardian (line 59) | class checker_partition_guardian : public partition_guardian
          method checker_partition_guardian (line 65) | checker_partition_guardian(meta_service *svc) : partition_guardi...
          method pc_status (line 66) | pc_status
          method sort_alive_nodes (line 130) | static void sort_alive_nodes(const node_mapper &nodes,
        function meta_service_app (line 327) | meta_service_app *test_checker::meta_leader()
        function rpc_address (line 376) | rpc_address test_checker::node_name_to_address(const std::string &...
        function install_checkers (line 384) | void install_checkers()

FILE: src/replica/storage/simple_kv/test/checker.h
  function namespace (line 47) | namespace dsn {

FILE: src/replica/storage/simple_kv/test/client.cpp
  type dsn (line 43) | namespace dsn {
    type replication (line 44) | namespace replication {
      type test (line 45) | namespace test {
        type write_context (line 111) | struct write_context
        type read_context (line 162) | struct read_context

FILE: src/replica/storage/simple_kv/test/client.h
  function namespace (line 42) | namespace dsn {

FILE: src/replica/storage/simple_kv/test/common.cpp
  type dsn (line 44) | namespace dsn {
    type replication (line 45) | namespace replication {
      type test (line 46) | namespace test {
        function partition_status_from_short_string (line 74) | partition_status::type partition_status_from_short_string(const st...
        function address_to_node (line 92) | std::string address_to_node(rpc_address addr)
        function rpc_address (line 100) | rpc_address node_to_address(const std::string &name)
        function gpid_to_string (line 108) | std::string gpid_to_string(gpid gpid)
        function gpid_from_string (line 115) | bool gpid_from_string(const std::string &str, gpid &gpid)

FILE: src/replica/storage/simple_kv/test/common.h
  function namespace (line 41) | namespace dsn {
  type state_snapshot (line 125) | struct state_snapshot

FILE: src/replica/storage/simple_kv/test/injector.cpp
  type dsn (line 46) | namespace dsn {
    type replication (line 47) | namespace replication {
      type test (line 48) | namespace test {
        function inject_on_task_enqueue (line 50) | static void inject_on_task_enqueue(task *caller, task *callee)
        function inject_on_task_begin (line 61) | static void inject_on_task_begin(task *this_)
        function inject_on_task_end (line 72) | static void inject_on_task_end(task *this_)
        function inject_on_task_cancelled (line 83) | static void inject_on_task_cancelled(task *this_)
        function inject_on_task_wait_pre (line 94) | static void inject_on_task_wait_pre(task *caller, task *callee, ui...
        function inject_on_task_wait_post (line 100) | static void inject_on_task_wait_post(task *caller, task *callee, b...
        function inject_on_task_cancel_post (line 106) | static void inject_on_task_cancel_post(task *caller, task *callee,...
        function inject_on_aio_call (line 112) | static bool inject_on_aio_call(task *caller, aio_task *callee)
        function inject_on_aio_enqueue (line 123) | static void inject_on_aio_enqueue(aio_task *this_)
        function inject_on_rpc_call (line 134) | static bool inject_on_rpc_call(task *caller, message_ex *req, rpc_...
        function inject_on_rpc_request_enqueue (line 145) | static bool inject_on_rpc_request_enqueue(rpc_request_task *callee)
        function inject_on_rpc_reply (line 156) | static bool inject_on_rpc_reply(task *caller, message_ex *msg)
        function inject_on_rpc_response_enqueue (line 167) | static bool inject_on_rpc_response_enqueue(rpc_response_task *resp)

FILE: src/replica/storage/simple_kv/test/injector.h
  function namespace (line 40) | namespace dsn {

FILE: src/replica/storage/simple_kv/test/simple_kv.main.cpp
  function dsn_app_registration_simple_kv (line 43) | void dsn_app_registration_simple_kv()
  function main (line 56) | int main(int argc, char **argv)

FILE: src/replica/storage/simple_kv/test/simple_kv.server.impl.cpp
  type dsn (line 33) | namespace dsn {
    type replication (line 34) | namespace replication {
      type test (line 35) | namespace test {

FILE: src/replica/storage/simple_kv/test/simple_kv.server.impl.h
  function namespace (line 31) | namespace dsn {

FILE: src/replica/test/backup_block_service_mock.h
  function class (line 38) | class backup_block_service_mock : public block_service_mock

FILE: src/replica/test/log_block_test.cpp
  type dsn (line 22) | namespace dsn {
    type replication (line 23) | namespace replication {
      class log_block_test (line 25) | class log_block_test : public replica_test_base
      function TEST_F (line 29) | TEST_F(log_block_test, constructor)
      function TEST_F (line 37) | TEST_F(log_block_test, log_block_header)
      class log_appender_test (line 46) | class log_appender_test : public replica_test_base
      function TEST_F (line 50) | TEST_F(log_appender_test, constructor)
      function TEST_F (line 65) | TEST_F(log_appender_test, append_mutation)
      function TEST_F (line 78) | TEST_F(log_appender_test, log_block_not_full)
      function TEST_F (line 96) | TEST_F(log_appender_test, log_block_full)
      function TEST_F (line 120) | TEST_F(log_appender_test, read_log_block)

FILE: src/replica/test/log_file_test.cpp
  type dsn (line 22) | namespace dsn {
    type replication (line 23) | namespace replication {
      class log_file_test (line 25) | class log_file_test : public replica_test_base
        method SetUp (line 28) | void SetUp() override
        method TearDown (line 35) | void TearDown() override
      function TEST_F (line 46) | TEST_F(log_file_test, commit_log_blocks)

FILE: src/replica/test/main.cpp
  function TEST (line 32) | TEST(cold_backup_context, check_backup_on_remote) { app->check_backup_on...
  function TEST (line 34) | TEST(cold_backup_context, read_current_chkpt_file) { app->read_current_c...
  function TEST (line 36) | TEST(cold_backup_context, remote_chkpt_dir_exist) { app->remote_chkpt_di...
  function TEST (line 38) | TEST(cold_backup_context, upload_checkpoint_to_remote) { app->upload_che...
  function TEST (line 40) | TEST(cold_backup_context, read_backup_metadata) { app->read_backup_metad...
  function TEST (line 42) | TEST(cold_backup_context, on_upload_chkpt_dir) { app->on_upload_chkpt_di...
  function TEST (line 44) | TEST(cold_backup_context, write_metadata_file) { app->write_backup_metad...
  function TEST (line 46) | TEST(cold_backup_context, write_current_chkpt_file) { app->write_current...
  function error_code (line 48) | error_code replication_service_test_app::start(const std::vector<std::st...
  function GTEST_API_ (line 56) | GTEST_API_ int main(int argc, char **argv)

FILE: src/replica/test/mock_utils.h
  function namespace (line 38) | namespace dsn {
  function class (line 110) | class mock_replica : public replica
  function class (line 245) | class mock_replica_stub : public replica_stub
  function set_state_connected (line 274) | void set_state_connected() { _state = replica_node_state::NS_Connected; }

FILE: src/replica/test/mutation_log_learn_test.cpp
  type dsn (line 35) | namespace dsn {
    type replication (line 36) | namespace replication {
      class mutation_log_test (line 38) | class mutation_log_test : public replica_test_base
      function TEST_F (line 42) | TEST_F(mutation_log_test, learn)

FILE: src/replica/test/mutation_log_test.cpp
  function copy_file (line 36) | static void copy_file(const char *from_file, const char *to_file, int64_...
  function overwrite_file (line 60) | static void overwrite_file(const char *file, int offset, const void *buf...
  function TEST (line 72) | TEST(replication, log_file)
  type dsn (line 265) | namespace dsn {
    type replication (line 266) | namespace replication {
      class mutation_log_test (line 268) | class mutation_log_test : public replica_test_base
        method mutation_log_test (line 271) | mutation_log_test() {}
        method SetUp (line 273) | void SetUp() override
        method TearDown (line 281) | void TearDown() override { utils::filesystem::remove_path(_log_dir...
        method mutation_ptr (line 283) | mutation_ptr create_test_mutation(decree d, const std::string &dat...
        method ASSERT_BLOB_EQ (line 305) | static void ASSERT_BLOB_EQ(const blob &lhs, const blob &rhs)
        method generate_multiple_log_files (line 311) | int generate_multiple_log_files(uint files_num = 3)
        method mutation_log_ptr (line 328) | mutation_log_ptr create_private_log() { return create_private_log(...
        method mutation_log_ptr (line 330) | mutation_log_ptr create_private_log(int private_log_size_mb, decre...
        method test_replay_single_file (line 353) | void test_replay_single_file(int num_entries)
        method test_replay_multiple_files (line 392) | void test_replay_multiple_files(int num_entries, int private_log_f...
      function TEST_F (line 432) | TEST_F(mutation_log_test, replay_single_file_1000) { test_replay_sin...
      function TEST_F (line 434) | TEST_F(mutation_log_test, replay_single_file_2000) { test_replay_sin...
      function TEST_F (line 436) | TEST_F(mutation_log_test, replay_single_file_5000) { test_replay_sin...
      function TEST_F (line 438) | TEST_F(mutation_log_test, replay_single_file_10000) { test_replay_si...
      function TEST_F (line 440) | TEST_F(mutation_log_test, replay_single_file_1) { test_replay_single...
      function TEST_F (line 442) | TEST_F(mutation_log_test, replay_single_file_10) { test_replay_singl...
      function TEST_F (line 445) | TEST_F(mutation_log_test, open)
      function TEST_F (line 478) | TEST_F(mutation_log_test, replay_multiple_files_10000_1mb) { test_re...
      function TEST_F (line 480) | TEST_F(mutation_log_test, replay_multiple_files_20000_1mb) { test_re...
      function TEST_F (line 482) | TEST_F(mutation_log_test, replay_multiple_files_50000_1mb) { test_re...
      function TEST_F (line 484) | TEST_F(mutation_log_test, replay_start_decree)
      function TEST_F (line 497) | TEST_F(mutation_log_test, reset_from)
      function TEST_F (line 545) | TEST_F(mutation_log_test, reset_from_while_writing)

FILE: src/replica/test/open_replica_test.cpp
  type dsn (line 25) | namespace dsn {
    type replication (line 26) | namespace replication {
      class open_replica_test (line 28) | class open_replica_test : public replica_test_base
        method open_replica_test (line 31) | open_replica_test() = default;
        method test_open_replica (line 34) | void test_open_replica()
      function TEST_F (line 94) | TEST_F(open_replica_test, open_replica_add_decree_and_ballot_check) ...

FILE: src/replica/test/replica_disk_migrate_test.cpp
  type dsn (line 26) | namespace dsn {
    type replication (line 27) | namespace replication {
      class replica_disk_migrate_test (line 32) | class replica_disk_migrate_test : public replica_disk_test_base
        method SetUp (line 38) | void SetUp() override { generate_fake_rpc(); }
        method replica_ptr (line 40) | replica_ptr get_replica(const dsn::gpid &pid) const
        method set_replica_status (line 46) | void set_replica_status(const dsn::gpid &pid, partition_status::ty...
        method set_migration_status (line 51) | void set_migration_status(const dsn::gpid &pid, const disk_migrati...
        method set_replica_dir (line 58) | void set_replica_dir(const dsn::gpid &pid, const std::string &dir)
        method set_replica_target_dir (line 65) | void set_replica_target_dir(const dsn::gpid &pid, const std::strin...
        method check_migration_args (line 72) | void check_migration_args(replica_disk_migrate_rpc &rpc)
        method init_migration_target_dir (line 79) | void init_migration_target_dir(replica_disk_migrate_rpc &rpc)
        method migrate_replica_checkpoint (line 86) | void migrate_replica_checkpoint(replica_disk_migrate_rpc &rpc)
        method migrate_replica_app_info (line 93) | void migrate_replica_app_info(replica_disk_migrate_rpc &rpc)
        method close_current_replica (line 100) | dsn::task_ptr close_current_replica(replica_disk_migrate_rpc &rpc)
        method update_replica_dir (line 106) | void update_replica_dir(replica_disk_migrate_rpc &rpc)
        method open_replica (line 112) | void open_replica(const app_info &app, gpid id)
        method generate_fake_rpc (line 118) | void generate_fake_rpc()
      function TEST_F (line 126) | TEST_F(replica_disk_migrate_test, on_migrate_replica)
      function TEST_F (line 146) | TEST_F(replica_disk_migrate_test, migrate_disk_replica_check)
      function TEST_F (line 205) | TEST_F(replica_disk_migrate_test, disk_migrate_replica_run)
      function TEST_F (line 270) | TEST_F(replica_disk_migrate_test, disk_migrate_replica_close)
      function TEST_F (line 285) | TEST_F(replica_disk_migrate_test, disk_migrate_replica_update)
      function TEST_F (line 339) | TEST_F(replica_disk_migrate_test, disk_migrate_replica_open)

FILE: src/replica/test/replica_disk_test.cpp
  type dsn (line 26) | namespace dsn {
    type replication (line 27) | namespace replication {
      class replica_disk_test (line 31) | class replica_disk_test : public replica_disk_test_base
        method SetUp (line 37) | void SetUp() override {}
        method generate_fake_rpc (line 39) | void generate_fake_rpc()
        method error_code (line 46) | error_code send_add_new_disk_rpc(const std::string disk_str)
      function TEST_F (line 60) | TEST_F(replica_disk_test, on_query_disk_info_all_app)
      function TEST_F (line 135) | TEST_F(replica_disk_test, on_query_disk_info_app_not_existed)
      function TEST_F (line 144) | TEST_F(replica_disk_test, on_query_disk_info_one_app)
      function TEST_F (line 173) | TEST_F(replica_disk_test, gc_disk_useless_dir)
      function TEST_F (line 216) | TEST_F(replica_disk_test, disk_status_test)
      function TEST_F (line 242) | TEST_F(replica_disk_test, broken_disk_test)
      function TEST_F (line 260) | TEST_F(replica_disk_test, add_new_disk_test)

FILE: src/replica/test/replica_disk_test_base.h
  function namespace (line 26) | namespace dsn {

FILE: src/replica/test/replica_learn_test.cpp
  type dsn (line 24) | namespace dsn {
    type replication (line 25) | namespace replication {
      class replica_learn_test (line 29) | class replica_learn_test : public duplication_test_base
        method replica_learn_test (line 32) | replica_learn_test() = default;
        method create_duplicating_replica (line 34) | std::unique_ptr<mock_replica> create_duplicating_replica()
        method test_get_learn_start_decree (line 45) | void test_get_learn_start_decree()
        method test_get_max_gced_decree_for_learn (line 144) | void test_get_max_gced_decree_for_learn()
      function TEST_F (line 167) | TEST_F(replica_learn_test, get_learn_start_decree) { test_get_learn_...
      function TEST_F (line 169) | TEST_F(replica_learn_test,
Condensed preview — 927 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (6,735K chars).
[
  {
    "path": ".clang-format",
    "chars": 3957,
    "preview": "# The MIT License (MIT)\n#\n# Copyright (c) 2015 Microsoft Corporation\n#\n# -=- Robust Distributed System Nucleus (rDSN) -="
  },
  {
    "path": ".github/workflows/check_license_header.yaml",
    "chars": 1443,
    "preview": "# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE f"
  },
  {
    "path": ".github/workflows/compilation.yaml",
    "chars": 2325,
    "preview": "##############################################################################\n# Licensed to the Apache Software Foundat"
  },
  {
    "path": ".github/workflows/cpp_actions.yaml",
    "chars": 7488,
    "preview": "# Developer Notes:\n#\n# This config is for github actions. Before merging your changes of this file,\n# it's recommended t"
  },
  {
    "path": ".github/workflows/cpp_always_pass_actions.yaml",
    "chars": 2389,
    "preview": "# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE f"
  },
  {
    "path": ".github/workflows/issue_ref.yaml",
    "chars": 1235,
    "preview": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": ".github/workflows/non_cpp_actions.yaml",
    "chars": 1558,
    "preview": "# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE f"
  },
  {
    "path": ".gitignore",
    "chars": 1586,
    "preview": "# The MIT License (MIT)\n#\n# Copyright (c) 2015 Microsoft Corporation\n#\n# -=- Robust Distributed System Nucleus (rDSN) -="
  },
  {
    "path": ".licenserc.yaml",
    "chars": 17742,
    "preview": "# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE f"
  },
  {
    "path": "CMakeLists.txt",
    "chars": 2458,
    "preview": "cmake_minimum_required(VERSION 3.11.0)\n\nif (\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"GNU\")\n    # require at least gcc 5.4.0\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 2526,
    "preview": "<!--\nLicensed to the Apache Software Foundation (ASF) under one\nor more contributor license agreements.  See the NOTICE "
  },
  {
    "path": "LICENSE",
    "chars": 9166,
    "preview": "The MIT License (MIT)\n\nCopyright (c) Microsoft Corporation\n\nAll rights reserved.\n\nPermission is hereby granted, free of "
  },
  {
    "path": "README.md",
    "chars": 6362,
    "preview": "<!--\n  ~ The MIT License (MIT)\n  ~\n  ~ Copyright (c) 2015 Microsoft Corporation\n  ~\n  ~ -=- Robust Distributed System Nu"
  },
  {
    "path": "bin/FindDL.cmake",
    "chars": 3663,
    "preview": "# Copyright (c) 2010-2011, Rob Jansen\n\n# To the extent that a federal employee is an author of a portion of\n# this softw"
  },
  {
    "path": "bin/FindJemalloc.cmake",
    "chars": 3082,
    "preview": "##############################################################################\n# Licensed to the Apache Software Foundat"
  },
  {
    "path": "bin/FindRT.cmake",
    "chars": 3662,
    "preview": "# Copyright (c) 2010-2011, Rob Jansen\n\n# To the extent that a federal employee is an author of a portion of\n# this softw"
  },
  {
    "path": "bin/compiler_info.cmake",
    "chars": 2053,
    "preview": "# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE f"
  },
  {
    "path": "bin/dsn.cmake",
    "chars": 15502,
    "preview": "# The MIT License (MIT)\n#\n# Copyright (c) 2015 Microsoft Corporation\n#\n# -=- Robust Distributed System Nucleus (rDSN) -="
  },
  {
    "path": "bin/thrift_utils.cmake",
    "chars": 3063,
    "preview": "##############################################################################\n# Licensed to the Apache Software Foundat"
  },
  {
    "path": "compile_thrift.py",
    "chars": 7667,
    "preview": "#!/usr/bin/env python2\n# The MIT License (MIT)\n#\n# Copyright (c) 2015 Microsoft Corporation\n#\n# -=- Robust Distributed S"
  },
  {
    "path": "include/dsn/c/api_common.h",
    "chars": 2020,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/c/api_layer1.h",
    "chars": 8507,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/c/api_task.h",
    "chars": 2771,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/c/api_utilities.h",
    "chars": 7824,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/c/app_model.h",
    "chars": 3730,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/cpp/json_helper.h",
    "chars": 32264,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/cpp/message_utils.h",
    "chars": 2970,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/cpp/pipeline.h",
    "chars": 9385,
    "preview": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOT"
  },
  {
    "path": "include/dsn/cpp/rpc_holder.h",
    "chars": 12950,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/cpp/rpc_stream.h",
    "chars": 4266,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/cpp/serialization.h",
    "chars": 3500,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/cpp/serialization_helper/dsn.layer2_types.h",
    "chars": 14164,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/cpp/serialization_helper/dsn_types.h",
    "chars": 1258,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/cpp/serialization_helper/thrift_helper.h",
    "chars": 24402,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/cpp/serverlet.h",
    "chars": 8327,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/cpp/service_app.h",
    "chars": 3330,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/block_service.h",
    "chars": 14725,
    "preview": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOT"
  },
  {
    "path": "include/dsn/dist/common.h",
    "chars": 1056,
    "preview": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOT"
  },
  {
    "path": "include/dsn/dist/distributed_lock_service.h",
    "chars": 7085,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/failure_detector/failure_detector.h",
    "chars": 8208,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/failure_detector/fd.client.h",
    "chars": 3616,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/failure_detector/fd.code.definition.h",
    "chars": 2008,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/failure_detector/fd.server.h",
    "chars": 2326,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/failure_detector.h",
    "chars": 1446,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/failure_detector_multimaster.h",
    "chars": 3187,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/fmt_logging.h",
    "chars": 5320,
    "preview": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOT"
  },
  {
    "path": "include/dsn/dist/meta_state_service.h",
    "chars": 7777,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/nfs_node.h",
    "chars": 3761,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/remote_command.h",
    "chars": 1489,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/dist/replication/duplication_common.h",
    "chars": 3182,
    "preview": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOT"
  },
  {
    "path": "include/dsn/dist/replication/meta_service_app.h",
    "chars": 2009,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/replication/mutation_duplicator.h",
    "chars": 3158,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/dist/replication/mutation_log_tool.h",
    "chars": 1776,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/replication/partition_resolver.h",
    "chars": 5101,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/replication/replica_base.h",
    "chars": 2000,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/replication/replica_envs.h",
    "chars": 3061,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/replication/replica_test_utils.h",
    "chars": 2030,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/replication/replication.codes.h",
    "chars": 12314,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/replication/replication_app_base.h",
    "chars": 11077,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/replication/replication_ddl_client.h",
    "chars": 15208,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/replication/replication_enums.h",
    "chars": 7442,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/replication/replication_other_types.h",
    "chars": 3731,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/replication/replication_service_app.h",
    "chars": 2261,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/replication/replication_types.h",
    "chars": 1119,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/dist/replication/storage_serverlet.h",
    "chars": 5084,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/dist/replication.h",
    "chars": 1533,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/http/http_server.h",
    "chars": 3627,
    "preview": "/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements.  See the NOT"
  },
  {
    "path": "include/dsn/perf_counter/perf_counter.h",
    "chars": 4335,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/perf_counter/perf_counter_utils.h",
    "chars": 1632,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/perf_counter/perf_counter_wrapper.h",
    "chars": 4128,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/perf_counter/perf_counters.h",
    "chars": 6927,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/service_api_c.h",
    "chars": 4203,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/service_api_cpp.h",
    "chars": 1668,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool/nativerun.h",
    "chars": 1739,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool/node_scoper.h",
    "chars": 1754,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool/providers.common.h",
    "chars": 1496,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool/simulator.h",
    "chars": 2399,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/aio_task.h",
    "chars": 3461,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/async_calls.h",
    "chars": 8823,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/auto_codes.h",
    "chars": 1535,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/command_manager.h",
    "chars": 3897,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/env_provider.h",
    "chars": 1888,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/file_io.h",
    "chars": 3347,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/future_types.h",
    "chars": 1509,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/global_config.h",
    "chars": 7915,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/gpid.h",
    "chars": 3217,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/group_address.h",
    "chars": 6604,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/logging_provider.h",
    "chars": 3288,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/message_parser.h",
    "chars": 4418,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/network.h",
    "chars": 11791,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/rpc_address.h",
    "chars": 7042,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/rpc_message.h",
    "chars": 8617,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/task.h",
    "chars": 20629,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/task_code.h",
    "chars": 8188,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/task_queue.h",
    "chars": 3557,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/task_spec.h",
    "chars": 11802,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/task_tracker.h",
    "chars": 7406,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/task_worker.h",
    "chars": 3499,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/thread_access_checker.h",
    "chars": 1697,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/threadpool_code.h",
    "chars": 2258,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/threadpool_spec.h",
    "chars": 4500,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/timer_service.h",
    "chars": 2297,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/uniq_timestamp_us.h",
    "chars": 1966,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool-api/zlocks.h",
    "chars": 4535,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/tool_api.h",
    "chars": 6824,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/toollet/fault_injector.h",
    "chars": 2668,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/toollet/profiler.h",
    "chars": 1733,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/toollet/tracer.h",
    "chars": 2956,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/TokenBucket.h",
    "chars": 18013,
    "preview": "/*\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "include/dsn/utility/absl/base/internal/invoke.h",
    "chars": 8103,
    "preview": "// Copyright 2017 The Abseil Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
  },
  {
    "path": "include/dsn/utility/absl/utility/utility.h",
    "chars": 7461,
    "preview": "// Copyright 2017 The Abseil Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
  },
  {
    "path": "include/dsn/utility/alloc.h",
    "chars": 2604,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/apply.h",
    "chars": 1327,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/autoref_ptr.h",
    "chars": 5093,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/binary_reader.h",
    "chars": 3454,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/binary_writer.h",
    "chars": 3953,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/blob.h",
    "chars": 5421,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/casts.h",
    "chars": 1973,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/chrono_literals.h",
    "chars": 2513,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/clock.h",
    "chars": 1337,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/config_api.h",
    "chars": 5586,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/config_helper.h",
    "chars": 10216,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/configuration.h",
    "chars": 7502,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/crc.h",
    "chars": 2540,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/customizable_id.h",
    "chars": 6032,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/defer.h",
    "chars": 1750,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/dlib.h",
    "chars": 1678,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/endians.h",
    "chars": 3870,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/enum_helper.h",
    "chars": 4546,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/error_code.h",
    "chars": 5490,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/errors.h",
    "chars": 6566,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/exp_delay.h",
    "chars": 3699,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/extensible_object.h",
    "chars": 7288,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/factory_store.h",
    "chars": 5690,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/fail_point.h",
    "chars": 4389,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/filesystem.h",
    "chars": 4981,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/fixed_size_buffer_pool.h",
    "chars": 2154,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/flags.h",
    "chars": 7885,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/function_traits.h",
    "chars": 3764,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/hpc_locks/autoresetevent.h",
    "chars": 2186,
    "preview": "//---------------------------------------------------------\n// For conditions of distribution and use, see\n// https://gi"
  },
  {
    "path": "include/dsn/utility/hpc_locks/autoreseteventcondvar.h",
    "chars": 1687,
    "preview": "//---------------------------------------------------------\n// For conditions of distribution and use, see\n// https://gi"
  },
  {
    "path": "include/dsn/utility/hpc_locks/benaphore.h",
    "chars": 3421,
    "preview": "//---------------------------------------------------------\n// For conditions of distribution and use, see\n// https://gi"
  },
  {
    "path": "include/dsn/utility/hpc_locks/bitfield.h",
    "chars": 6886,
    "preview": "//---------------------------------------------------------\n// For conditions of distribution and use, see\n// https://gi"
  },
  {
    "path": "include/dsn/utility/hpc_locks/readme.txt",
    "chars": 138,
    "preview": "from: https://github.com/imzhenyu/cpp11-on-multicore\noriginally from: https://github.com/preshing/cpp11-on-multicore wit"
  },
  {
    "path": "include/dsn/utility/hpc_locks/rwlock.h",
    "chars": 4877,
    "preview": "//---------------------------------------------------------\n// For conditions of distribution and use, see\n// https://gi"
  },
  {
    "path": "include/dsn/utility/hpc_locks/sema.h",
    "chars": 6210,
    "preview": "//---------------------------------------------------------\n// For conditions of distribution and use, see\n// https://gi"
  },
  {
    "path": "include/dsn/utility/join_point.h",
    "chars": 4197,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/link.h",
    "chars": 4856,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/long_adder.h",
    "chars": 9070,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/math.h",
    "chars": 1012,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/metrics.h",
    "chars": 28444,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/nth_element.h",
    "chars": 5127,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/optional.h",
    "chars": 3253,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/output_utils.h",
    "chars": 6047,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/ports.h",
    "chars": 3650,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/preloadable.h",
    "chars": 1094,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/priority_queue.h",
    "chars": 3991,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/process_utils.h",
    "chars": 2162,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/rand.h",
    "chars": 2428,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/safe_strerror_posix.h",
    "chars": 1363,
    "preview": "// Copyright (c) 2011 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style l"
  },
  {
    "path": "include/dsn/utility/singleton.h",
    "chars": 1419,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/singleton_store.h",
    "chars": 3726,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/smart_pointers.h",
    "chars": 4833,
    "preview": "// Copyright 2017 The Abseil Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
  },
  {
    "path": "include/dsn/utility/string_conv.h",
    "chars": 4017,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/string_splitter.h",
    "chars": 6524,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/string_view.h",
    "chars": 16554,
    "preview": "//\n// Copyright 2017 The Abseil Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you ma"
  },
  {
    "path": "include/dsn/utility/strings.h",
    "chars": 3280,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/synchronize.h",
    "chars": 4543,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/sys_exit_hook.h",
    "chars": 1288,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/timer.h",
    "chars": 1930,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utility/utils.h",
    "chars": 5166,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utility/work_queue.h",
    "chars": 3103,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utils/latency_tracer.h",
    "chars": 8059,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utils/time_utils.h",
    "chars": 4331,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "include/dsn/utils/token_bucket_throttling_controller.h",
    "chars": 3500,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "include/dsn/utils/token_buckets.h",
    "chars": 1325,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "run.sh",
    "chars": 13072,
    "preview": "#!/bin/bash\n# The MIT License (MIT)\n#\n# Copyright (c) 2015 Microsoft Corporation\n#\n# -=- Robust Distributed System Nucle"
  },
  {
    "path": "scripts/linux/build.sh",
    "chars": 6123,
    "preview": "#!/bin/bash\n# The MIT License (MIT)\n#\n# Copyright (c) 2015 Microsoft Corporation\n#\n# -=- Robust Distributed System Nucle"
  },
  {
    "path": "scripts/linux/clear_zk.sh",
    "chars": 1549,
    "preview": "#!/bin/bash\n# The MIT License (MIT)\n#\n# Copyright (c) 2015 Microsoft Corporation\n#\n# -=- Robust Distributed System Nucle"
  },
  {
    "path": "scripts/linux/install.sh",
    "chars": 2288,
    "preview": "#!/bin/bash\n# The MIT License (MIT)\n#\n# Copyright (c) 2015 Microsoft Corporation\n#\n# -=- Robust Distributed System Nucle"
  },
  {
    "path": "scripts/linux/learn_stat.py",
    "chars": 4639,
    "preview": "#!/usr/bin/env python\n# The MIT License (MIT)\n#\n# Copyright (c) 2015 Microsoft Corporation\n#\n# -=- Robust Distributed Sy"
  },
  {
    "path": "scripts/linux/run-clang-format.py",
    "chars": 13461,
    "preview": "#!/usr/bin/env python\n\n# MIT License\n#\n# Copyright (c) 2017 Guillaume Papin\n#\n# Permission is hereby granted, free of ch"
  },
  {
    "path": "scripts/linux/run-clang-format.sh",
    "chars": 1426,
    "preview": "#!/bin/bash\n# The MIT License (MIT)\n#\n# Copyright (c) 2015 Microsoft Corporation\n#\n# -=- Robust Distributed System Nucle"
  },
  {
    "path": "scripts/linux/start_zk.sh",
    "chars": 3416,
    "preview": "#!/bin/bash\n# The MIT License (MIT)\n#\n# Copyright (c) 2015 Microsoft Corporation\n#\n# -=- Robust Distributed System Nucle"
  },
  {
    "path": "scripts/linux/stop_zk.sh",
    "chars": 1463,
    "preview": "#!/bin/bash\n# The MIT License (MIT)\n#\n# Copyright (c) 2015 Microsoft Corporation\n#\n# -=- Robust Distributed System Nucle"
  },
  {
    "path": "src/CMakeLists.txt",
    "chars": 443,
    "preview": "if(UNIX)\n    add_compile_options(-fPIC)\nendif()\nadd_subdirectory(runtime)\nadd_subdirectory(aio)\nadd_subdirectory(zookeep"
  },
  {
    "path": "src/aio/CMakeLists.txt",
    "chars": 515,
    "preview": "set(MY_PROJ_NAME dsn_aio)\n\n#Source files under CURRENT project directory will be automatically included.\n#You can manual"
  },
  {
    "path": "src/aio/aio_provider.cpp",
    "chars": 1782,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "src/aio/aio_provider.h",
    "chars": 2912,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "src/aio/aio_task.cpp",
    "chars": 2565,
    "preview": "// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE"
  },
  {
    "path": "src/aio/disk_engine.cpp",
    "chars": 8327,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "src/aio/disk_engine.h",
    "chars": 2788,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "src/aio/file_io.cpp",
    "chars": 5040,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "src/aio/native_linux_aio_provider.cpp",
    "chars": 5759,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "src/aio/native_linux_aio_provider.h",
    "chars": 2013,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "src/aio/test/CMakeLists.txt",
    "chars": 745,
    "preview": "set(MY_PROJ_NAME dsn_aio_test)\n\n# Source files under CURRENT project directory will be automatically included.\n# You can"
  },
  {
    "path": "src/aio/test/aio.cpp",
    "chars": 9344,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Microsoft Corporation\n *\n * -=- Robust Distributed System Nucleus ("
  },
  {
    "path": "src/aio/test/clear.sh",
    "chars": 1234,
    "preview": "#!/bin/sh\n# The MIT License (MIT)\n#\n# Copyright (c) 2015 Microsoft Corporation\n#\n# -=- Robust Distributed System Nucleus"
  },
  {
    "path": "src/aio/test/config.ini",
    "chars": 1577,
    "preview": "; The MIT License (MIT)\n;\n; Copyright (c) 2015 Microsoft Corporation\n;\n; -=- Robust Distributed System Nucleus (rDSN) -="
  },
  {
    "path": "src/aio/test/copy_source.txt",
    "chars": 134,
    "preview": "\nhelp\nhelp engine\nhelp unexist-cmd\nengine\ntask-code\nconfig-dump config-dump.ini\ntest-cmd this is test argument\nunexist-c"
  }
]

// ... and 727 more files (download for full content)

About this extraction

This page contains the full source code of the XiaoMi/rdsn GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 927 files (6.2 MB), approximately 1.7M tokens, and a symbol index with 3337 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!