lib/filestack/utils/utils.rb
# Chunk a specific job into offests
#
# @param [Dict]               job             Dictionary with all job options
# @param [IntelligentState]   state           An IntelligentState object
# @param [String]             apikey          Filestack API key
# @param [String]             filename        Name of incoming file
# @param [String]             filepath        Local path to the file
# @param [Int]                filesize        Size of incoming file
# @param [Typhoeus::Response]  start_response  Response body from
#                                             multipart_start
#
# @return [Dict]
Chunk a specific job into offests
Chunk a specific job into offests
def chunk_job(job, state, apikey, filename, filesize, start_response, storage)
    offset = 0
    seek_point = job[:seek_point]
    chunk_list = []
    while (offset < FilestackConfig::DEFAULT_CHUNK_SIZE) && (seek_point + offset) < filesize
      chunk_list.push(
        seek_point: seek_point,
        filename: filename,
        apikey: apikey,
        part: job[:part],
        size: job[:size],
        uri: start_response['uri'],
        region: start_response['region'],
        upload_id: start_response['upload_id'],
        location_url: start_response['location_url'],
        store: { location: storage },
        offset: offset
      )
      offset += state.offset
    end
    chunk_list
  end
def chunk_job ( job , state , apikey , filename , filesize , start_response , storage ) offset = 0 seek_point = job [ :seek_point ] chunk_list = [ ] while ( offset < FilestackConfig :: DEFAULT_CHUNK_SIZE ) && ( seek_point + offset ) < filesize chunk_list . push ( seek_point : seek_point , filename : filename , apikey : apikey , part : job [ :part ] , size : job [ :size ] , uri : start_response [ 'uri' ] , region : start_response [ 'region' ] , upload_id : start_response [ 'upload_id' ] , location_url : start_response [ 'location_url' ] , store : { location : storage } , offset : offset ) offset += state . offset end chunk_list end
Chunk a specific job into offests
Chunk a specific job into offests
None
Dict
job
<not_specific>
state
<not_specific>
apikey
<not_specific>
filename
<not_specific>
filesize
<not_specific>
start_response
<not_specific>
storage
<not_specific>
<not_specific>
start_response Response body from multipart_start
start_response Response body from multipart_start