Sha256: e8294697d0506030ed3b0dd3f3fd9ea5ced0dbc99fc045758db2704c3f39db69

Contents?: true

Size: 570 Bytes

Versions: 8

Compression:

Stored size: 570 Bytes

Contents

# Model for storing portion of bytes from particular Neofiles::File. Has only two fields: the bytes string #data
# and sequence number #n
#
class Neofiles::FileChunk

  include Mongoid::Document

  store_in collection: Rails.application.config.neofiles.mongo_chunks_collection, client: Rails.application.config.neofiles.mongo_client

  belongs_to :file, class_name: 'Neofiles::File'

  field :n, type: Integer, default: 0 # что это за поле?
  field :data, type: BSON::Binary

  index({file_id: 1, n: 1}, background: true)

  def to_s
    data.data
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
neofiles-1.3.2 app/models/neofiles/file_chunk.rb
neofiles-1.3.1 app/models/neofiles/file_chunk.rb
neofiles-1.3.0 app/models/neofiles/file_chunk.rb
neofiles-1.2.2 app/models/neofiles/file_chunk.rb
neofiles-1.2.1 app/models/neofiles/file_chunk.rb
neofiles-2.0.0 app/models/neofiles/file_chunk.rb
neofiles-1.1.4 app/models/neofiles/file_chunk.rb
neofiles-1.1.3 app/models/neofiles/file_chunk.rb