Sha256: 0eeec918a102ee2ea43b976505fd8d40cca49cee3ebc5a70138bb969bf278a06
Contents?: true
Size: 1.18 KB
Versions: 9
Compression:
Stored size: 1.18 KB
Contents
module Filbunke class Callbacks def initialize(logger, config = {}) @config = config @logger = logger num_callback_threads = @config["num_callback_threads"].to_i num_callback_processes = @config["num_callback_processes"].to_i if num_callback_threads == 0 and num_callback_processes == 0 @config["num_callback_threads"] = Parallel.processor_count end @parallel_callback_opts = (num_callback_threads > 0 ? {:in_threads => num_callback_threads} : {:in_processes => num_callback_processes}) end def on_update_batch(files) Parallel.map(files, @parallel_callback_opts) do |item| on_update(item.file, item.local_file_path) end end def on_update(file, local_file_path) end def on_no_change_batch(files) Parallel.map(files, @parallel_callback_opts) do |item| on_no_change(item.file, item.local_file_path) end end def on_no_change(file, local_file_path) end def on_delete_batch(files) Parallel.map(files, @parallel_callback_opts) do |item| on_delete(item.file, item.local_file_path) end end def on_delete(file, local_file_path) end end end
Version data entries
9 entries across 9 versions & 1 rubygems