Begin work towards obeying 'Range' headers, thread the opts down to persistence layer.

This commit is contained in:
Shane Kilkelly 2015-08-27 15:21:33 +01:00
parent 2e08281b88
commit 57aedefdd3
4 changed files with 5 additions and 5 deletions

View file

@ -27,7 +27,7 @@ module.exports =
return callback err return callback err
@sendFile location, target, fsPath, callback @sendFile location, target, fsPath, callback
getFileStream: (location, name, _callback = (err, res)->) -> getFileStream: (location, name, opts, _callback = (err, res)->) ->
callback = (args...) -> callback = (args...) ->
_callback(args...) _callback(args...)
_callback = () -> _callback = () ->

View file

@ -30,7 +30,7 @@ module.exports =
@_getConvertedFile bucket, key, opts, callback @_getConvertedFile bucket, key, opts, callback
_getStandardFile: (bucket, key, opts, callback)-> _getStandardFile: (bucket, key, opts, callback)->
PersistorManager.getFileStream bucket, key, (err, fileStream)-> PersistorManager.getFileStream bucket, key, opts, (err, fileStream)->
if err? if err?
logger.err bucket:bucket, key:key, opts:opts, "error getting fileStream" logger.err bucket:bucket, key:key, opts:opts, "error getting fileStream"
callback err, fileStream callback err, fileStream

View file

@ -57,8 +57,8 @@ module.exports =
logger.err bucketName:bucketName, key:key, fsPath:fsPath, err:err, "something went wrong writing stream to disk" logger.err bucketName:bucketName, key:key, fsPath:fsPath, err:err, "something went wrong writing stream to disk"
return callback(err) return callback(err)
@sendFile bucketName, key, fsPath, callback @sendFile bucketName, key, fsPath, callback
getFileStream: (bucketName, key, callback = (err, res)->)-> getFileStream: (bucketName, key, opts, callback = (err, res)->)->
callback = _.once callback callback = _.once callback
logger.log bucketName:bucketName, key:key, "getting file from s3" logger.log bucketName:bucketName, key:key, "getting file from s3"
s3Client = knox.createClient s3Client = knox.createClient

View file

@ -104,7 +104,7 @@ describe "FileHandler", ->
beforeEach -> beforeEach ->
@fileStream = {on:->} @fileStream = {on:->}
@PersistorManager.getFileStream.callsArgWith(2, "err", @fileStream) @PersistorManager.getFileStream.callsArgWith(3, "err", @fileStream)
it "should get the stream", (done)-> it "should get the stream", (done)->
@handler.getFile @bucket, @key, null, => @handler.getFile @bucket, @key, null, =>