SNRK-57: Remove File
from sources
This commit is contained in:
parent
f71e5a3f1a
commit
a672db082f
@ -4,7 +4,6 @@ import aws.sdk.kotlin.services.s3.*
|
|||||||
import space.kscience.snark.storage.Directory
|
import space.kscience.snark.storage.Directory
|
||||||
import space.kscience.snark.storage.FileReader
|
import space.kscience.snark.storage.FileReader
|
||||||
import space.kscience.snark.storage.FileWriter
|
import space.kscience.snark.storage.FileWriter
|
||||||
import java.io.File
|
|
||||||
import java.lang.Exception
|
import java.lang.Exception
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import kotlin.io.path.*
|
import kotlin.io.path.*
|
||||||
@ -23,15 +22,15 @@ internal fun splitPathIntoBucketAndPath(path: Path): Pair<String, Path> {
|
|||||||
|
|
||||||
internal class S3Root(private val client: S3Client) : Directory {
|
internal class S3Root(private val client: S3Client) : Directory {
|
||||||
override suspend fun get(filename: String): FileReader {
|
override suspend fun get(filename: String): FileReader {
|
||||||
throw NoSuchFileException(File(filename))
|
throw NoSuchFileException(Path(filename).toFile())
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun create(filename: String, ignoreIfExists: Boolean) {
|
override suspend fun create(filename: String, ignoreIfExists: Boolean) {
|
||||||
throw NoSuchFileException(File(filename))
|
throw NoSuchFileException(Path(filename).toFile())
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun put(filename: String): FileWriter {
|
override suspend fun put(filename: String): FileWriter {
|
||||||
throw NoSuchFileException(File(filename))
|
throw NoSuchFileException(Path(filename).toFile())
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getSubdir(path: Path): Directory = try {
|
override suspend fun getSubdir(path: Path): Directory = try {
|
||||||
@ -51,7 +50,7 @@ internal class S3Root(private val client: S3Client) : Directory {
|
|||||||
}
|
}
|
||||||
S3Directory(client, bucketName, filePath)
|
S3Directory(client, bucketName, filePath)
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
throw AccessDeniedException(File(dirname), reason = ex.message)
|
throw AccessDeniedException(Path(dirname).toFile(), reason = ex.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun close() {
|
override fun close() {
|
||||||
|
Loading…
Reference in New Issue
Block a user