From 93d8973a3a93745193229897a07c240aa52da4b6 Mon Sep 17 00:00:00 2001 From: Elizabeth Paige Harper Date: Wed, 14 Jun 2023 13:28:13 -0400 Subject: [PATCH] implement S34K v0.10.0 --- build.gradle.kts | 11 +++++------ .../lib/s3/s34k/minio/BucketObjectContainer.kt | 11 +++++++++++ .../org/veupathdb/lib/s3/s34k/minio/MFileObject.kt | 3 ++- .../kotlin/org/veupathdb/lib/s3/s34k/minio/MObject.kt | 3 ++- .../org/veupathdb/lib/s3/s34k/minio/MStreamObject.kt | 3 ++- .../lib/s3/s34k/minio/operations/ObjectToucher.kt | 2 ++ .../org/veupathdb/lib/s3/s34k/minio/util/x-minio.kt | 3 +++ 7 files changed, 27 insertions(+), 9 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 79dc7f4..a3d0104 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,14 +1,14 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "1.8.0" - id("org.jetbrains.dokka") version "1.7.20" + kotlin("jvm") version "1.8.22" + id("org.jetbrains.dokka") version "1.8.20" `java-library` `maven-publish` } group = "org.veupathdb.lib.s3" -version = "0.5.0+s34k-0.9.0" +version = "0.6.0+s34k-0.10.0" java { sourceCompatibility = JavaVersion.VERSION_1_8 @@ -36,10 +36,9 @@ dependencies { implementation(kotlin("stdlib")) implementation(kotlin("stdlib-jdk8")) implementation("org.slf4j:slf4j-api:1.7.36") - implementation("io.minio:minio:8.4.5") + implementation("io.minio:minio:8.5.3") - @Suppress("GradlePackageVersionRange") - api("org.veupathdb.lib.s3:s34k-core:0.8.0+s34k-0.9.0") + api("org.veupathdb.lib.s3:s34k-core:0.9.0+s34k-0.10.0") testImplementation(kotlin("test")) } diff --git a/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/BucketObjectContainer.kt b/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/BucketObjectContainer.kt index 2b8ff65..7fdb842 100644 --- a/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/BucketObjectContainer.kt +++ b/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/BucketObjectContainer.kt @@ -202,6 +202,7 @@ internal class BucketObjectContainer( res.`object`(), res.lastModified(), res.eTag(), + res.size(), res.region(), MHeaders(res.headers()), bucket, @@ -240,6 +241,7 @@ internal class BucketObjectContainer( res.`object`(), res.lastModified().toOffsetDateTime(), res.etag(), + res.size(), res.region(), MHeaders(res.headers()), bucket, @@ -267,6 +269,7 @@ internal class BucketObjectContainer( it.objectName(), it.lastModified().toOffsetDateTime(), it.etag(), + it.size(), bucket.region, MHeaders(), bucket, @@ -301,6 +304,7 @@ internal class BucketObjectContainer( it.objectName(), it.lastModified().toOffsetDateTime(), it.etag(), + it.size(), bucket.region, MHeaders(), bucket, @@ -333,6 +337,7 @@ internal class BucketObjectContainer( it.objectName(), it.lastModified().toOffsetDateTime(), it.etag(), + it.size(), bucket.region, MHeaders(), bucket, @@ -370,6 +375,7 @@ internal class BucketObjectContainer( res.`object`(), res.lastModified(), res.eTag(), + res.size(), res.region(), res, MHeaders(res.headers()), @@ -401,6 +407,7 @@ internal class BucketObjectContainer( path, OffsetDateTime.now(), res.etag(), + 0L, res.region(), MHeaders(res.headers()), bucket, @@ -441,6 +448,7 @@ internal class BucketObjectContainer( it.objectName(), it.lastModified().toOffsetDateTime(), it.etag(), + it.size(), bucket.region, MHeaders(), bucket, @@ -464,6 +472,7 @@ internal class BucketObjectContainer( it.objectName(), it.lastModified().toOffsetDateTime(), it.etag(), + it.size(), bucket.region, MHeaders(), bucket, @@ -495,6 +504,7 @@ internal class BucketObjectContainer( res.`object`(), null, res.etag(), + 0L, res.region(), MHeaders(res.headers()), bucket, @@ -521,6 +531,7 @@ internal class BucketObjectContainer( path, stat.lastModified().toOffsetDateTime(), stat.etag(), + stat.size(), bucket.region, MHeaders(stat.headers()), bucket, diff --git a/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/MFileObject.kt b/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/MFileObject.kt index be92aef..7280488 100644 --- a/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/MFileObject.kt +++ b/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/MFileObject.kt @@ -11,9 +11,10 @@ internal class MFileObject( path: String, lastModified: OffsetDateTime?, eTag: String, + size: Long, region: String?, headers: Headers, bucket: S3Bucket, client: MinioClient, override val localFile: File, -) : FileObject, MObject(path, lastModified, eTag, region, headers, bucket, client) \ No newline at end of file +) : FileObject, MObject(path, lastModified, eTag, size, region, headers, bucket, client) \ No newline at end of file diff --git a/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/MObject.kt b/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/MObject.kt index 9d837b7..10e7ab2 100644 --- a/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/MObject.kt +++ b/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/MObject.kt @@ -18,12 +18,13 @@ internal open class MObject( path: String, lastModified: OffsetDateTime?, eTag: String, + size: Long, region: String?, headers: Headers, bucket: S3Bucket, private val client: MinioClient, -) : AbstractS3Object(path, lastModified, eTag, region, headers, bucket) { +) : AbstractS3Object(path, lastModified, eTag, size, region, headers, bucket) { private val log = LoggerFactory.getLogger(this::class.java) diff --git a/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/MStreamObject.kt b/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/MStreamObject.kt index 1f80620..ba7573e 100644 --- a/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/MStreamObject.kt +++ b/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/MStreamObject.kt @@ -11,11 +11,12 @@ internal class MStreamObject( path: String, lastModified: OffsetDateTime?, eTag: String, + size: Long, region: String?, override val stream: InputStream, headers: Headers, bucket: S3Bucket, client: MinioClient -) : StreamObject, MObject(path, lastModified, eTag, region ,headers, bucket, client) { +) : StreamObject, MObject(path, lastModified, eTag, size, region ,headers, bucket, client) { override fun close() = stream.close() } \ No newline at end of file diff --git a/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/operations/ObjectToucher.kt b/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/operations/ObjectToucher.kt index d3f1ac7..6ad74b5 100644 --- a/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/operations/ObjectToucher.kt +++ b/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/operations/ObjectToucher.kt @@ -47,6 +47,7 @@ internal class ObjectToucher( res.`object`(), res.lastModified().toOffsetDateTime(), res.etag(), + res.size(), res.region(), MHeaders(res.headers()), bucket, @@ -79,6 +80,7 @@ internal class ObjectToucher( res.`object`(), null, res.etag(), + 0L, res.region(), MHeaders(res.headers()), bucket, diff --git a/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/util/x-minio.kt b/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/util/x-minio.kt index e7f41bd..0fbf830 100644 --- a/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/util/x-minio.kt +++ b/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/util/x-minio.kt @@ -6,6 +6,9 @@ import io.minio.GetObjectResponse import java.time.OffsetDateTime import java.time.format.DateTimeFormatter +internal inline fun GetObjectResponse.size() = + headers()["Content-Length"]!!.toLong() + internal inline fun GetObjectResponse.lastModified() = OffsetDateTime.parse(headers()["Last-Modified"], DateTimeFormatter.RFC_1123_DATE_TIME)