-
Notifications
You must be signed in to change notification settings - Fork 24
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
Allow Exploring Datasets on Local File System #7389
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
70c587e
Unify FileSystemDataVault with other DataVaults, allow exploring locally
fm3 8490a99
WIP. add directory whitelist
fm3 bfb1325
use directory whitelist also in wk side
fm3 761cff4
add config option to the relevant config files
fm3 a6d95b1
remove unused param
fm3 9cbcf50
changelog
fm3 e845ccb
Merge branch 'master' into explore-from-file-system
fm3 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
package com.scalableminds.webknossos.datastore.dataformats | ||
|
||
import com.scalableminds.util.tools.{Fox, FoxImplicits} | ||
import com.scalableminds.webknossos.datastore.datavault.{FileSystemVaultPath, VaultPath} | ||
import com.scalableminds.webknossos.datastore.models.BucketPosition | ||
import com.scalableminds.webknossos.datastore.models.requests.DataReadInstruction | ||
import com.scalableminds.webknossos.datastore.storage.{DataCubeCache, RemoteSourceDescriptorService} | ||
|
@@ -15,19 +14,19 @@ trait BucketProvider extends FoxImplicits with LazyLogging { | |
def remoteSourceDescriptorServiceOpt: Option[RemoteSourceDescriptorService] | ||
|
||
// To be defined in subclass. | ||
def loadFromUnderlying(readInstruction: DataReadInstruction)(implicit ec: ExecutionContext): Fox[DataCubeHandle] = | ||
def openShardOrArrayHandle(readInstruction: DataReadInstruction)(implicit ec: ExecutionContext): Fox[DataCubeHandle] = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just some renamings here |
||
Empty | ||
|
||
def load(readInstruction: DataReadInstruction, cache: DataCubeCache)( | ||
implicit ec: ExecutionContext): Fox[Array[Byte]] = | ||
cache.withCache(readInstruction)(loadFromUnderlyingWithTimeout)( | ||
cache.withCache(readInstruction)(openShardOrArrayHandleWithTimeout)( | ||
_.cutOutBucket(readInstruction.bucket, readInstruction.dataLayer)) | ||
|
||
private def loadFromUnderlyingWithTimeout(readInstruction: DataReadInstruction)( | ||
private def openShardOrArrayHandleWithTimeout(readInstruction: DataReadInstruction)( | ||
implicit ec: ExecutionContext): Fox[DataCubeHandle] = { | ||
val t = System.currentTimeMillis | ||
for { | ||
result <- loadFromUnderlying(readInstruction).futureBox | ||
result <- openShardOrArrayHandle(readInstruction).futureBox | ||
duration = System.currentTimeMillis - t | ||
_ = if (duration > 500) { | ||
val className = this.getClass.getName.split("\\.").last | ||
|
@@ -45,24 +44,4 @@ trait BucketProvider extends FoxImplicits with LazyLogging { | |
def bucketStream(version: Option[Long] = None): Iterator[(BucketPosition, Array[Byte])] = | ||
Iterator.empty | ||
|
||
protected def localPathFrom(readInstruction: DataReadInstruction, relativeMagPath: String)( | ||
implicit ec: ExecutionContext): Fox[VaultPath] = { | ||
val magPathRelativeToDataset = FileSystemVaultPath.fromPath( | ||
readInstruction.baseDir | ||
.resolve(readInstruction.dataSource.id.team) | ||
.resolve(readInstruction.dataSource.id.name) | ||
.resolve(relativeMagPath)) | ||
val magPathRelativeToLayer = FileSystemVaultPath.fromPath( | ||
readInstruction.baseDir | ||
.resolve(readInstruction.dataSource.id.team) | ||
.resolve(readInstruction.dataSource.id.name) | ||
.resolve(readInstruction.dataLayer.name) | ||
.resolve(relativeMagPath)) | ||
if (magPathRelativeToDataset.exists) { | ||
Fox.successful(magPathRelativeToDataset) | ||
} else if (magPathRelativeToLayer.exists) { | ||
Fox.successful(magPathRelativeToLayer) | ||
} else Fox.empty | ||
} | ||
|
||
} |
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
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
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.
this was where the match error originated in case of an unknown uri scheme. That shouldn’t happen.