Skip to content

Commit

Permalink
Merge branch 'master' into add-executor-service-to-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored Jan 16, 2025
2 parents 71d5ace + 51940f6 commit f5864e0
Show file tree
Hide file tree
Showing 11 changed files with 229 additions and 17 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ Java 1.8 or above.
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.5.14</version>
<version>8.5.15</version>
</dependency>
```

## Gradle usage
```
dependencies {
implementation("io.minio:minio:8.5.14")
implementation("io.minio:minio:8.5.15")
}
```

## JAR download
The latest JAR can be downloaded from [here](https://repo1.maven.org/maven2/io/minio/minio/8.5.14/)
The latest JAR can be downloaded from [here](https://repo1.maven.org/maven2/io/minio/minio/8.5.15/)

## Quick Start Example - File Uploader
This example program connects to an object storage server, makes a bucket on the server and then uploads a file to the bucket.
Expand Down Expand Up @@ -92,12 +92,12 @@ public class FileUploader {

#### Compile FileUploader
```sh
$ javac -cp minio-8.5.14-all.jar FileUploader.java
$ javac -cp minio-8.5.15-all.jar FileUploader.java
```

#### Run FileUploader
```sh
$ java -cp minio-8.5.14-all.jar:. FileUploader
$ java -cp minio-8.5.15-all.jar:. FileUploader
'/home/user/Photos/asiaphotos.zip' is successfully uploaded as object 'asiaphotos-2015.zip' to bucket 'asiatrip'.

$ mc ls play/asiatrip/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package io.minio.admin.messages.info;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Collections;
import java.util.Map;
Expand All @@ -27,6 +28,7 @@
* @see <a href=
* "https://github.com/minio/madmin-go/blob/main/info-commands.go#L395">info-commands.go</a>
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class DiskMetrics {
@JsonProperty("lastMinute")
private Map<String, TimedAction> lastMinute;
Expand All @@ -40,6 +42,18 @@ public class DiskMetrics {
@JsonProperty("totalErrorsTimeout")
private Integer totalErrorsTimeout;

@JsonProperty("totalTokens")
private Long totalTokens;

@JsonProperty("totalWaiting")
private Long totalWaiting;

@JsonProperty("totalWrites")
private Long totalWrites;

@JsonProperty("totalDeletes")
private Long totalDeletes;

public Integer totalErrorsAvailability() {
return totalErrorsAvailability;
}
Expand All @@ -55,4 +69,20 @@ public Map<String, TimedAction> lastMinute() {
public Map<String, String> apiCalls() {
return Collections.unmodifiableMap(apiCalls);
}

public Long totalTokens() {
return totalTokens;
}

public Long totalWaiting() {
return totalWaiting;
}

public Long totalWrites() {
return totalWrites;
}

public Long totalDeletes() {
return totalDeletes;
}
}
3 changes: 2 additions & 1 deletion api/src/main/java/io/minio/MinioAsyncClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,8 @@ public CompletableFuture<ObjectWriteResponse> copyObject(CopyObjectArgs args)
args.region(),
args.object(),
result.etag(),
response.header("x-amz-version-id"));
response.header("x-amz-version-id"),
result);
} catch (XmlParserException e) {
throw new CompletionException(e);
} finally {
Expand Down
66 changes: 66 additions & 0 deletions api/src/main/java/io/minio/ObjectWriteResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,68 @@

package io.minio;

import io.minio.messages.CompleteMultipartUploadOutput;
import io.minio.messages.CopyObjectResult;
import okhttp3.Headers;

/** Response class of any APIs doing object creation. */
public class ObjectWriteResponse extends GenericResponse {
private String etag;
private String versionId;
private String checksumCRC32;
private String checksumCRC32C;
private String checksumSHA1;
private String checksumSHA256;

public ObjectWriteResponse(
Headers headers, String bucket, String region, String object, String etag, String versionId) {
super(headers, bucket, region, object);
this.etag = etag;
this.versionId = versionId;
if (headers != null) {
this.checksumCRC32 = headers.get("x-amz-checksum-crc32");
this.checksumCRC32C = headers.get("x-amz-checksum-crc32c");
this.checksumSHA1 = headers.get("x-amz-checksum-sha1");
this.checksumSHA256 = headers.get("x-amz-checksum-sha256");
}
}

public ObjectWriteResponse(
Headers headers,
String bucket,
String region,
String object,
String etag,
String versionId,
CopyObjectResult result) {
super(headers, bucket, region, object);
this.etag = etag;
this.versionId = versionId;
if (result != null) {
this.checksumCRC32 = result.checksumCRC32();
this.checksumCRC32C = result.checksumCRC32C();
this.checksumSHA1 = result.checksumSHA1();
this.checksumSHA256 = result.checksumSHA256();
}
}

public ObjectWriteResponse(
Headers headers,
String bucket,
String region,
String object,
String etag,
String versionId,
CompleteMultipartUploadOutput result) {
super(headers, bucket, region, object);
this.etag = etag;
this.versionId = versionId;
if (result != null) {
this.checksumCRC32 = result.checksumCRC32();
this.checksumCRC32C = result.checksumCRC32C();
this.checksumSHA1 = result.checksumSHA1();
this.checksumSHA256 = result.checksumSHA256();
}
}

public String etag() {
Expand All @@ -37,4 +87,20 @@ public String etag() {
public String versionId() {
return versionId;
}

public String checksumCRC32() {
return checksumCRC32;
}

public String checksumCRC32C() {
return checksumCRC32C;
}

public String checksumSHA1() {
return checksumSHA1;
}

public String checksumSHA256() {
return checksumSHA256;
}
}
27 changes: 18 additions & 9 deletions api/src/main/java/io/minio/S3Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,14 @@ public void onFailure(final Call call, IOException e) {

@Override
public void onResponse(Call call, final Response response) throws IOException {
try {
onResponse(response);
} catch (Exception e) {
completableFuture.completeExceptionally(e);
}
}

private void onResponse(final Response response) throws IOException {
String trace =
response.protocol().toString().toUpperCase(Locale.US)
+ " "
Expand Down Expand Up @@ -1867,7 +1875,7 @@ protected CompletableFuture<StatObjectResponse> statObjectAsync(StatObjectArgs a
* @throws NoSuchAlgorithmException thrown to indicate missing of MD5 or SHA-256 digest library.
* @throws XmlParserException thrown to indicate XML parsing error.
*/
protected CompletableFuture<AbortMultipartUploadResponse> abortMultipartUploadAsync(
public CompletableFuture<AbortMultipartUploadResponse> abortMultipartUploadAsync(
String bucketName,
String region,
String objectName,
Expand Down Expand Up @@ -1975,7 +1983,7 @@ protected AbortMultipartUploadResponse abortMultipartUpload(
* @throws NoSuchAlgorithmException thrown to indicate missing of MD5 or SHA-256 digest library.
* @throws XmlParserException thrown to indicate XML parsing error.
*/
protected CompletableFuture<ObjectWriteResponse> completeMultipartUploadAsync(
public CompletableFuture<ObjectWriteResponse> completeMultipartUploadAsync(
String bucketName,
String region,
String objectName,
Expand Down Expand Up @@ -2035,7 +2043,8 @@ protected CompletableFuture<ObjectWriteResponse> completeMultipartUploadAsync(
result.location(),
result.object(),
result.etag(),
response.header("x-amz-version-id"));
response.header("x-amz-version-id"),
result);
} catch (XmlParserException e) {
// As this CompleteMultipartUpload REST call succeeded, just log it.
Logger.getLogger(S3Base.class.getName())
Expand Down Expand Up @@ -2126,7 +2135,7 @@ protected ObjectWriteResponse completeMultipartUpload(
* @throws NoSuchAlgorithmException thrown to indicate missing of MD5 or SHA-256 digest library.
* @throws XmlParserException thrown to indicate XML parsing error.
*/
protected CompletableFuture<CreateMultipartUploadResponse> createMultipartUploadAsync(
public CompletableFuture<CreateMultipartUploadResponse> createMultipartUploadAsync(
String bucketName,
String region,
String objectName,
Expand Down Expand Up @@ -3190,7 +3199,7 @@ protected ObjectWriteResponse putObject(
* @throws NoSuchAlgorithmException thrown to indicate missing of MD5 or SHA-256 digest library.
* @throws XmlParserException thrown to indicate XML parsing error.
*/
protected CompletableFuture<ListMultipartUploadsResponse> listMultipartUploadsAsync(
public CompletableFuture<ListMultipartUploadsResponse> listMultipartUploadsAsync(
String bucketName,
String region,
String delimiter,
Expand Down Expand Up @@ -3339,7 +3348,7 @@ protected ListMultipartUploadsResponse listMultipartUploads(
* @throws NoSuchAlgorithmException thrown to indicate missing of MD5 or SHA-256 digest library.
* @throws XmlParserException thrown to indicate XML parsing error.
*/
protected CompletableFuture<ListPartsResponse> listPartsAsync(
public CompletableFuture<ListPartsResponse> listPartsAsync(
String bucketName,
String region,
String objectName,
Expand Down Expand Up @@ -3475,7 +3484,7 @@ protected ListPartsResponse listParts(
* @throws NoSuchAlgorithmException thrown to indicate missing of MD5 or SHA-256 digest library.
* @throws XmlParserException thrown to indicate XML parsing error.
*/
protected CompletableFuture<UploadPartResponse> uploadPartAsync(
public CompletableFuture<UploadPartResponse> uploadPartAsync(
String bucketName,
String region,
String objectName,
Expand Down Expand Up @@ -3549,7 +3558,7 @@ protected CompletableFuture<UploadPartResponse> uploadPartAsync(
* @throws NoSuchAlgorithmException thrown to indicate missing of MD5 or SHA-256 digest library.
* @throws XmlParserException thrown to indicate XML parsing error.
*/
protected CompletableFuture<UploadPartResponse> uploadPartAsync(
public CompletableFuture<UploadPartResponse> uploadPartAsync(
String bucketName,
String region,
String objectName,
Expand Down Expand Up @@ -3752,7 +3761,7 @@ protected UploadPartCopyResponse uploadPartCopy(
* @throws NoSuchAlgorithmException thrown to indicate missing of MD5 or SHA-256 digest library.
* @throws XmlParserException thrown to indicate XML parsing error.
*/
protected CompletableFuture<UploadPartCopyResponse> uploadPartCopyAsync(
public CompletableFuture<UploadPartCopyResponse> uploadPartCopyAsync(
String bucketName,
String region,
String objectName,
Expand Down
33 changes: 33 additions & 0 deletions api/src/main/java/io/minio/messages/AndOperator.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public class AndOperator {
@Convert(PrefixConverter.class)
private String prefix;

@Element(name = "ObjectSizeLessThan", required = false)
private Integer objectSizeLessThan;

@Element(name = "ObjectSizeGreaterThan", required = false)
private Integer objectSizeGreaterThan;

@ElementMap(
attribute = false,
entry = "Tag",
Expand Down Expand Up @@ -67,10 +73,37 @@ public AndOperator(
this.tags = (tags != null) ? Collections.unmodifiableMap(tags) : null;
}

public AndOperator(
@Nullable @Element(name = "Prefix", required = false) String prefix,
@Nullable
@ElementMap(
attribute = false,
entry = "Tag",
inline = true,
key = "Key",
value = "Value",
required = false)
Map<String, String> tags,
@Nullable @Element(name = "ObjectSizeLessThan", required = false) Integer objectSizeLessThan,
@Nullable @Element(name = "ObjectSizeGreaterThan", required = false)
Integer objectSizeGreaterThan) {
this(prefix, tags);
this.objectSizeLessThan = objectSizeLessThan;
this.objectSizeGreaterThan = objectSizeGreaterThan;
}

public String prefix() {
return this.prefix;
}

public Integer objectSizeLessThan() {
return this.objectSizeLessThan;
}

public Integer objectSizeGreaterThan() {
return this.objectSizeGreaterThan;
}

public Map<String, String> tags() {
return this.tags;
}
Expand Down
28 changes: 28 additions & 0 deletions api/src/main/java/io/minio/messages/CopyObjectResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ public class CopyObjectResult {
@Element(name = "LastModified")
private ResponseDate lastModified;

@Element(name = "ChecksumCRC32", required = false)
private String checksumCRC32;

@Element(name = "ChecksumCRC32C", required = false)
private String checksumCRC32C;

@Element(name = "ChecksumSHA1", required = false)
private String checksumSHA1;

@Element(name = "ChecksumSHA256", required = false)
private String checksumSHA256;

public CopyObjectResult() {}

/** Returns ETag of the object. */
Expand All @@ -46,4 +58,20 @@ public String etag() {
public ZonedDateTime lastModified() {
return lastModified.zonedDateTime();
}

public String checksumCRC32() {
return checksumCRC32;
}

public String checksumCRC32C() {
return checksumCRC32C;
}

public String checksumSHA1() {
return checksumSHA1;
}

public String checksumSHA256() {
return checksumSHA256;
}
}
Loading

0 comments on commit f5864e0

Please sign in to comment.