Module: Couchbase::Async
- Included in:
- Bucket
- Defined in:
- lib/couchbase/async.rb,
lib/couchbase/async/queue.rb,
lib/couchbase/async/callback.rb
Defined Under Namespace
Instance Method Summary collapse
- #async ⇒ Object
- #async=(val) ⇒ Object
- #async? ⇒ Boolean
- #async_queue ⇒ Object
- #end_async_queue ⇒ Object
-
#run(options = {}) {|bucket| ... } ⇒ nil
Run the event loop.
- #run_async(options = {}) ⇒ Object
- #running ⇒ Object
- #running=(val) ⇒ Object
- #running? ⇒ Boolean
Instance Method Details
#async ⇒ Object
28 29 30 |
# File 'lib/couchbase/async.rb', line 28 def async Thread.current[:bucket_async] ||= @async end |
#async=(val) ⇒ Object
32 33 34 |
# File 'lib/couchbase/async.rb', line 32 def async=(val) Thread.current[:bucket_async] = val end |
#async? ⇒ Boolean
24 25 26 |
# File 'lib/couchbase/async.rb', line 24 def async? !!async end |
#async_queue ⇒ Object
48 49 50 |
# File 'lib/couchbase/async.rb', line 48 def async_queue Thread.current[:bucket_async_queue] ||= Couchbase::Async::Queue.new(self) end |
#end_async_queue ⇒ Object
52 53 54 |
# File 'lib/couchbase/async.rb', line 52 def end_async_queue Thread.current[:bucket_async_queue] = nil end |
#run(options = {}) {|bucket| ... } ⇒ nil
Run the event loop.
105 106 107 108 109 110 111 112 113 114 |
# File 'lib/couchbase/async.rb', line 105 def run( = {}) do_async_setup(block_given?) yield(self) async_queue.join # TODO: deal with exceptions nil ensure do_async_ensure end |
#run_async(options = {}) ⇒ Object
116 117 118 119 120 121 122 |
# File 'lib/couchbase/async.rb', line 116 def run_async( = {}) do_async_setup(block_given?) yield(self) nil ensure do_async_ensure end |
#running ⇒ Object
40 41 42 |
# File 'lib/couchbase/async.rb', line 40 def running Thread.current[:bucket_running] ||= false end |
#running=(val) ⇒ Object
44 45 46 |
# File 'lib/couchbase/async.rb', line 44 def running=(val) Thread.current[:bucket_running] = val end |
#running? ⇒ Boolean
36 37 38 |
# File 'lib/couchbase/async.rb', line 36 def running? !!running end |