iamaleksey commented on code in PR #22:
URL: https://github.com/apache/cassandra-accord/pull/22#discussion_r1067021327
##########
accord-core/src/main/java/accord/primitives/TxnId.java:
##########
@@ -22,13 +22,42 @@
public class TxnId extends Timestamp
{
- public TxnId(Timestamp timestamp)
+ public static TxnId fromBits(long msb, long lsb, Id node)
{
- super(timestamp);
+ return new TxnId(msb, lsb, node);
+ }
+ public static TxnId fromRaw(long epoch, long hlc, int flags, Id node)
+ {
+ return new TxnId(epoch, hlc, flags, node);
+ }
+
+ public TxnId(Timestamp timestamp, Txn.Kind rw, Routable.Domain domain)
+ {
+ super(timestamp, (rw.ordinal() << 1) | domain.ordinal());
+ }
+
+ public TxnId(long epoch, long hlc, Txn.Kind rw, Routable.Domain domain, Id
node)
+ {
+ this(epoch, hlc, (rw.ordinal() << 1) | domain.ordinal(), node);
+ }
+
+ private TxnId(long epoch, long hlc, int flags, Id node)
+ {
+ super(epoch, hlc, flags, node);
+ }
+
+ private TxnId(long msb, long lsb, Id node)
+ {
+ super(msb, lsb, node);
+ }
+
+ public Txn.Kind rw()
Review Comment:
I would consider adding `isWrite()` and `isRead()` to `TxnId` to further
shorten call chains like `txnId.rw().isWrite()` in e.g.
`InMemoryCommandsForKey` by one.
--
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]