belliottsmith commented on code in PR #173: URL: https://github.com/apache/cassandra-accord/pull/173#discussion_r1968448668
########## accord-core/src/main/java/accord/primitives/Deps.java: ########## @@ -326,13 +304,76 @@ public int size() }; } + public int indexOf(TxnId txnId) + { + switch (txnId.domain()) + { + default: throw new UnhandledEnum(txnId.domain()); + case Key: + { + if (managesExecution(txnId)) + return keyDeps.indexOf(txnId); + int index = directKeyDeps.indexOf(txnId); + return index < 0 ? -1 : keyDeps.txnIdCount() + index; + } + case Range: + { + int index = rangeDeps.indexOf(txnId); + return index < 0 ? -1 : keyDeps.txnIdCount() + directKeyDeps.txnIdCount() + index; + } + } + } + public Participants<?> participants(TxnId txnId) + { + return applyToId(txnId, KeyOrRangeDeps::participants); + } + + public Participants<?> participants(int index) + { + return applyToIndex(index, KeyOrRangeDeps::participants); + } + + public boolean isStable(int index) + { + return !applyToIndex(index, KeyOrRangeDeps::txnIdWithFlags).is(UNSTABLE); + } + + private <T> T applyToIndex(int index, IndexedFunction<KeyOrRangeDeps, T> apply) + { + { Review Comment: for scoping, but probably date from an earlier method formulation where it mattered more. removing them... -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org