Skip to content

Commit

Permalink
move to inner
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellblazer committed Mar 5, 2024
1 parent 2b50be5 commit 20906dc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,13 @@ default int toleranceLevel() {

boolean validRing(int ring);

/**
* @author hal.hildebrand
**/
enum IterateResult {
CONTINUE, FAIL, SUCCESS
}

/**
* @author hal.hildebrand
**/
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.salesforce.apollo.archipelago.Link;
import com.salesforce.apollo.archipelago.RouterImpl.CommonCommunications;
import com.salesforce.apollo.context.Context;
import com.salesforce.apollo.context.IterateResult;
import com.salesforce.apollo.cryptography.Digest;
import com.salesforce.apollo.membership.Member;
import com.salesforce.apollo.membership.SigningMember;
Expand Down Expand Up @@ -100,16 +99,16 @@ List<iteration<T>> calculateTraversal(Digest digest) {
for (int ring = 0; ring < context.getRingCount(); ring++) {
T successor = direction.retrieve(context, ring, digest, m -> {
if (ignoreSelf && m.equals(member)) {
return IterateResult.CONTINUE;
return Context.IterateResult.CONTINUE;
}
if (noDuplicates) {
if (traversed.add(m)) {
return IterateResult.SUCCESS;
return Context.IterateResult.SUCCESS;
} else {
return IterateResult.CONTINUE;
return Context.IterateResult.CONTINUE;
}
}
return IterateResult.SUCCESS;
return Context.IterateResult.SUCCESS;
});
traversal.add(new iteration<>(successor == null ? (T) member : successor, ring));
}
Expand Down Expand Up @@ -181,34 +180,34 @@ public enum Direction {
PREDECESSOR {
@Override
public <T extends Member> T retrieve(Context<T> context, int ring, Digest hash,
Function<T, IterateResult> test) {
Function<T, Context.IterateResult> test) {
return context.findPredecessor(ring, hash, test);
}

@Override
public <T extends Member> T retrieve(Context<T> context, int ring, T member,
Function<T, IterateResult> test) {
Function<T, Context.IterateResult> test) {
return context.findPredecessor(ring, member, test);
}
}, SUCCESSOR {
@Override
public <T extends Member> T retrieve(Context<T> context, int ring, Digest hash,
Function<T, IterateResult> test) {
Function<T, Context.IterateResult> test) {
return context.findSuccessor(ring, hash, test);
}

@Override
public <T extends Member> T retrieve(Context<T> context, int ring, T member,
Function<T, IterateResult> test) {
Function<T, Context.IterateResult> test) {
return context.findSuccessor(ring, member, test);
}
};

public abstract <T extends Member> T retrieve(Context<T> context, int ring, Digest hash,
Function<T, IterateResult> test);
Function<T, Context.IterateResult> test);

public abstract <T extends Member> T retrieve(Context<T> context, int ring, T member,
Function<T, IterateResult> test);
Function<T, Context.IterateResult> test);
}

public record Destination<M, Q>(M member, Q link, int ring) {
Expand Down

0 comments on commit 20906dc

Please sign in to comment.