lib/ruote/part/storage_participant.rb
# Claims a workitem. Returns the [updated] workitem if successful.
#
# Returns nil if the workitem is already reserved.
#
# Fails if the workitem can't be found, is gone, or got modified
# elsewhere.
#
# Here is a mini-diagram explaining the reserve/delegate/proceed flow:
#
#    in    delegate(nil)    delegate(other)
#    |    +---------------+ +------+
#    v    v               | |      v
#   +-------+  reserve   +----------+  proceed
#   | ready | ---------> | reserved | ---------> out
#   +-------+            +----------+
#
Claims a workitem. Returns the [updated] workitem if successful.
Returns nil if the workitem is already reserved.

Fails if the workitem can't be found, is gone, or got modified
elsewhere.

Here is a mini-diagram explaining the reserve/delegate/proceed flow.


Claims a workitem . Returns the [ updated ] workitem if successful . Returns nil if the workitem is already reserved . Fails if the workitem can ' t be found is gone or got modified elsewhere . Here is a mini - diagram explaining the reserve / delegate / proceed flow .
def reserve(workitem_or_fei, owner)
      hwi = fetch(workitem_or_fei)
      fail ArgumentError.new("workitem not found") if hwi.nil?
      return nil if hwi['owner'] && hwi['owner'] != owner
      hwi['owner'] = owner
      r = @context.storage.put(hwi, :update_rev => true)
      fail ArgumentError.new("workitem is gone") if r == true
      fail ArgumentError.new("workitem got modified meanwhile") if r != nil
      Workitem.new(hwi)
    end
def reserve ( workitem_or_fei , owner ) hwi = fetch ( workitem_or_fei ) fail ArgumentError . new ( "workitem not found" ) if hwi . nil? return nil if hwi [ 'owner' ] && hwi [ 'owner' ] != owner hwi [ 'owner' ] = owner r = @context . storage . put ( hwi , :update_rev => true ) fail ArgumentError . new ( "workitem is gone" ) if r == true fail ArgumentError . new ( "workitem got modified meanwhile" ) if r != nil Workitem . new ( hwi ) end
Claims a workitem.
Claims a workitem .
workitem_or_fei
owner