Skip to content

Commit

Permalink
Cleaning up core
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Jun 28, 2024
1 parent fc000c6 commit bcbd213
Show file tree
Hide file tree
Showing 27 changed files with 141 additions and 429 deletions.
126 changes: 0 additions & 126 deletions MetadataMigration/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ public static void removeIntermediateIndexSettingsLevel(ObjectNode root) {
}

/**
* If allocation awareness is enabled, we need to ensure that the number of copies of our data matches the dimensionality.
* As a specific example, if you spin up a cluster spread across 3 availability zones and your awareness attribute is "zone",
* then the dimensionality would be 3. This means you need to ensure the number of total copies is a multiple of 3, with
* the minimum number of * If allocation awareness is enabled, we need to ensure that the number of copies of our data matches the dimensionality.
replicas being 2.
* the minimum number of replicas being 2.
*/
public static void fixReplicasForDimensionality(ObjectNode root, int dimensionality) {
if (root.has("settings")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.rfs.models.GlobalMetadata;

public class GlobalMetadataData_ES_6_8 implements com.rfs.models.GlobalMetadata {
public class GlobalMetadataData_ES_6_8 implements GlobalMetadata {
private final ObjectNode root;

public GlobalMetadataData_ES_6_8(ObjectNode root) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.rfs.common.SnapshotRepo;
import com.rfs.models.GlobalMetadata;

public class GlobalMetadataFactory_ES_6_8 implements com.rfs.models.GlobalMetadata.Factory{
public class GlobalMetadataFactory_ES_6_8 implements GlobalMetadata.Factory{
private final SnapshotRepo.Provider repoDataProvider;

public GlobalMetadataFactory_ES_6_8(SnapshotRepo.Provider repoDataProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.rfs.models.IndexMetadata;
import com.rfs.transformers.TransformFunctions;

public class IndexMetadataData_ES_6_8 implements com.rfs.models.IndexMetadata {
public class IndexMetadataData_ES_6_8 implements IndexMetadata {
private ObjectNode root;
private ObjectNode mappings;
private ObjectNode settings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.rfs.common.SnapshotRepo;
import com.rfs.models.IndexMetadata;

public class IndexMetadataFactory_ES_6_8 implements com.rfs.models.IndexMetadata.Factory {
public class IndexMetadataFactory_ES_6_8 implements IndexMetadata.Factory {
private final SnapshotRepo.Provider repoDataProvider;

public IndexMetadataFactory_ES_6_8(SnapshotRepo.Provider repoDataProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.fasterxml.jackson.dataformat.smile.SmileFactory;
import com.rfs.models.SnapshotMetadata;

public class SnapshotMetadataFactory_ES_6_8 implements com.rfs.models.SnapshotMetadata.Factory {
public class SnapshotMetadataFactory_ES_6_8 implements SnapshotMetadata.Factory {

/**
* A version of the Elasticsearch approach simplified by assuming JSON; see here [1] for more details.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.rfs.version_es_7_10;

import com.fasterxml.jackson.databind.node.ObjectNode;
import com.rfs.models.GlobalMetadata;

public class GlobalMetadataData_ES_7_10 implements com.rfs.models.GlobalMetadata {
public class GlobalMetadataData_ES_7_10 implements GlobalMetadata {
private final ObjectNode root;

public GlobalMetadataData_ES_7_10(ObjectNode root) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.rfs.common.SnapshotRepo;
import com.rfs.models.GlobalMetadata;

public class GlobalMetadataFactory_ES_7_10 implements com.rfs.models.GlobalMetadata.Factory{
public class GlobalMetadataFactory_ES_7_10 implements GlobalMetadata.Factory{
private final SnapshotRepo.Provider repoDataProvider;

public GlobalMetadataFactory_ES_7_10(SnapshotRepo.Provider repoDataProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.rfs.models.IndexMetadata;
import com.rfs.transformers.TransformFunctions;

public class IndexMetadataData_ES_7_10 implements com.rfs.models.IndexMetadata {
public class IndexMetadataData_ES_7_10 implements IndexMetadata {
private ObjectNode root;
private ObjectNode mappings;
private ObjectNode settings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.rfs.common.SnapshotRepo;
import com.rfs.models.IndexMetadata;

public class IndexMetadataFactory_ES_7_10 implements com.rfs.models.IndexMetadata.Factory {
public class IndexMetadataFactory_ES_7_10 implements IndexMetadata.Factory {
private final SnapshotRepo.Provider repoDataProvider;

public IndexMetadataFactory_ES_7_10(SnapshotRepo.Provider repoDataProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.fasterxml.jackson.dataformat.smile.SmileFactory;
import com.rfs.models.SnapshotMetadata;

public class SnapshotMetadataFactory_ES_7_10 implements com.rfs.models.SnapshotMetadata.Factory {
public class SnapshotMetadataFactory_ES_7_10 implements SnapshotMetadata.Factory {

/**
* A version of the Elasticsearch approach simplified by assuming JSON; see here [1] for more details.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
package org.opensearch.migrations.transformation;

public enum CanApplyResult {
YES,
NO,
UNSUPPORTED;
}
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
* The result after checking if a transformer can be applied to an entity
*/
public abstract class CanApplyResult {
public final static CanApplyResult YES = new Yes();
public final static CanApplyResult NO = new No();


public static final class Yes extends CanApplyResult {
}

public static final class No extends CanApplyResult {
}

/** If the transformation should apply but there is an issue that would prevent it from being applied corrrectly, return a reason */
@RequiredArgsConstructor
@Getter
public static final class Unsupported extends CanApplyResult {
private final String reason;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,17 @@
* Describes how to an entity is transformed from one version to another.
*/
public interface TransformationRule<T extends Entity> {
VersionRange supportedSourceVersionRange();
VersionRange supportedTargetVersionRange();
/**
* Given an entity can a transformation be run on it
*
* MUST ALWAYS BE READ ONLY
*/
CanApplyResult canApply(T entity);

/**
* Apply a transformation on the entity
* @param entity The entity to be transformed in place
* @return true if the entity was updated, or false if no changse were made
*/
boolean applyTransformation(T entity);
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit bcbd213

Please sign in to comment.