lib/rocket_job/batch/model.rb in rocketjob-5.0.0 vs lib/rocket_job/batch/model.rb in rocketjob-5.1.0

- old
+ new

@@ -39,10 +39,20 @@ # The file name of the uploaded file, if any. # Set by #upload if a file name was supplied, but can also be set explicitly. # May or may not include the fully qualified path name. field :upload_file_name, type: String + # Compress uploaded records. + # The fields are not affected in any way, only the data stored in the + # records and results collections will compressed + field :compress, type: Boolean, default: false, class_attribute: true + + # Encrypt uploaded records. + # The fields are not affected in any way, only the data stored in the + # records and results collections will be encrypted + field :encrypt, type: Boolean, default: false, class_attribute: true + # # Values that jobs can also update during processing # # Number of records in this job @@ -69,9 +79,19 @@ Array(value).each do |category| record.errors.add(attr, 'must only contain Symbol values') unless category.kind_of?(Symbol) record.errors.add(attr, 'must only consist of lowercase characters, digits, and _') unless category.to_s =~ /\A[a-z_0-9]+\Z/ end end + end + + # Returns [true|false] whether the slices for this job are encrypted + def encrypted? + encrypt == true + end + + # Returns [true|false] whether the slices for this job are compressed + def compressed? + compress == true end # Returns [Integer] percent of records completed so far # Returns 0 if the total record count has not yet been set def percent_complete