belliottsmith commented on code in PR #50:
URL: https://github.com/apache/cassandra-accord/pull/50#discussion_r1254348751
##########
accord-core/src/main/java/accord/impl/AbstractSafeCommandStore.java:
##########
@@ -85,47 +86,42 @@ private static <K, V> V getIfLoaded(K key, Function<K, V>
get, Consumer<V> add,
}
@Override
- public CommandType ifPresent(TxnId txnId)
- {
- CommandType command = getCommandInternal(txnId);
- if (command == null)
- throw new IllegalStateException(String.format("%s was not
specified in PreLoadContext", txnId));
- if (command.isEmpty())
- return null;
- return command;
- }
-
- @Override
- public CommandType ifLoaded(TxnId txnId)
+ public CommandType ifLoadedAndInitialised(TxnId txnId)
{
CommandType command = getIfLoaded(txnId, this::getCommandInternal,
this::addCommandInternal, this::getIfLoaded);
- if (command == null)
+ if (command == null || command.isEmpty())
return null;
- if (command.isEmpty())
- command.notWitnessed();
return command;
}
@Override
- public CommandType command(TxnId txnId)
+ public CommandType get(TxnId txnId)
{
CommandType command = getCommandInternal(txnId);
if (command == null)
throw new IllegalStateException(String.format("%s was not
specified in PreLoadContext", txnId));
if (command.isEmpty())
- command.notWitnessed();
+ command.uninitialised();
return command;
}
- protected abstract CommandLoader<?> cfkLoader();
+ protected abstract CommandLoader<?> cfkLoader(RoutableKey key);
- public CommandsForKeyType ifLoaded(RoutableKey key)
+ public CommandsForKeyType ifLoadedAndInitialised(RoutableKey key)
{
CommandsForKeyType cfk = getIfLoaded(key,
this::getCommandsForKeyInternal, this::addCommandsForKeyInternal,
this::getIfLoaded);
if (cfk == null)
return null;
if (cfk.isEmpty())
- cfk.initialize(cfkLoader());
+ {
+ cfk.initialize(cfkLoader(key));
Review Comment:
I don't follow. We do apply the `redundantBefore` logic to any CFK that has
been initialised?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]