Remove 'default' as initial bucket name for Sia #54
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				BlockStorage/repertory/pipeline/head This commit looks good
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	BlockStorage/repertory/pipeline/head This commit looks good
				
			This commit is contained in:
		| @@ -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 | ||||
|  | ||||
| <!-- markdownlint-disable-next-line --> | ||||
| ### 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` | ||||
|   | ||||
							
								
								
									
										26
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								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 '<my password>'` | ||||
|     * To specify a different bucket name while using `default` as the configuration name: | ||||
|       * `repertory -set HostConfig.ApiPassword '<my password>'` | ||||
|       * `repertory -set SiaConfig.Bucket '<my bucket>'` | ||||
|     * For all other configurations: | ||||
|       * `repertory --name '<my config name>' -set HostConfig.ApiPassword '<my password>'` | ||||
|       * `repertory --name '<my config name>' -set SiaConfig.Bucket '<my bucket name>'` | ||||
|     * `repertory --name '<my config name>' -set HostConfig.ApiPassword '<my password>'` | ||||
|     * `repertory --name '<my config name>' -set SiaConfig.Bucket '<my bucket name>'` | ||||
|  | ||||
| * Optional steps: | ||||
|   * Set a user name used during `renterd` basic authentication: | ||||
| @@ -131,7 +123,7 @@ username and password. | ||||
|   * `repertory -dc` | ||||
|   * `repertory --name '<my config 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 '<my config name>' /mnt/location` | ||||
|     * Example: | ||||
|       * `repertory --name default /mnt/location` | ||||
|       * `repertory --name my_bucket /mnt/location` | ||||
|  | ||||
| * Windows: | ||||
|   * `repertory t:` | ||||
|   * `repertory --name '<my config 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 | ||||
|   | ||||
| @@ -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; | ||||
|  | ||||
|   | ||||
| @@ -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; | ||||
|         } | ||||
|       } | ||||
|  | ||||
|   | ||||
| @@ -100,7 +100,7 @@ Map<String, dynamic> createDefaultSettings(String mountType) { | ||||
|           'ApiPort': 9980, | ||||
|           'HostNameOrIp': 'localhost', | ||||
|         }, | ||||
|         'SiaConfig': {'Bucket': 'default'}, | ||||
|         'SiaConfig': {'Bucket': ''}, | ||||
|       }; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -212,7 +212,7 @@ class _AddMountScreenState extends State<AddMountScreen> { | ||||
|       if (_mountType == 'Remote') { | ||||
|         _mountNameController.text = 'remote'; | ||||
|       } else if (changed) { | ||||
|         _mountNameController.text = mountType == 'Sia' ? 'default' : ''; | ||||
|         _mountNameController.text = ''; | ||||
|       } | ||||
|  | ||||
|       _mount = (_mountNameController.text.isEmpty) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user