-/*
- For each Pull request:
- Generate a random API token.
- Generate a permission signature using this token, timestamp ~60 seconds in the future, and desired block hash.
- Using this token & signature, retrieve the given block.
- Write to storage
-*/
-func PullItemAndProcess(pullRequest PullRequest, token string, keepClient *keepclient.KeepClient) (err error) {
- keepClient.Arvados.ApiToken = token
+// PullItemAndProcess executes a pull request by retrieving the
+// specified block from one of the specified servers, and storing it
+// on a local volume.
+//
+// If the PR specifies a non-blank mount UUID, PullItemAndProcess will
+// only attempt to write the data to the corresponding
+// volume. Otherwise it writes to any local volume, as a PUT request
+// would.
+func PullItemAndProcess(pullRequest PullRequest, keepClient *keepclient.KeepClient) error {
+ var vol Volume
+ if uuid := pullRequest.MountUUID; uuid != "" {
+ vol = KeepVM.Lookup(pullRequest.MountUUID, true)
+ if vol == nil {
+ return fmt.Errorf("pull req has nonexistent mount: %v", pullRequest)
+ }
+ }