Skip to content
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

Implement collaborative locking #2248

Merged
merged 8 commits into from
Apr 21, 2022
Merged

Implement collaborative locking #2248

merged 8 commits into from
Apr 21, 2022

Conversation

juliusknorr
Copy link
Member

@juliusknorr juliusknorr commented Mar 23, 2022

  • Lock/unlock a file when opening/closing
  • Open files in read only mode when locked
  • Indicate other lock in the UI
  • Safeguard unlocking through the cleanup cronjob if no close request was sent
  • Changing ETag on lock/unlock causes a conflict, so we either need a way to still propagate the change to the root without changing the actual file tag for shares as mentioned in Collaborative locking files_lock#54 or adjust the change detection in text to maybe also compare the mtime in addition

To be tested together with nextcloud/files_lock#54

Signed-off-by: Julius Härtl <jus@bitgrid.net>

TMP: Switch to OCP branch for tests

Signed-off-by: Julius Härtl <jus@bitgrid.net>

Let locked files open in read only

Signed-off-by: Julius Härtl <jus@bitgrid.net>

Adapt LockScope to LockContext rename

Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
@juliusknorr juliusknorr marked this pull request as ready for review April 21, 2022 14:04
Signed-off-by: Julius Härtl <jus@bitgrid.net>
@juliusknorr
Copy link
Member Author

/compile amend /

Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Copy link
Member

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. A few minor remarks.

lib/Service/ApiService.php Show resolved Hide resolved
lib/Service/DocumentService.php Show resolved Hide resolved
lib/Service/DocumentService.php Show resolved Hide resolved
$this->lockManager->lock(new LockContext(
$file,
ILock::TYPE_APP,
Application::APP_NAME
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of topic but this could become Application::APP_ID at some point.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, something for a separate PR.

Application::APP_NAME
));
} catch (NoLockProviderException $e) {
} catch (PreConditionNotMetException $e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No warning logs here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd let the actual lock provider handle that, from the text app side there is no special interest if we unlock a file that has already been unlocked.

@juliusknorr juliusknorr merged commit d61932e into master Apr 21, 2022
@delete-merged-branch delete-merged-branch bot deleted the enh/locking branch April 21, 2022 16:08
@juliusknorr
Copy link
Member Author

/backport to stable24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review backported successfully backported enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants