module Sequel::Database::AsyncThreadPool::DatasetMethods
Public Class Methods
Source
# File lib/sequel/extensions/async_thread_pool.rb 410 def self.define_async_args_or_block_method(mod, method) 411 mod.send(:define_method, method) do |*args, &block| 412 if (block || !args.empty?) && @opts[:async] 413 ds = sync 414 db.send(:async_run){ds.send(method, *args, &block)} 415 else 416 super(*args, &block) 417 end 418 end 419 end
Define an method in the given module that will run the given method using an async thread if the current dataset is async and arguments or a block is provided.
Calls superclass method
Source
# File lib/sequel/extensions/async_thread_pool.rb 397 def self.define_async_block_method(mod, method) 398 mod.send(:define_method, method) do |*args, &block| 399 if block && @opts[:async] 400 ds = sync 401 db.send(:async_run){ds.send(method, *args, &block)} 402 else 403 super(*args, &block) 404 end 405 end 406 end
Define an method in the given module that will run the given method using an async thread if the current dataset is async and a block is provided.
Calls superclass method
Source
# File lib/sequel/extensions/async_thread_pool.rb 384 def self.define_async_method(mod, method) 385 mod.send(:define_method, method) do |*args, &block| 386 if @opts[:async] 387 ds = sync 388 db.send(:async_run){ds.send(method, *args, &block)} 389 else 390 super(*args, &block) 391 end 392 end 393 end
Define an method in the given module that will run the given method using an async thread if the current dataset is async.
Calls superclass method
Public Instance Methods
Source
# File lib/sequel/extensions/async_thread_pool.rb 429 def async 430 cached_dataset(:_async) do 431 clone(:async=>true) 432 end 433 end
Return a cloned dataset that will load results using the async thread pool.
Source
# File lib/sequel/extensions/async_thread_pool.rb 437 def sync 438 cached_dataset(:_sync) do 439 clone(:async=>false) 440 end 441 end
Return a cloned dataset that will not load results using the async thread pool. Only used if the current dataset has been marked as using the async thread pool.