Skip to content

Commit

Permalink
handle accelerate and dual-stack aws endpoints
Browse files Browse the repository at this point in the history
Fixes minio#893
Fixes minio#894
Fixes minio#895
Fixes minio#897
Fixes minio#899
  • Loading branch information
balamurugana committed May 19, 2020
1 parent 9b85295 commit 82d3366
Show file tree
Hide file tree
Showing 7 changed files with 460 additions and 340 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,38 +20,24 @@
import java.util.concurrent.ConcurrentHashMap;

/** A singleton bucket/region cache map. */
enum BucketRegionCache {
enum AwsRegionCache {
INSTANCE;
private final Map<String, String> regionMap = new ConcurrentHashMap<>();

/** Returns AWS region for given bucket name. */
public String region(String bucketName) {
if (bucketName == null) {
return "us-east-1";
}

String region = this.regionMap.get(bucketName);
if (region == null) {
return "us-east-1";
} else {
return region;
}
}

/** Sets bucket name and its region to BucketRegionCache. */
/** Sets bucket name and its region. */
public void set(String bucketName, String region) {
this.regionMap.put(bucketName, region);
}

/** Removes region cache of the bucket if any. */
/** Gets region of bucket name. */
public String get(String bucketName) {
return this.regionMap.get(bucketName);
}

/** Removes bucket name and its region. */
public void remove(String bucketName) {
if (bucketName != null) {
this.regionMap.remove(bucketName);
}
}

/** Returns true if given bucket name is in the map else false. */
public boolean exists(String bucketName) {
return this.regionMap.get(bucketName) != null;
}
}
70 changes: 0 additions & 70 deletions api/src/main/java/io/minio/AwsS3Endpoints.java

This file was deleted.

Loading

0 comments on commit 82d3366

Please sign in to comment.