Class: StrokeDB::RemoteStore::DRb::Server
- Defined in:
- lib/strokedb/stores/remote_store.rb
Instance Attribute Summary collapse
-
#addr ⇒ Object
readonly
Returns the value of attribute addr.
-
#store ⇒ Object
readonly
Returns the value of attribute store.
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Instance Method Summary collapse
- #autosync! ⇒ Object
- #document ⇒ Object
- #each(options = {}, &block) ⇒ Object
- #empty? ⇒ Boolean
- #find(*args) ⇒ Object
- #head_version(uuid) ⇒ Object
- #include?(*args) ⇒ Boolean (also: #contains?)
- #index_store ⇒ Object
-
#initialize(store, addr) ⇒ Server
constructor
A new instance of Server.
- #inspect ⇒ Object
- #next_timestamp ⇒ Object
- #save!(document) ⇒ Object
- #search(*args) ⇒ Object
- #start ⇒ Object
- #stop_autosync! ⇒ Object
- #timestamp ⇒ Object
- #uuid ⇒ Object
Constructor Details
#initialize(store, addr) ⇒ Server
Returns a new instance of Server.
101 102 103 104 |
# File 'lib/strokedb/stores/remote_store.rb', line 101 def initialize(store, addr) @store, @addr = store, addr @mutex = Mutex.new end |
Instance Attribute Details
#addr ⇒ Object (readonly)
Returns the value of attribute addr.
100 101 102 |
# File 'lib/strokedb/stores/remote_store.rb', line 100 def addr @addr end |
#store ⇒ Object (readonly)
Returns the value of attribute store.
100 101 102 |
# File 'lib/strokedb/stores/remote_store.rb', line 100 def store @store end |
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
100 101 102 |
# File 'lib/strokedb/stores/remote_store.rb', line 100 def thread @thread end |
Instance Method Details
#autosync! ⇒ Object
159 160 161 |
# File 'lib/strokedb/stores/remote_store.rb', line 159 def autosync! @mutex.synchronize { @store.autosync! } end |
#document ⇒ Object
151 152 153 |
# File 'lib/strokedb/stores/remote_store.rb', line 151 def document @mutex.synchronize { @store.document } end |
#each(options = {}, &block) ⇒ Object
135 136 137 |
# File 'lib/strokedb/stores/remote_store.rb', line 135 def each( = {}, &block) @mutex.synchronize { @store.each(, &block) } end |
#empty? ⇒ Boolean
155 156 157 |
# File 'lib/strokedb/stores/remote_store.rb', line 155 def empty? @mutex.synchronize { @store.empty? } end |
#find(*args) ⇒ Object
111 112 113 |
# File 'lib/strokedb/stores/remote_store.rb', line 111 def find(*args) @mutex.synchronize { @store.find(*args) } end |
#head_version(uuid) ⇒ Object
124 125 126 127 128 |
# File 'lib/strokedb/stores/remote_store.rb', line 124 def head_version(uuid) raw_doc = @mutex.synchronize { find(uuid, nil, :no_instantiation => true) } return raw_doc['version'] if raw_doc nil end |
#include?(*args) ⇒ Boolean Also known as: contains?
119 120 121 |
# File 'lib/strokedb/stores/remote_store.rb', line 119 def include?(*args) !!@mutex.synchronize { @store.include?(*args) } end |
#index_store ⇒ Object
171 172 173 |
# File 'lib/strokedb/stores/remote_store.rb', line 171 def index_store @store.index_store end |
#inspect ⇒ Object
167 168 169 |
# File 'lib/strokedb/stores/remote_store.rb', line 167 def inspect @store.inspect end |
#next_timestamp ⇒ Object
143 144 145 |
# File 'lib/strokedb/stores/remote_store.rb', line 143 def @mutex.synchronize { @store. } end |
#save!(document) ⇒ Object
130 131 132 133 |
# File 'lib/strokedb/stores/remote_store.rb', line 130 def save!(document) document.instance_variable_set(:@store, @store) @mutex.synchronize { @store.save!(document) } end |
#search(*args) ⇒ Object
115 116 117 |
# File 'lib/strokedb/stores/remote_store.rb', line 115 def search(*args) @mutex.synchronize { @store.search(*args) } end |
#start ⇒ Object
106 107 108 109 |
# File 'lib/strokedb/stores/remote_store.rb', line 106 def start ::DRb.start_service(addr, self) @thread = ::DRb.thread end |
#stop_autosync! ⇒ Object
163 164 165 |
# File 'lib/strokedb/stores/remote_store.rb', line 163 def stop_autosync! @mutex.synchronize { @store.stop_autosync! } end |
#timestamp ⇒ Object
139 140 141 |
# File 'lib/strokedb/stores/remote_store.rb', line 139 def @mutex.synchronize { @store. } end |
#uuid ⇒ Object
147 148 149 |
# File 'lib/strokedb/stores/remote_store.rb', line 147 def uuid @store.uuid end |