Class: StrokeDB::RemoteStore::DRb::Client
- Defined in:
- lib/strokedb/stores/remote_store.rb
Instance Attribute Summary collapse
-
#addr ⇒ Object
readonly
Returns the value of attribute addr.
Instance Method Summary collapse
- #document ⇒ Object
- #each(options = {}) ⇒ Object
- #empty? ⇒ Boolean
- #find(*args) ⇒ Object
- #head_version(uuid) ⇒ Object
- #include?(uuid, version = nil) ⇒ Boolean (also: #contains?)
- #index_store ⇒ Object
-
#initialize(addr) ⇒ Client
constructor
A new instance of Client.
- #inspect ⇒ Object
- #next_timestamp ⇒ Object
- #save!(*args) ⇒ Object
- #search(*args) ⇒ Object
- #timestamp ⇒ Object
- #uuid ⇒ Object
Constructor Details
#initialize(addr) ⇒ Client
Returns a new instance of Client.
22 23 24 25 26 |
# File 'lib/strokedb/stores/remote_store.rb', line 22 def initialize(addr) @addr = addr ::DRb.start_service @server = ::DRbObject.new(nil, addr) end |
Instance Attribute Details
#addr ⇒ Object (readonly)
Returns the value of attribute addr.
20 21 22 |
# File 'lib/strokedb/stores/remote_store.rb', line 20 def addr @addr end |
Instance Method Details
#document ⇒ Object
73 74 75 76 |
# File 'lib/strokedb/stores/remote_store.rb', line 73 def document result = @server.document safe_document_from_undumped(result) end |
#each(options = {}) ⇒ Object
55 56 57 58 59 |
# File 'lib/strokedb/stores/remote_store.rb', line 55 def each( = {}) @server.each() do |doc_without_store| safe_document_from_undumped(doc_without_store) end end |
#empty? ⇒ Boolean
78 79 80 |
# File 'lib/strokedb/stores/remote_store.rb', line 78 def empty? @server.empty? end |
#find(*args) ⇒ Object
28 29 30 |
# File 'lib/strokedb/stores/remote_store.rb', line 28 def find(*args) safe_document_from_undumped(@server.find(*args)) end |
#head_version(uuid) ⇒ Object
41 42 43 44 45 |
# File 'lib/strokedb/stores/remote_store.rb', line 41 def head_version(uuid) raw_doc = find(uuid,nil, :no_instantiation => true) return raw_doc['version'] if raw_doc nil end |
#include?(uuid, version = nil) ⇒ Boolean Also known as: contains?
36 37 38 |
# File 'lib/strokedb/stores/remote_store.rb', line 36 def include?(uuid, version=nil) @server.include?(uuid, version) end |
#index_store ⇒ Object
86 87 88 |
# File 'lib/strokedb/stores/remote_store.rb', line 86 def index_store @server.index_store end |
#inspect ⇒ Object
82 83 84 |
# File 'lib/strokedb/stores/remote_store.rb', line 82 def inspect @server.inspect end |
#next_timestamp ⇒ Object
65 66 67 |
# File 'lib/strokedb/stores/remote_store.rb', line 65 def @server. end |
#save!(*args) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/strokedb/stores/remote_store.rb', line 47 def save!(*args) result = @server.save!(*args) if result.is_a?(Document) safe_document_from_undumped(result) end result end |
#search(*args) ⇒ Object
32 33 34 |
# File 'lib/strokedb/stores/remote_store.rb', line 32 def search(*args) @server.search(*args).map{ |e| safe_document_from_undumped(e) } end |
#timestamp ⇒ Object
61 62 63 |
# File 'lib/strokedb/stores/remote_store.rb', line 61 def @server. end |
#uuid ⇒ Object
69 70 71 |
# File 'lib/strokedb/stores/remote_store.rb', line 69 def uuid @server.uuid end |