Skip to content

Commit

Permalink
Renamed some RFS types
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Helma <chelma+github@amazon.com>
  • Loading branch information
chelma committed May 2, 2024
1 parent e4884d1 commit 8850fbe
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 23 deletions.
4 changes: 2 additions & 2 deletions RFS/src/main/java/com/rfs/DemoPrintOutSnapshot.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.rfs.common.SnapshotRepo;
import com.rfs.common.SnapshotShardUnpacker;
import com.rfs.common.ClusterVersion;
import com.rfs.common.FilesystemRepo;
import com.rfs.common.FileSystemRepo;
import com.rfs.version_es_7_10.*;

public class DemoPrintOutSnapshot {
Expand Down Expand Up @@ -62,7 +62,7 @@ public static void main(String[] args) {
throw new IllegalArgumentException("Unsupported source version: " + sourceVersion);
}

SourceRepo repo = new FilesystemRepo(Path.of(snapshotDirPath));
SourceRepo repo = new FileSystemRepo(Path.of(snapshotDirPath));

try {
// ==========================================================================================================
Expand Down
4 changes: 2 additions & 2 deletions RFS/src/main/java/com/rfs/ReindexFromSnapshot.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ public static void main(String[] args) throws InterruptedException {

SourceRepo repo;
if (snapshotDirPath != null) {
repo = new FilesystemRepo(snapshotDirPath);
repo = new FileSystemRepo(snapshotDirPath);
} else if (s3RepoUri != null && s3Region != null && s3LocalDirPath != null) {
repo = S3Repo.create(s3LocalDirPath, new S3Uri(s3RepoUri), s3Region);
} else if (snapshotLocalRepoDirPath != null) {
repo = new FilesystemRepo(snapshotLocalRepoDirPath);
repo = new FileSystemRepo(snapshotLocalRepoDirPath);
} else {
throw new IllegalArgumentException("Could not construct a source repo from the available, user-supplied arguments");
}
Expand Down
5 changes: 2 additions & 3 deletions RFS/src/main/java/com/rfs/common/FilesystemRepo.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.rfs.common;


import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class FilesystemRepo implements SourceRepo {
public class FileSystemRepo implements SourceRepo {
private final Path repoRootDir;

private Path findRepoFile() throws IOException {
Expand All @@ -34,7 +33,7 @@ private Path findRepoFile() throws IOException {
return highestVersionedFile;
}

public FilesystemRepo(Path repoRootDir) {
public FileSystemRepo(Path repoRootDir) {
this.repoRootDir = repoRootDir;
}

Expand Down
18 changes: 9 additions & 9 deletions RFS/src/main/java/com/rfs/common/OpenSearchClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,33 @@ public OpenSearchClient(ConnectionDetails connectionDetails) {
}

/*
* Create a legacy template if it does not already exist; return true if created, false otherwise.
* Idempotently create a legacy template if it does not already exist; return true if created, false otherwise.
*/
public boolean createLegacyTemplateIdempotent(String templateName, ObjectNode settings){
public boolean createLegacyTemplate(String templateName, ObjectNode settings){
String targetPath = "_template/" + templateName;
return createObjectIdempotent(targetPath, settings);
}

/*
* Create a component template if it does not already exist; return true if created, false otherwise.
* Idempotently create a component template if it does not already exist; return true if created, false otherwise.
*/
public boolean createComponentTemplateIdempotent(String templateName, ObjectNode settings){
public boolean createComponentTemplate(String templateName, ObjectNode settings){
String targetPath = "_component_template/" + templateName;
return createObjectIdempotent(targetPath, settings);
}

/*
* Create an index template if it does not already exist; return true if created, false otherwise.
* Idempotently create an index template if it does not already exist; return true if created, false otherwise.
*/
public boolean createIndexTemplateIdempotent(String templateName, ObjectNode settings){
public boolean createIndexTemplate(String templateName, ObjectNode settings){
String targetPath = "_index_template/" + templateName;
return createObjectIdempotent(targetPath, settings);
}

/*
* Create an index if it does not already exist; return true if created, false otherwise.
* Idempotently create an index if it does not already exist; return true if created, false otherwise.
*/
public boolean createIndexIdempotent(String indexName, ObjectNode settings){
public boolean createIndex(String indexName, ObjectNode settings){
String targetPath = indexName;
return createObjectIdempotent(targetPath, settings);
}
Expand Down Expand Up @@ -126,7 +126,7 @@ public RestClient.Response getSnapshotStatus(String repoName, String snapshotNam
}

/*
* Create a document if it does not already exist; return true if created, false otherwise.
* Idempotently create a document if it does not already exist; return true if created, false otherwise.
*/
public boolean createDocument(String indexName, String documentId, ObjectNode body) {
String targetPath = indexName + "/_doc/" + documentId + "?op_type=create";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static void createTemplates(GlobalMetadataData_OS_2_11 globalMetadata, Op

logger.info("Setting Legacy Template: " + templateName);
ObjectNode settings = (ObjectNode) globalMetadata.getTemplates().get(templateName);
client.createLegacyTemplateIdempotent(templateName, settings);
client.createLegacyTemplate(templateName, settings);
}
} else {
// Get the template names
Expand All @@ -50,7 +50,7 @@ public static void createTemplates(GlobalMetadataData_OS_2_11 globalMetadata, Op
for (String templateName : templateKeys) {
logger.info("Setting Legacy Template: " + templateName);
ObjectNode settings = (ObjectNode) templates.get(templateName);
client.createLegacyTemplateIdempotent(templateName, settings);
client.createLegacyTemplate(templateName, settings);
}
}
}
Expand All @@ -73,7 +73,7 @@ public static void createComponentTemplates(GlobalMetadataData_OS_2_11 globalMet

logger.info("Setting Component Template: " + templateName);
ObjectNode settings = (ObjectNode) templates.get(templateName);
client.createComponentTemplateIdempotent(templateName, settings);
client.createComponentTemplate(templateName, settings);
}
} else {
// Get the template names
Expand All @@ -84,7 +84,7 @@ public static void createComponentTemplates(GlobalMetadataData_OS_2_11 globalMet
for (String templateName : templateKeys) {
logger.info("Setting Component Template: " + templateName);
ObjectNode settings = (ObjectNode) templates.get(templateName);
client.createComponentTemplateIdempotent(templateName, settings);
client.createComponentTemplate(templateName, settings);
}
}
}
Expand All @@ -107,7 +107,7 @@ public static void createIndexTemplates(GlobalMetadataData_OS_2_11 globalMetadat

logger.info("Setting Index Template: " + templateName);
ObjectNode settings = (ObjectNode) globalMetadata.getIndexTemplates().get(templateName);
client.createIndexTemplateIdempotent(templateName, settings);
client.createIndexTemplate(templateName, settings);
}
} else {
// Get the template names
Expand All @@ -118,7 +118,7 @@ public static void createIndexTemplates(GlobalMetadataData_OS_2_11 globalMetadat
for (String templateName : templateKeys) {
logger.info("Setting Index Template: " + templateName);
ObjectNode settings = (ObjectNode) templates.get(templateName);
client.createIndexTemplateIdempotent(templateName, settings);
client.createIndexTemplate(templateName, settings);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public static void create(String indexName, IndexMetadata.Data indexMetadata, Op
body.set("settings", settings);

// Idempotently create the index
client.createIndexIdempotent(indexName, body);
client.createIndex(indexName, body);
}
}

0 comments on commit 8850fbe

Please sign in to comment.