Loads client API functions (definitions are in FdbCApi struct)
| 734 | |
| 735 | // Loads client API functions (definitions are in FdbCApi struct) |
| 736 | void DLApi::init() { |
| 737 | if (isLibraryLoaded(fdbCPath.c_str())) { |
| 738 | throw external_client_already_loaded(); |
| 739 | } |
| 740 | |
| 741 | void* lib = loadLibrary(fdbCPath.c_str()); |
| 742 | if (lib == nullptr) { |
| 743 | TraceEvent(SevError, "ErrorLoadingExternalClientLibrary").detail("LibraryPath", fdbCPath); |
| 744 | throw platform_error(); |
| 745 | } |
| 746 | if (unlinkOnLoad) { |
| 747 | int err = unlink(fdbCPath.c_str()); |
| 748 | if (err) { |
| 749 | TraceEvent(SevError, "ErrorUnlinkingTempClientLibraryFile").GetLastError().detail("LibraryPath", fdbCPath); |
| 750 | throw platform_error(); |
| 751 | } |
| 752 | } |
| 753 | |
| 754 | loadClientFunction(&api->selectApiVersion, lib, fdbCPath, "fdb_select_api_version_impl", headerVersion >= 0); |
| 755 | loadClientFunction(&api->getClientVersion, lib, fdbCPath, "fdb_get_client_version", headerVersion >= 410); |
| 756 | loadClientFunction(&api->useFutureProtocolVersion, |
| 757 | lib, |
| 758 | fdbCPath, |
| 759 | "fdb_use_future_protocol_version", |
| 760 | headerVersion >= ApiVersion::withFutureProtocolVersionApi().version()); |
| 761 | loadClientFunction(&api->setNetworkOption, lib, fdbCPath, "fdb_network_set_option", headerVersion >= 0); |
| 762 | loadClientFunction(&api->setupNetwork, lib, fdbCPath, "fdb_setup_network", headerVersion >= 0); |
| 763 | loadClientFunction(&api->runNetwork, lib, fdbCPath, "fdb_run_network", headerVersion >= 0); |
| 764 | loadClientFunction(&api->stopNetwork, lib, fdbCPath, "fdb_stop_network", headerVersion >= 0); |
| 765 | loadClientFunction(&api->createDatabase, lib, fdbCPath, "fdb_create_database", headerVersion >= 610); |
| 766 | loadClientFunction(&api->createDatabaseFromConnectionString, |
| 767 | lib, |
| 768 | fdbCPath, |
| 769 | "fdb_create_database_from_connection_string", |
| 770 | headerVersion >= ApiVersion::withCreateDBFromConnString().version()); |
| 771 | |
| 772 | loadClientFunction(&api->databaseOpenTenant, lib, fdbCPath, "fdb_database_open_tenant", headerVersion >= 710); |
| 773 | loadClientFunction( |
| 774 | &api->databaseCreateSharedState, lib, fdbCPath, "fdb_database_create_shared_state", headerVersion >= 710); |
| 775 | loadClientFunction( |
| 776 | &api->databaseSetSharedState, lib, fdbCPath, "fdb_database_set_shared_state", headerVersion >= 710); |
| 777 | loadClientFunction( |
| 778 | &api->databaseCreateTransaction, lib, fdbCPath, "fdb_database_create_transaction", headerVersion >= 0); |
| 779 | loadClientFunction(&api->databaseSetOption, lib, fdbCPath, "fdb_database_set_option", headerVersion >= 0); |
| 780 | loadClientFunction(&api->databaseGetMainThreadBusyness, |
| 781 | lib, |
| 782 | fdbCPath, |
| 783 | "fdb_database_get_main_thread_busyness", |
| 784 | headerVersion >= 700); |
| 785 | loadClientFunction( |
| 786 | &api->databaseGetServerProtocol, lib, fdbCPath, "fdb_database_get_server_protocol", headerVersion >= 700); |
| 787 | loadClientFunction(&api->databaseDestroy, lib, fdbCPath, "fdb_database_destroy", headerVersion >= 0); |
| 788 | loadClientFunction(&api->databaseRebootWorker, lib, fdbCPath, "fdb_database_reboot_worker", headerVersion >= 700); |
| 789 | loadClientFunction(&api->databaseForceRecoveryWithDataLoss, |
| 790 | lib, |
| 791 | fdbCPath, |
| 792 | "fdb_database_force_recovery_with_data_loss", |
| 793 | headerVersion >= 700); |
no test coverage detected