Class: Ruote::Couch::WfidIndexedDatabase

Inherits:
Database
  • Object
show all
Defined in:
lib/ruote/couch/database.rb

Overview

A Couch database with a by_wfid view.

Direct Known Subclasses

WorkitemDatabase

Instance Attribute Summary

Attributes inherited from Database

#couch, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Database

#delete, #dump, #get, #ids, #initialize, #purge!, #put, #shutdown

Constructor Details

This class inherits a constructor from Ruote::Couch::Database

Class Method Details

.design_docObject

Returns the design document that goes with this class of database



190
191
192
193
# File 'lib/ruote/couch/database.rb', line 190

def self.design_doc

  self.allocate.send(:design_doc)
end

Instance Method Details

#by_wfid(wfid) ⇒ Object

Used by WorkitemDatabase#query



183
184
185
186
# File 'lib/ruote/couch/database.rb', line 183

def by_wfid (wfid)

  get_many(wfid, {})
end

#get_many(key, opts) ⇒ Object

The get_many used by errors, expressions and schedules.



172
173
174
175
176
177
178
179
# File 'lib/ruote/couch/database.rb', line 172

def get_many (key, opts)

  return super(key, opts) unless key.is_a?(String)

  # key is a wfid

  @couch.query_for_docs('ruote:by_wfid', :key => key)
end