Importer: Handle missing foreign layers gracefully
Context
With gitlab-com/gl-infra/production#6109 (closed) we discovered that manifests with foreign layers cannot be added to the database, as currently all layers included in the manifest payload must be present in the database, which they would not be with foreign layers.
Solution
Adapt the solution from #543 (closed) to identify foreign layers and properly link them to the manifest and flag them as foreign layers.
Will need to address the possibility of foreign layers both when linking the layers to the manifest, as well as when transferring the blobs, if applicable.