Skip to content
This repository has been archived by the owner on Mar 14, 2019. It is now read-only.

Insert process codebase walk through

Rhys Bartels-Waller edited this page Jun 3, 2015 · 5 revisions

The following list represents just the key phases in a successful insert process since the comprehensive flow can be reviewed in the source

There are three primary phases in the insert, with the process differing slightly on the first two if the file is sourced from the client.

  1. Inserting into the underlying collection
  2. Transferring data into the TempStore
  3. Making copies into the supplied stores

Insert on client

Remaining steps are common

Insert on server

Remaining steps are common

Proposed changes to this page from the work in PR 667

  • In memory queue to govern the server side TempStore transfer.
  • [3] When the TempStore writeStream ends, the TempStore already emits a stored event, which the collection hears and then emits an uploaded event. This event is heard within the same process, and creates a saveCopy job per store in a persistent queue. If using GridFS or S3 for the Stores (TempStore included), any Worker in a separate process can complete the job by observing the queue.
  • A separate collection-observer package observes and triggers the creation of a removeTempFile job when all stores are complete. This needs to be isolated to a single instance in the system to avoid duplicates.