forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce remote store path type in customData in IndexMetadata (open…
…search-project#12607) Signed-off-by: Ashish Singh <ssashish@amazon.com>
- Loading branch information
Showing
7 changed files
with
202 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
server/src/main/java/org/opensearch/index/remote/RemoteStorePathResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.index.remote; | ||
|
||
import org.opensearch.common.settings.ClusterSettings; | ||
import org.opensearch.indices.IndicesService; | ||
|
||
/** | ||
* Determines the {@link RemoteStorePathType} at the time of index metadata creation. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class RemoteStorePathResolver { | ||
|
||
private final ClusterSettings clusterSettings; | ||
|
||
public RemoteStorePathResolver(ClusterSettings clusterSettings) { | ||
this.clusterSettings = clusterSettings; | ||
} | ||
|
||
public RemoteStorePathType resolveType() { | ||
return clusterSettings.get(IndicesService.CLUSTER_REMOTE_STORE_PATH_PREFIX_TYPE_SETTING); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
server/src/main/java/org/opensearch/index/remote/RemoteStorePathType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.index.remote; | ||
|
||
import java.util.Locale; | ||
|
||
/** | ||
* Enumerates the types of remote store paths resolution techniques supported by OpenSearch. | ||
* For more information, see <a href="https://github.com/opensearch-project/OpenSearch/issues/12567">Github issue #12567</a>. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public enum RemoteStorePathType { | ||
|
||
FIXED, | ||
HASHED_PREFIX; | ||
|
||
public static RemoteStorePathType parseString(String remoteStoreBlobPathType) { | ||
try { | ||
return RemoteStorePathType.valueOf(remoteStoreBlobPathType.toUpperCase(Locale.ROOT)); | ||
} catch (IllegalArgumentException e) { | ||
throw new IllegalArgumentException("Could not parse RemoteStorePathType for [" + remoteStoreBlobPathType + "]"); | ||
} | ||
} | ||
|
||
/** | ||
* This string is used as key for storing information in the custom data in index settings. | ||
*/ | ||
public static final String NAME = "path_type"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters