internal.api.md 2.9 KB

Public and Private API

API documentation automatically generated by docmeteor.


File: "fileWorker.js" Where: {server}


TODO: Use power queue to handle throttling etc. Use observe to monitor changes and have it create tasks for the power queue to perform.

-

fs.FileWorker Object  Server

This property FileWorker is defined in FS

FS.FileWorker = { ... fileWorker.js:9

-

fsFileworker.observe(fsCollection)  Server

This method observe is defined in FS.FileWorker

Arguments

Returns {undefined}

Sets up observes on the fsCollection to store file copies and delete temp files at the appropriate times.

FS.FileWorker.observe = function(fsCollection) { ... fileWorker.js:20

-

getReadyQuery(storeName)  undefined

This method is private

Arguments

  • storeName {string}

The name of the store to observe

Returns a selector that will be used to identify files that have been uploaded but have not yet been stored to the specified store.

{ $where: "this.chunkSum === this.chunkCount", 'copies.storeName`: null, 'failures.copies.storeName.doneTrying': {$ne: true} }

function getReadyQuery(storeName) { ... fileWorker.js:83

-

getDoneQuery(stores)  undefined

This method is private

Arguments

  • stores {Object}

The stores object from the FS.Collection options

Returns a selector that will be used to identify files where all stores have successfully save or have failed the max number of times but still have chunks. The resulting selector should be something like this:

{ $and: [ {chunks: {$exists: true}}, { $or: [ { $and: [ { 'copies.storeName': {$ne: null} }, { 'copies.storeName': {$ne: false} } ] }, { 'failures.copies.storeName.doneTrying': true } ] }, REPEATED FOR EACH STORE ] }

function getDoneQuery(stores) { ... fileWorker.js:129

-

saveCopy(fsFile, storeName, options)  Server

This method is private

Arguments

  • fsFile {FS.File}
  • storeName {string}
  • options {Object}

    • overwrite {Boolean} (Optional, Default = false)

    Force save to the specified store?

Returns {undefined}

Saves to the specified store. If the overwrite option is true, will save to the store even if we already have, potentially overwriting any previously saved data. Synchronous.

var makeSafeCallback = function (callback) { ... fileWorker.js:168