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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

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

#documentObject



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

#empty?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/stores/remote_store.rb', line 73

def empty?
  @server.empty?
end

#exists?(uuid, version = nil) ⇒ Boolean

Returns:

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



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

def index_store
  @server.index_store
end

#inspectObject



77
78
79
# File 'lib/stores/remote_store.rb', line 77

def inspect
  @server.inspect
end

#next_timestampObject



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

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

#timestampObject



56
57
58
# File 'lib/stores/remote_store.rb', line 56

def timestamp
  @server.timestamp
end

#uuidObject



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

def uuid
  @server.uuid
end