-
Notifications
You must be signed in to change notification settings - Fork 74
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 bulk create by copy operation for files #4483
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
8eb9a15
Add support for bulk copying files to another project
dantb b30560f
Accept list of files in copy route
dantb f2c6b52
Move CopyFiles to kernel, reuse for delta disk storage, validate stor…
dantb 5c327f1
Return bulk response with context, test route
dantb d4a5a10
Fix paths when saving copied file attributes
dantb 2a37f77
Refactoring
dantb a366c83
Add test with source files in different storages
dantb 2291cdf
Extract bulk file operations into new package
dantb 30668e0
Create BatchFilesRoutes, wire up with bulk file operations
dantb 6a4576b
Unit test batch files routes
dantb cba45f8
Reduce dependency surface area for BatchFiles + unit test it
dantb cbe3065
Delete previous copy impl, test and fix error mapping in routes
dantb 2477b8f
Test rejections are mapped correctly
dantb 30f8dac
Create abstractions for file and storage fetching + narrow dependents…
dantb a6f4fe6
Test batch copying logic
dantb 9c9e930
Merge branch 'master' into copy-files
dantb 25fe7e4
Tidy up
dantb e0e5b2a
Fix test
dantb a8fe061
From comments
dantb 654e8ac
Merge branch 'master' into copy-files
dantb 33205b4
Merge branch 'master' into copy-files
dantb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 24 additions & 10 deletions
34
...brain/nexus/storage/files/CopyFiles.scala → ...ernel/utils/TransactionalFileCopier.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...rc/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/files/FetchFileResource.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package ch.epfl.bluebrain.nexus.delta.plugins.storage.files | ||
|
||
import cats.effect.IO | ||
import ch.epfl.bluebrain.nexus.delta.plugins.storage.files.model.FileId | ||
|
||
trait FetchFileResource { | ||
|
||
/** | ||
* Fetch the last version of a file | ||
* | ||
* @param id | ||
* the identifier that will be expanded to the Iri of the file with its optional rev/tag | ||
*/ | ||
def fetch(id: FileId): IO[FileResource] | ||
} |
14 changes: 14 additions & 0 deletions
14
...src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/files/FetchFileStorage.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package ch.epfl.bluebrain.nexus.delta.plugins.storage.files | ||
|
||
import cats.effect.IO | ||
import ch.epfl.bluebrain.nexus.delta.plugins.storage.storages.model.Storage | ||
import ch.epfl.bluebrain.nexus.delta.sdk.identities.model.Caller | ||
import ch.epfl.bluebrain.nexus.delta.sdk.model._ | ||
import ch.epfl.bluebrain.nexus.delta.sdk.projects.model.ProjectContext | ||
import ch.epfl.bluebrain.nexus.delta.sourcing.model.{ProjectRef, ResourceRef} | ||
|
||
trait FetchFileStorage { | ||
def fetchAndValidateActiveStorage(storageIdOpt: Option[IdSegment], ref: ProjectRef, pc: ProjectContext)(implicit | ||
caller: Caller | ||
): IO[(ResourceRef.Revision, Storage)] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the ref get used here rather than modifying the error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think I understand the question 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we setting a ref when we could just return the error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll refactor this afterwards