module Bramble

Constants

CONF
VERSION

Public Class Methods

config() { |CONF| ... } click to toggle source
# File lib/bramble.rb, line 19
def self.config
  if block_given?
    yield(Bramble::CONF)
  else
    Bramble::CONF
  end
end
delete(handle) click to toggle source

Remove results for `handle`, if there are any

# File lib/bramble.rb, line 48
def self.delete(handle)
  Bramble::State.clear_job(handle)
end
delete_all() click to toggle source

Clear all data from Bramble runs

# File lib/bramble.rb, line 53
def self.delete_all
  Bramble::Storage.delete_all
end
get(handle) click to toggle source

@return [Bramble::Result] Status & data for this handle

# File lib/bramble.rb, line 43
def self.get(handle)
  Bramble::Result.new(handle)
end
map_reduce(handle, implementation, items_options = {}) click to toggle source

@param handle [String] This string will be used to store the result @param implementation [.map, .reduce, .name, .items(options)] The container of map and reduce methods @param items_options [Object] will be passed to .items

# File lib/bramble.rb, line 30
def self.map_reduce(handle, implementation, items_options = {})
  # Secret feature: the implementation can provide a job_id
  job_id = if implementation.respond_to?(:job_id)
    implementation.job_id
  else
    Time.now.strftime("%s%6N")
  end
  handle = "#{handle}:#{job_id}"
  Bramble::State.start_job(handle)
  Bramble::BeginJob.perform_later(handle, implementation.name, items_options)
end