Sha256: fb3e37a8d973a7e51a7a98fbb14a51c8c5129c9aa1fa1931a69616f6ec8d7485
Contents?: true
Size: 1.73 KB
Versions: 2
Compression:
Stored size: 1.73 KB
Contents
require 'resque' require 'rhosync/jobs/bulk_data_job' module Rhosync class BulkData < Model field :name, :string field :state, :string field :app_id, :string field :user_id, :string field :refresh_time, :integer field :dbfile,:string set :sources, :string validates_presence_of :app_id, :user_id, :sources def completed? if state.to_sym == :completed and dbfile and File.exist?(dbfile) return true end false end def delete sources.members.each do |source| s = Source.load(source,{:app_id => app_id, :user_id => user_id}) Store.flash_data(s.docname(:md_copy)) if s end super end def process_sources sources.members.each do |source| s = Source.load(source,{:app_id => app_id, :user_id => user_id}) if s SourceSync.new(s).process_query(nil) s.clone(:md,:md_copy) unless s.sync_type.to_sym == :bulk_sync_only end end end def url dbfile end class << self def create(fields={}) fields[:id] = fields[:name] fields[:state] ||= :inprogress fields[:sources] ||= [] super(fields) end def enqueue(params={}) Resque.enqueue(BulkDataJob,params) end def get_name(partition,client) if partition == :user File.join(client.app_id,client.user_id,client.user_id) else File.join(client.app_id,client.app_id) end end def schema_file File.join(File.dirname(__FILE__),'syncdb.schema') end def index_file File.join(File.dirname(__FILE__),'syncdb.index.schema') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rhosync-2.0.0.beta2 | lib/rhosync/bulk_data/bulk_data.rb |
rhosync-2.0.0.beta1 | lib/rhosync/bulk_data/bulk_data.rb |