Class: StrokeDB::RemoteStore::DRb::Client
- Defined in:
- lib/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
- #exists?(uuid, version = nil) ⇒ Boolean
- #find(*args) ⇒ Object
- #head_version(uuid) ⇒ Object
- #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.
18 19 20 21 22 |
# File 'lib/stores/remote_store.rb', line 18 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.
16 17 18 |
# File 'lib/stores/remote_store.rb', line 16 def addr @addr end |
Instance Method Details
#document ⇒ Object
68 69 70 71 |
# File 'lib/stores/remote_store.rb', line 68 def document result = @server.document safe_document_from_undumped(result) end |
#each(options = {}) ⇒ Object
50 51 52 53 54 |
# File 'lib/stores/remote_store.rb', line 50 def each( = {}) @server.each() do |doc_without_store| safe_document_from_undumped(doc_without_store) end end |
#empty? ⇒ Boolean
73 74 75 |
# File 'lib/stores/remote_store.rb', line 73 def empty? @server.empty? end |
#exists?(uuid, version = nil) ⇒ Boolean
32 33 34 |
# File 'lib/stores/remote_store.rb', line 32 def exists?(uuid, version=nil) @server.exists?(uuid, version) end |
#find(*args) ⇒ Object
24 25 26 |
# File 'lib/stores/remote_store.rb', line 24 def find(*args) safe_document_from_undumped(@server.find(*args)) end |
#head_version(uuid) ⇒ Object
36 37 38 39 40 |
# File 'lib/stores/remote_store.rb', line 36 def head_version(uuid) raw_doc = find(uuid,nil, :no_instantiation => true) return raw_doc['version'] if raw_doc nil end |
#index_store ⇒ Object
81 82 83 |
# File 'lib/stores/remote_store.rb', line 81 def index_store @server.index_store end |
#inspect ⇒ Object
77 78 79 |
# File 'lib/stores/remote_store.rb', line 77 def inspect @server.inspect end |
#next_timestamp ⇒ Object
60 61 62 |
# File 'lib/stores/remote_store.rb', line 60 def @server. end |
#save!(*args) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/stores/remote_store.rb', line 42 def save!(*args) result = @server.save!(*args) if result.is_a?(Document) safe_document_from_undumped(result) end result end |
#search(*args) ⇒ Object
28 29 30 |
# File 'lib/stores/remote_store.rb', line 28 def search(*args) @server.search(*args).map{ |e| safe_document_from_undumped(e) } end |
#timestamp ⇒ Object
56 57 58 |
# File 'lib/stores/remote_store.rb', line 56 def @server. end |
#uuid ⇒ Object
64 65 66 |
# File 'lib/stores/remote_store.rb', line 64 def uuid @server.uuid end |