mongoid / mongoid-grid_fs

A pure Mongoid/Moped implementation of the MongoDB GridFS specification.
Other
83 stars 50 forks source link

No need to pull more chunks than needed (take 2) #8

Closed fredjean closed 11 years ago

fredjean commented 11 years ago

Restarted the fix from a clean fork. It should merge cleanly now.

rmm5t commented 11 years ago

@fredjean Could you please help me understand the impetus for this? Is the gem currently pulling chunks that aren't related to the original file? Is it ignoring these extra chunks? Is this something we could add a unit test for too?

fredjean commented 11 years ago

My original math was wrong on which chunks to pull from the database. It ends up taking one extra chunk per request for byte ranges that are inside the file. The code already only returns the bytes requested, so there is no external signs that we are pulling extra information from the DB.

rmm5t commented 11 years ago

Thanks. I also found #6, so I better understand now.