Skip to content

Commit

Permalink
Rename ConflictResolution.IGNORE -> ADD
Browse files Browse the repository at this point in the history
  • Loading branch information
snazy committed Apr 25, 2023
1 parent 1fad016 commit da2cd0d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ private static boolean handleConflict(
conflicts.add(conflict);
// Do not the conflicting action to the commit, report the conflict
return true;
case IGNORE:
case ADD:
// Add the conflicting action to the resulting commit, not reporting as a conflict
return false;
case DROP:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ enum ConflictResolution {
/** Raise the conflict as is. */
CONFLICT,
/** Ignore the conflict, add action to the commit. */
IGNORE,
ADD,
/** Ignore the conflict, do not add the action to the commit. */
DROP
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import static org.projectnessie.versioned.storage.common.logic.CommitLogic.ValueReplacement.NO_VALUE_REPLACEMENT;
import static org.projectnessie.versioned.storage.common.logic.ConflictHandler.ConflictResolution.CONFLICT;
import static org.projectnessie.versioned.storage.common.logic.ConflictHandler.ConflictResolution.DROP;
import static org.projectnessie.versioned.storage.common.logic.ConflictHandler.ConflictResolution.IGNORE;
import static org.projectnessie.versioned.storage.common.logic.CreateCommit.Add.commitAdd;
import static org.projectnessie.versioned.storage.common.logic.CreateCommit.Remove.commitRemove;
import static org.projectnessie.versioned.storage.common.logic.CreateCommit.Unchanged.commitUnchanged;
Expand Down Expand Up @@ -570,7 +569,7 @@ public void commitConflictCallbackKeyDoesNotExist() throws Exception {
.build(),
c -> {
conflicts.add(c);
return IGNORE;
return ConflictHandler.ConflictResolution.ADD;
},
callbacks::put,
NO_VALUE_REPLACEMENT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
import static org.projectnessie.versioned.storage.common.indexes.StoreKey.key;
import static org.projectnessie.versioned.storage.common.logic.CommitLogic.ValueReplacement.NO_VALUE_REPLACEMENT;
import static org.projectnessie.versioned.storage.common.logic.ConflictHandler.ConflictResolution.ADD;
import static org.projectnessie.versioned.storage.common.logic.ConflictHandler.ConflictResolution.CONFLICT;
import static org.projectnessie.versioned.storage.common.logic.ConflictHandler.ConflictResolution.IGNORE;
import static org.projectnessie.versioned.storage.common.logic.CreateCommit.Add.commitAdd;
import static org.projectnessie.versioned.storage.common.logic.CreateCommit.Remove.commitRemove;
import static org.projectnessie.versioned.storage.common.logic.Logics.commitLogic;
Expand Down Expand Up @@ -98,11 +98,7 @@ public void hashesDifferChecks(List<Consumer<CreateCommit.Builder>> modifiers) t

CommitObj c2 =
commitLogic.buildCommitObj(
commit.build(),
c -> IGNORE,
(k, id) -> {},
NO_VALUE_REPLACEMENT,
NO_VALUE_REPLACEMENT);
commit.build(), c -> ADD, (k, id) -> {}, NO_VALUE_REPLACEMENT, NO_VALUE_REPLACEMENT);
soft.assertThat(c2)
.describedAs("modified commit: %s", c2)
.isNotNull()
Expand Down Expand Up @@ -155,11 +151,7 @@ public void hashesDoNotDifferChecks(List<Consumer<CreateCommit.Builder>> modifie

CommitObj c2 =
commitLogic.buildCommitObj(
commit.build(),
c -> IGNORE,
(k, id) -> {},
NO_VALUE_REPLACEMENT,
NO_VALUE_REPLACEMENT);
commit.build(), c -> ADD, (k, id) -> {}, NO_VALUE_REPLACEMENT, NO_VALUE_REPLACEMENT);
soft.assertThat(c2)
.describedAs("modified commit: %s", c2)
.isNotNull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ CommitObj createMergeTransplantCommit(
&& ex != null
&& op.payload() == ex.payload()
&& contentTypeForPayload((byte) op.payload()) == NAMESPACE) {
return ConflictResolution.IGNORE;
return ConflictResolution.ADD;
}
}

Expand All @@ -586,7 +586,7 @@ && contentTypeForPayload((byte) op.payload()) == NAMESPACE) {
if (mergeKeyBe.getExpectedTargetContent() == null) {
keyDetailsMap.put(key, keyDetails(mergeBehavior, ConflictType.NONE));
return mergeBehavior == MergeBehavior.FORCE
? ConflictResolution.IGNORE
? ConflictResolution.ADD
: ConflictResolution.DROP;
}
// fall through
Expand All @@ -597,12 +597,12 @@ && contentTypeForPayload((byte) op.payload()) == NAMESPACE) {
mergeBehavior,
ConflictType.UNRESOLVABLE,
commitConflictToConflict(conflict)));
return ConflictResolution.IGNORE;
return ConflictResolution.ADD;
default:
throw new IllegalStateException("Unknown merge behavior " + mergeBehavior);
}
}
return ConflictResolution.IGNORE;
return ConflictResolution.ADD;
},
/*
* Callback from the commit-logic telling us the value-ObjId for a key.
Expand Down

0 comments on commit da2cd0d

Please sign in to comment.