Importing

When an editing session is started with Tome, work is done from an initial state of content and config based on what was previously exported. This is accomplished by the importer service and related commands.

The content import flow works like this:

  1. A site profile is installed - advanced users should be using "minimal".
  2. The "drush tome:import" command is ran.
  3. All existing content entities are deleted - this ensures a clean initial state to import from.
  4. The "drush config-import" command is internally invoked, and runs normally.
  5. A chunked array of content to import is returned by the "tome.importer" service. This array is built using the content index, and a sorted Drupal Graph object.
  6. Each chunk of the array is processed serially, then within each chunk content is imported concurrently. This lets content import super fast, without doing anything in the wrong order. For example, you can usually import files concurrently as they don't typically depend on any other entity, but nodes likely have dependencies to other nodes, files, and users.
  7. Each piece of content is read from the "tome.storage.content" storage, and then denormalized into a real entity and saved. If the content being denormalized is a translation, it is added to the default entity then saved.
  8. Cache is rebuilt.

Compared to the content export process, the import process is fairly straightforward. This is due mostly to Drush already figuring out config for us, and the index file being generated on export.