Class: StrokeDB::RemoteStore::DRb::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/strokedb/stores/remote_store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#addrObject (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

#documentObject



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(options = {})
  @server.each(options) do |doc_without_store|
    safe_document_from_undumped(doc_without_store)
  end
end

#empty?Boolean

Returns:

  • (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?

Returns:

  • (Boolean)


36
37
38
# File 'lib/strokedb/stores/remote_store.rb', line 36

def include?(uuid, version=nil)
  @server.include?(uuid, version)
end

#index_storeObject



86
87
88
# File 'lib/strokedb/stores/remote_store.rb', line 86

def index_store
  @server.index_store
end

#inspectObject



82
83
84
# File 'lib/strokedb/stores/remote_store.rb', line 82

def inspect
  @server.inspect
end

#next_timestampObject



65
66
67
# File 'lib/strokedb/stores/remote_store.rb', line 65

def next_timestamp
  @server.next_timestamp
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

#timestampObject



61
62
63
# File 'lib/strokedb/stores/remote_store.rb', line 61

def timestamp
  @server.timestamp
end

#uuidObject



69
70
71
# File 'lib/strokedb/stores/remote_store.rb', line 69

def uuid
  @server.uuid
end