-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adapted tokens to be external, CI now builds and installs the package, and unit tests are now using the installed package. #7
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The most important comment I have is to please be sure to carve the Auth
of the client object. As we discussed, Auth should be handled outside, this means it should not be used anywhere inside.
5b4613d
to
c642451
Compare
e1a6843
to
70a2f42
Compare
cs3client/file.py
Outdated
# if the storage does not support locks, set the lock using xattr | ||
if res.status.code == cs3code.CODE_UNIMPLEMENTED and self._config.lock_by_setting_attr: | ||
self._config.lock_not_impl = True | ||
self.set_lock(auth_token, resource, app_name, lock_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point you can directly call _set_lock_using_xattr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that you changed it in this particular line. But when you have the same logic in different places, the idea is that you do the same for all of them :)
cs3client/file.py
Outdated
self._log.debug(f'msg="Using xattrs to execute RefreshLock" {resource.get_file_ref_str()}" value="{lock_id}"') | ||
try: | ||
currvalue = self.stat(auth_token, resource).arbitrary_metadata.metadata[LOCK_ATTR_KEY] | ||
if currvalue.split("!")[0] == app_name \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the split only once
The tokens are now handled externally to allow parallelism (makes the package stateless) which allows to user to reuse the connection in multiple threads. Methods for handling token operations (check_token, get_token) are still available and public to the user.
The CI has also been updated to build the package and install it using pip and the package structure has been corrected because of this. The unit tests now use the package that is installed instead of importing directly from the .py files, changes in the source code has also been made to reflect this change. This change is important because it tests that the package works as it should as a package.
The lock functionality has also been added.