             cb(err)
 
       @tailProcess.on 'exit', closing
-#      @tailProcess.on 'close', closing
 
       @tailProcess.kill()
 
-#   store callback, should be (err, statusMessage) ->
     store : (cb) ->
       console.log "store called"
       unless @hasChanges()

clone   = require 'clone'
uuid    = require 'node-uuid'
_       = require 'underscore'

exports.Bucket = (fileName) -> {
    fileName    : fileName

    close : (cb) ->
      @tailProcess.kill()

    reader : (cb) ->
      doneReading  = _.debounce _.once(cb), 200
      _.delay doneReading, 200
      @tailProcess = cp.spawn 'tail', ['-f', '-n +0', @fileName]
      inStream = @tailProcess.stdout
      dataReader = carrier.carry inStream, (line) =>
        console.log "Reader LINE callback..."
        hash = md5.digest_s(line)
        if _.contains @writehashes, hash
          console.log "Got match"
          @writehashes = _.without @writehashes, hash
        else
          chunk   = JSON.parse line
          deleted = _.where chunk, {deleted:true}
          deleted = _.pluck deleted, 'id'
          _.each deleted, (id) =>
            delete chunk[id]
            delete @bucket[id]
          _.extend @bucket, chunk
        console.log "Reader LINE callback end!"
        doneReading()

      dataReader.once 'end', () ->
        console.log "Reader END callback..."
        doneReading()

    load : (cb) ->
      fs.closeSync(fs.openSync(@fileName, 'a'))
      @reader(cb)


    deleteById : (id) ->
