-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add metis support #51
Comments
The main reformations that must happen:
|
To use Metis, magma should be able to do a few things:
How should we authenticate? We need to use the user's token in (2) because they must have the rights to access the file, as determined by Metis based on the bucket permissions and so on. However, Metis also needs to know that Magma approves of the transfer, so that users can't overwrite files using /transfer on Metis without Magma's approval. It would be nice to achieve both of these things in a single transfer. We can do this if we have an endpoint that requires BOTH a valid token AND an Hmac-signed URL. With such an endpoint, we can transfer a file from bucket1/path1, where bucket1.owner = 'metis', to magma/path2, where magma.owner = 'magma'. So: the user requests Magma to upload from a specified Metis location. Magma uses the user's token, signs a url, and requests from Metis the transfer operation. |
Using the transfer mechanism above we can avoid the necessity of requiring upload notification from Metis to Magma. The Magma upload cycle can instead look like this:
OR
|
When in (3) or (1) above, how does Magma communicate with Metis?
Step 7 takes place in #upsert in Magma::Loader, called from #dispatch_record_set. Step 3 takes place in #validate, also called from #dispatch_record_set. This means step 4 must also occur in #dispatch_record_set. This is nice because we can collect all link requests from the entire record set. How do we do this? There is a #metis_link method that is called in #dispatch_record_set, after #validate and before #upsert. It iterates over records, finds file attributes and assembles them into 'old_file' => 'new_file' pairs (old in any project bucket, new in the magma bucket). It then uses a Etna::Client to post the complete link hash to Metis. If Metis replies favorably, it continues loading, otherwise it raises a Magma::LoadFailed error with the incorrect old_files. It seems like this behavior should actually live on the FileAttribute somehow, a problem for refactoring. |
Closed by #180 |
Magma should use metis as its file service component.
Roadmapping:
Moved to planning
The text was updated successfully, but these errors were encountered: