-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add Optimistic Locking #286
Comments
No. I've been thinking about this lately and trying to decide what the correct mechanism for this would be. Something like AR where there's a special |
Proposed Success Criteria: class Resource < Valkyrie::Resource
attribute :title
attribute :lock_key # Reserved attribute for when you want to enable optimistic locking
end
resource_1 = persister.save(resource: Resource.new)
resource_1.lock_key # => "unique1" # Set by the persister.
resource_1.title = ["test"]
resource_2 = persister.save(resource: resource_1)
resource_2.lock_key # => "unique2" # Set by the persister.
resource_1.title = ["test2"]
persister.save(resource: resource_1) # => Valkyrie::Persistence::StaleObjectError # Raised because resource_1.lock_key does not match the lock_key in the database (resource_2.lock_key) |
Alternative API: class Resource < Valkyrie::Resource
optimistic_locking
attribute :title
end |
This was referenced Jul 18, 2018
hackartisan
added a commit
that referenced
this issue
Jul 30, 2018
connected to #286 connected to #453 Co-authored-by: Adam Wead <[email protected]> Co-authored-by: Michael Tribone <[email protected]>
hackartisan
added a commit
that referenced
this issue
Jul 30, 2018
connected to #286 connected to #453 Co-authored-by: Adam Wead <[email protected]> Co-authored-by: Michael Tribone <[email protected]>
hackartisan
added a commit
that referenced
this issue
Jul 30, 2018
connected to #286 connected to #453 Co-authored-by: Adam Wead <[email protected]> Co-authored-by: Michael Tribone <[email protected]>
hackartisan
added a commit
that referenced
this issue
Jul 30, 2018
connected to #286 connected to #453 Co-authored-by: Adam Wead <[email protected]> Co-authored-by: Michael Tribone <[email protected]>
This was referenced Jul 31, 2018
This was referenced Aug 3, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Hyrax/ActiveFedora, we can use the Etag to do optimistic locking. Does Valkyrie have a mechanism for doing this?
See:
https://github.com/samvera/hyrax/blob/master/app/actors/hyrax/actors/optimistic_lock_validator.rb
The text was updated successfully, but these errors were encountered: