Skip to content

Commit a755503

Browse files
committed
more comments
1 parent 79b4594 commit a755503

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

modules/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3BlobStore.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class S3BlobStore implements BlobStore {
116116
S3RepositoriesMetrics s3RepositoriesMetrics,
117117
BackoffPolicy retryThrottledDeleteBackoffPolicy
118118
) {
119+
// TODO: add a projectId field, maybe null for cluster level blobstore
119120
this.service = service;
120121
this.bigArrays = bigArrays;
121122
this.bucket = bucket;
@@ -311,6 +312,7 @@ public String toString() {
311312
}
312313

313314
public AmazonS3Reference clientReference() {
315+
// TODO: change to service.client(projectId, repositoryMetadata)
314316
return service.client(repositoryMetadata);
315317
}
316318

modules/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Repository.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ class S3Repository extends MeteredBlobStoreRepository {
292292
buildBasePath(metadata),
293293
buildLocation(metadata)
294294
);
295+
// TODO: add a projectId field
295296
this.service = service;
296297
this.s3RepositoriesMetrics = s3RepositoriesMetrics;
297298
this.snapshotExecutor = threadPool().executor(ThreadPool.Names.SNAPSHOT);

modules/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Service.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,20 @@ public AmazonS3Reference client(RepositoryMetadata repositoryMetadata) {
168168
}
169169

170170
/**
171-
* Delegates to {@link #client(RepositoryMetadata)} if per-project client is disabled.
171+
* Delegates to {@link #client(RepositoryMetadata)} when
172+
* 1. per-project client is disabled
173+
* 2. or when the blobstore is cluster level (projectId = null)
172174
* Otherwise, attempts to retrieve a per-project client by the project-id and repository metadata from the
173-
* per-project client manager.
174-
* Throws if project-id or the client does not exist. The client maybe initialized lazily.
175+
* per-project client manager. Throws if project-id or the client does not exist. The client maybe initialized lazily.
175176
*/
176177
public AmazonS3Reference client(ProjectId projectId, RepositoryMetadata repositoryMetadata) {
177178
if (perProjectClientManager == null) {
179+
// Multi-Project is disabled and we have a single default project
178180
assert ProjectId.DEFAULT.equals(projectId) : projectId;
179181
return client(repositoryMetadata);
182+
} else if (projectId == null) {
183+
// Multi-Project is enabled and we are retrieving a client for the cluster level blobstore
184+
return client(repositoryMetadata);
180185
} else {
181186
return perProjectClientManager.client(projectId, repositoryMetadata);
182187
}

0 commit comments

Comments
 (0)