Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add Optimistic Locking #286
In Hyrax/ActiveFedora, we can use the Etag to do optimistic locking. Does Valkyrie have a mechanism for doing this?
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)