diff --git a/CHANGELOG.md b/CHANGELOG.md index 923f8b99..a9334281 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,13 +4,17 @@ ### Issues +* \#54 Remove 'default' as initial bucket name for Sia + ### Changes from v2.0.6-release * Fixed `.` and `..` incorrectly being reported as files in remote Linux mounts ## v2.0.6-release + ### Issues + * \#42 [bug] Remote mount directory listing on Windows connected to Linux is failing * \#43 [bug] Directories are not importing properly for Sia * \#44 [bug] Windows-to-Linux remote mount ignores `CREATE_NEW` diff --git a/README.md b/README.md index 5010b6c4..6dce6bf1 100644 --- a/README.md +++ b/README.md @@ -89,14 +89,12 @@ username and password. * `--name, -na [name]` * Identifies a unique configuration name to support multiple mounts. * The `--name` option can be set to any valid value allowed as a file name for your filesystem. - * For Sia, the bucket name will be set to the same value if it is empty in the configuration file. - * If the `--name` option is not specified, `default` will be used. - * For S3, the `--name` option is required and does not affect the bucket name. + * The `--name` option is required * `-dc` * Display mount configuration - * For Sia, `--name` is optional - * For S3, the `-s3` option is required along with `--name` + * For Sia, the `--name` option is required + * For S3, the `-s3` and `--name` options are required ### Sia @@ -104,14 +102,8 @@ username and password. * Required steps: * Set the appropriate bucket name and `renterd` API password in `repertory` configuration: - * To use `default` as the bucket name and configuration name, you only need to set the `renterd` API password: - * `repertory -set HostConfig.ApiPassword ''` - * To specify a different bucket name while using `default` as the configuration name: - * `repertory -set HostConfig.ApiPassword ''` - * `repertory -set SiaConfig.Bucket ''` - * For all other configurations: - * `repertory --name '' -set HostConfig.ApiPassword ''` - * `repertory --name '' -set SiaConfig.Bucket ''` + * `repertory --name '' -set HostConfig.ApiPassword ''` + * `repertory --name '' -set SiaConfig.Bucket ''` * Optional steps: * Set a user name used during `renterd` basic authentication: @@ -131,7 +123,7 @@ username and password. * `repertory -dc` * `repertory --name '' -dc` * Example: - * `repertory --name default -dc` + * `repertory --name my_bucket -dc` #### Sia Mounting @@ -139,13 +131,13 @@ username and password. * `repertory /mnt/location` * `repertory --name '' /mnt/location` * Example: - * `repertory --name default /mnt/location` + * `repertory --name my_bucket /mnt/location` * Windows: * `repertory t:` * `repertory --name '' t:` * Example: - * `repertory --name default t:` + * `repertory --name my_bucket t:` #### Sia Configuration File @@ -187,7 +179,7 @@ username and password. "RetryReadCount": 6, "RingBufferFileSize": 512, "SiaConfig": { - "Bucket": "default" + "Bucket": "my_bucket" }, "TaskWaitMs": 100, "Version": 1 diff --git a/repertory/librepertory/src/providers/sia/sia_provider.cpp b/repertory/librepertory/src/providers/sia/sia_provider.cpp index 48f425c1..f07f3dda 100644 --- a/repertory/librepertory/src/providers/sia/sia_provider.cpp +++ b/repertory/librepertory/src/providers/sia/sia_provider.cpp @@ -41,13 +41,6 @@ #include "utils/utils.hpp" namespace { -[[nodiscard]] auto get_bucket(const repertory::sia_config &cfg) -> std::string { - if (cfg.bucket.empty()) { - return "default"; - } - return cfg.bucket; -} - [[nodiscard]] auto get_last_modified(const nlohmann::json &obj) -> std::uint64_t { try { @@ -119,7 +112,7 @@ auto sia_provider::create_directory_impl(const std::string &api_path, curl::requests::http_put_file put_file{}; put_file.allow_timeout = true; put_file.path = "/api/worker/object" + api_path + "/"; - put_file.query["bucket"] = get_bucket(get_sia_config()); + put_file.query["bucket"] = get_sia_config().bucket; std::string error_data; put_file.response_handler = [&error_data](auto &&data, long response_code) { @@ -363,7 +356,7 @@ auto sia_provider::get_object_info(const std::string &api_path, curl::requests::http_get get{}; get.allow_timeout = true; get.path = "/api/bus/object" + api_path; - get.query["bucket"] = get_bucket(get_sia_config()); + get.query["bucket"] = get_sia_config().bucket; get.query["onlymetadata"] = "true"; std::string error_data; @@ -413,7 +406,7 @@ auto sia_provider::get_object_list(const std::string &api_path, curl::requests::http_get get{}; get.allow_timeout = true; get.path = "/api/bus/objects" + api_path + "/"; - get.query["bucket"] = get_bucket(get_sia_config()); + get.query["bucket"] = get_sia_config().bucket; if (marker.has_value()) { get.query["limit"] = "1000"; get.query["marker"] = marker.value(); @@ -464,7 +457,7 @@ auto sia_provider::get_total_drive_space() const -> std::uint64_t { curl::requests::http_get get{}; get.allow_timeout = true; get.path = "/api/bus/autopilot"; - get.query["bucket"] = get_bucket(get_sia_config()); + get.query["bucket"] = get_sia_config().bucket; json config_data; std::string error_data; @@ -581,7 +574,7 @@ auto sia_provider::is_online() const -> bool { curl::requests::http_get get{}; get.allow_timeout = true; get.path = "/api/bus/consensus/state"; - get.query["bucket"] = get_bucket(get_sia_config()); + get.query["bucket"] = get_sia_config().bucket; std::string error_data; json state_data; @@ -675,7 +668,7 @@ auto sia_provider::read_file_bytes(const std::string &api_path, try { curl::requests::http_get get{}; get.path = "/api/worker/object" + api_path; - get.query["bucket"] = get_bucket(get_sia_config()); + get.query["bucket"] = get_sia_config().bucket; get.headers["accept"] = "application/octet-stream"; get.range = {{ offset, @@ -741,7 +734,7 @@ auto sia_provider::remove_directory_impl(const std::string &api_path) curl::requests::http_delete del{}; del.allow_timeout = true; del.path = "/api/bus/object" + api_path + "/"; - del.query["bucket"] = get_bucket(get_sia_config()); + del.query["bucket"] = get_sia_config().bucket; std::string error_data; del.response_handler = [&error_data](auto &&data, long response_code) { @@ -777,7 +770,7 @@ auto sia_provider::remove_file_impl(const std::string &api_path) -> api_error { curl::requests::http_delete del{}; del.allow_timeout = true; del.path = "/api/bus/object" + api_path; - del.query["bucket"] = get_bucket(get_sia_config()); + del.query["bucket"] = get_sia_config().bucket; std::string error_data; del.response_handler = [&error_data](auto &&data, long response_code) { @@ -815,7 +808,7 @@ auto sia_provider::rename_file(const std::string &from_api_path, try { curl::requests::http_post post{}; post.json = nlohmann::json({ - {"bucket", get_bucket(get_sia_config())}, + {"bucket", get_sia_config().bucket}, {"from", from_api_path}, {"to", to_api_path}, {"mode", "single"}, @@ -889,7 +882,7 @@ auto sia_provider::upload_file_impl(const std::string &api_path, curl::requests::http_put_file put_file{}; put_file.path = "/api/worker/object" + api_path; - put_file.query["bucket"] = get_bucket(get_sia_config()); + put_file.query["bucket"] = get_sia_config().bucket; put_file.headers["content-type"] = "application/octet-stream"; put_file.source_path = source_path; diff --git a/repertory/repertory/main.cpp b/repertory/repertory/main.cpp index e24279aa..1794b289 100644 --- a/repertory/repertory/main.cpp +++ b/repertory/repertory/main.cpp @@ -113,14 +113,10 @@ auto main(int argc, char **argv) -> int { if (res == exit_code::success) { unique_id = utils::string::trim(data); if (unique_id.empty()) { - if (prov == provider_type::sia) { - unique_id = "default"; - } else { - std::cerr << "Configuration name for '" - << app_config::get_provider_display_name(prov) - << "' was not provided" << std::endl; - res = exit_code::invalid_syntax; - } + std::cerr << "Configuration name for '" + << app_config::get_provider_display_name(prov) + << "' was not provided" << std::endl; + res = exit_code::invalid_syntax; } } diff --git a/web/repertory/lib/helpers.dart b/web/repertory/lib/helpers.dart index fccfb4a9..b9fc9249 100644 --- a/web/repertory/lib/helpers.dart +++ b/web/repertory/lib/helpers.dart @@ -100,7 +100,7 @@ Map createDefaultSettings(String mountType) { 'ApiPort': 9980, 'HostNameOrIp': 'localhost', }, - 'SiaConfig': {'Bucket': 'default'}, + 'SiaConfig': {'Bucket': ''}, }; } diff --git a/web/repertory/lib/screens/add_mount_screen.dart b/web/repertory/lib/screens/add_mount_screen.dart index 5962d2a1..63eb5313 100644 --- a/web/repertory/lib/screens/add_mount_screen.dart +++ b/web/repertory/lib/screens/add_mount_screen.dart @@ -212,7 +212,7 @@ class _AddMountScreenState extends State { if (_mountType == 'Remote') { _mountNameController.text = 'remote'; } else if (changed) { - _mountNameController.text = mountType == 'Sia' ? 'default' : ''; + _mountNameController.text = ''; } _mount = (_mountNameController.text.isEmpty)