SNRK-68: Implement s3 storage

This commit is contained in:
Kirill Grachev 2023-05-04 21:11:56 +03:00
parent 5b33419b37
commit 634eb2d69d

View File

@ -15,6 +15,9 @@ internal class S3Directory(
override suspend fun get(filename: String): FileReader = override suspend fun get(filename: String): FileReader =
S3FileReader(client, bucketName, currentDir / filename) S3FileReader(client, bucketName, currentDir / filename)
override suspend fun get(filename: Path): FileReader =
S3FileReader(client, bucketName, currentDir / filename)
override suspend fun create(filename: String, ignoreIfExists: Boolean) { override suspend fun create(filename: String, ignoreIfExists: Boolean) {
if (!ignoreIfExists) { if (!ignoreIfExists) {
TODO("could not check if file exists") TODO("could not check if file exists")
@ -24,6 +27,9 @@ internal class S3Directory(
override suspend fun put(filename: String): FileWriter = override suspend fun put(filename: String): FileWriter =
S3FileWriter(client, bucketName, currentDir / filename) S3FileWriter(client, bucketName, currentDir / filename)
override suspend fun put(filename: Path): FileWriter =
S3FileWriter(client, bucketName, currentDir / filename)
override suspend fun getSubdir(path: Path): S3Directory = override suspend fun getSubdir(path: Path): S3Directory =
S3Directory(client, bucketName, currentDir / path) S3Directory(client, bucketName, currentDir / path)
@ -34,6 +40,9 @@ internal class S3Directory(
S3Directory(client, bucketName, currentDir / dirname) S3Directory(client, bucketName, currentDir / dirname)
} }
override val path: Path
get() = currentDir
override fun close() { override fun close() {
} }
} }