-
Notifications
You must be signed in to change notification settings - Fork 3
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
Option to move restored data to origins. #11
base: master
Are you sure you want to change the base?
Conversation
bb64c44
to
857f75b
Compare
857f75b
to
1ca3cdb
Compare
eblob_kit.py
Outdated
@staticmethod | ||
def move_back(from_index, to_index): | ||
"""Move underlying file(s) between specified pathes.""" | ||
if not to_index.endswith(SORTED_INDEX_SUFFIX): |
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.
if from_index.endswith(SORTED_INDEX_SUFFIX) == to_index.endswith(SORTED_INDEX_SUFFIX):
shutil.move(src=from_index, dst=to_index)
else:
temporary_name = to_index + TO_REMOVE_SUFFIX
shutil.move(src=to_index, dst=temporary_name)
shutil.move(src=from_index, dst=to_index)
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.
fixed.
eblob_kit.py
Outdated
self._file.close() | ||
|
||
@staticmethod | ||
def move_back(from_index, to_index): |
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.
Why isn't it just a method of IndexFile
:
def move(self, path):
shutil.move(self.path, path)
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.
It was implemented likewise in first version of this PR, but it seems a violation of class api, as 'user' can freely call move
for entity in wrong state, e.g. before any file was closed or written. It could be combined close_and_move
method here, but it looks more rigid then current version.
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.
It could be made via close, move, re-open
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.
Also it could be made without close and re-open within one filesystem via os.rename()
.
4f03d3b
to
ab3ca41
Compare
Updated, based on review. @shaitan, PTAL. |
132a529
to
0d9e2b1
Compare
0d9e2b1
to
81e86a9
Compare
TODO: