Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,12 @@ The `transfer_max_retries` configuration property specifies the maximum number o
When uploading files to Cirro, network issues or temporary outages can occasionally cause a transfer to fail.
It will pause for an increasing amount of time for each retry attempt.

The `enable_additional_checksums` property manages the utilization of SHA-256 hashing for enhanced data integrity.
This feature computes the SHA-256 hash of a file during the upload process, and subsequently cross-validates it with the server upon completion.
When retrieving files, it ensures that the hash received matches the server's stored hash.
The default hashing algorithm for files is CRC64. In many cases, CRC64 is sufficient to ensure data integrity upon upload.

```ini
[General]
base_url = cirro.bio
transfer_max_retries = 15
enable_additional_checksums = true
```

### Clearing saved login
Expand Down
5 changes: 2 additions & 3 deletions cirro/cli/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,11 @@ def run_upload_reference(input_params: UploadReferenceArguments, interactive=Fal


def run_configure():
auth_method, base_url, auth_method_config, enable_additional_checksum = gather_auth_config()
auth_method, base_url, auth_method_config = gather_auth_config()
save_user_config(UserConfig(auth_method=auth_method,
auth_method_config=auth_method_config,
base_url=base_url,
transfer_max_retries=None,
enable_additional_checksum=enable_additional_checksum))
transfer_max_retries=None))


def run_create_pipeline_config(input_params: CreatePipelineConfigArguments, interactive=False):
Expand Down
10 changes: 2 additions & 8 deletions cirro/cli/interactive/auth_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
logger = logging.getLogger()


def gather_auth_config() -> Tuple[str, str, Dict, bool]:
def gather_auth_config() -> Tuple[str, str, Dict]:
base_url = ask(
'text',
'Enter the URL of the Cirro instance you\'d like to connect to:'
Expand All @@ -19,10 +19,4 @@ def gather_auth_config() -> Tuple[str, str, Dict, bool]:
'enable_cache': ask_yes_no('Would you like to save your login? (do not use this on shared devices)')
}

enable_additional_checksum = ask(
'select',
'Upload / download file validation type (note: SHA-256 requires additional local compute)',
choices=['CRC64 (default)', 'SHA-256']
) == 'SHA-256'

return 'ClientAuth', base_url, auth_method_config, enable_additional_checksum
return 'ClientAuth', base_url, auth_method_config
9 changes: 2 additions & 7 deletions cirro/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class UserConfig(NamedTuple):
auth_method_config: Dict # This needs to match the init params of the auth method
base_url: Optional[str]
transfer_max_retries: Optional[int]
enable_additional_checksum: Optional[bool]


def extract_base_url(base_url: str):
Expand Down Expand Up @@ -59,7 +58,6 @@ def load_user_config() -> Optional[UserConfig]:
auth_method = main_config.get('auth_method')
base_url = main_config.get('base_url')
transfer_max_retries = main_config.getint('transfer_max_retries', Constants.default_max_retries)
enable_additional_checksum = main_config.getboolean('enable_additional_checksum', False)

if auth_method and ini_config.has_section(auth_method):
auth_method_config = dict(ini_config[auth_method])
Expand All @@ -70,8 +68,7 @@ def load_user_config() -> Optional[UserConfig]:
auth_method=auth_method,
auth_method_config=auth_method_config,
base_url=base_url,
transfer_max_retries=transfer_max_retries,
enable_additional_checksum=enable_additional_checksum
transfer_max_retries=transfer_max_retries
)
except Exception:
raise RuntimeError('Configuration load error, please re-run configuration')
Expand All @@ -90,8 +87,6 @@ def __init__(self, base_url: str = None):
self.base_url = re.compile(r'https?://').sub('', self.base_url).strip()
self.transfer_max_retries = self.user_config.transfer_max_retries\
if self.user_config else Constants.default_max_retries
self.enable_additional_checksum = self.user_config.enable_additional_checksum\
if self.user_config else False
self._init_config()

@property
Expand All @@ -100,7 +95,7 @@ def checksum_method_display(self):

@property
def checksum_method(self):
return 'SHA-256' if self.enable_additional_checksum else 'CRC64NVME'
return 'CRC64NVME'

def _init_config(self):
self.rest_endpoint = f'https://{self.base_url}/api'
Expand Down
Loading