Package com.tuladb
Class Protocol
java.lang.Object
com.tuladb.Protocol
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intReserve-expiry capability flag.static final intstatic final bytestatic final byteControl-plane: promote the best caught-up standby learner in a group.static final byteControl-plane: submit a serialised ClusterConfig (Raft §4 reconfig).static final bytestatic final byteDeprecated.static final bytestatic final byteDeprecated.static final byteBatched account create (engine MSG_CREATE_ACCOUNT_BATCH 0x41).static final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final byte0x27: admin per-ledger reservation TTL update.static final byte0x28: admin per-ledger transaction amount cap update.static final byte0x2C: every balance one id holds within ONE ledger, a row per currency.static final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final byteDeprecated.static final bytestatic final bytestatic final bytestatic final byteDeprecated.static final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final byteDeprecated.static final bytestatic final byteDeprecated.static final bytestatic final byteDeprecated.static final bytestatic final byteDeprecated.static final bytestatic final byteDeprecated.static final bytestatic final byteControl-plane: graceful leader transfer (Raft §3.10).static final bytestatic final byteR2-H4: remote build-identity probe.static final shortR2-H2: caller opts into stale follower reads.static final shortstatic final shortR3-L7: deadline_remaining_ms is meaningful only when this flag is set.static final shortstatic final shortstatic final intstatic final byte3 = account key: an account is (ledger_id, currency, id) and every account-addressed request names it. -
Method Summary
Modifier and TypeMethodDescriptionstatic intcrc32(byte msgType, short flags, byte[] payload) static intcrc32OverFrame(byte[] header, byte[] payload) CRC over a received 24-byte header (with the crc32 field zeroed) plus the payload, matching the wire contract: the CRC covers the full header — includingdeadline_remaining_msandreservedas received — not an assumed-zero reconstruction.static byte[]frame(byte msgType, short flags, byte[] payload) Header and payload in one buffer, for a single write.static byte[]header(byte msgType, short flags, byte[] payload) static ByteBufferle(int size) static longu128Hi(byte[] data, int offset) static byte[]u128Le(long hi, long lo) static longu128Lo(byte[] data, int offset)
-
Field Details
-
WIRE_MAGIC
public static final int WIRE_MAGIC- See Also:
-
WIRE_VERSION
public static final byte WIRE_VERSION3 = account key: an account is (ledger_id, currency, id) and every account-addressed request names it. A hard fence: the engine refuses every other version on every port, and so does this client. 4 = TxnRecord 256 -> 384 bytes in every record-bearing response.- See Also:
-
MSG_CREATE_ACCOUNT
Deprecated.Retired: useMSG_CREATE_ACCOUNT_BATCH.- See Also:
-
MSG_TRANSFER
Deprecated.Retired: useMSG_TRANSFER_BATCH.- See Also:
-
MSG_RESERVE
Deprecated.Retired: useMSG_RESERVE_BATCH.- See Also:
-
MSG_COMMIT
Deprecated.Retired: useMSG_COMMIT_BATCH.- See Also:
-
MSG_ROLLBACK
Deprecated.Retired: useMSG_ROLLBACK_BATCH.- See Also:
-
MSG_GET_BALANCE
public static final byte MSG_GET_BALANCE- See Also:
-
MSG_GET_TRANSACTION
public static final byte MSG_GET_TRANSACTION- See Also:
-
MSG_GET_HISTORY
public static final byte MSG_GET_HISTORY- See Also:
-
MSG_PING
public static final byte MSG_PING- See Also:
-
MSG_CLUSTER_STATUS
public static final byte MSG_CLUSTER_STATUS- See Also:
-
MSG_CLUSTER_RECONFIG
public static final byte MSG_CLUSTER_RECONFIGControl-plane: submit a serialised ClusterConfig (Raft §4 reconfig).- See Also:
-
MSG_TRANSFER_LEADERSHIP
public static final byte MSG_TRANSFER_LEADERSHIPControl-plane: graceful leader transfer (Raft §3.10). Request: LE uint32 target_node_id; OK response empty.- See Also:
-
MSG_CLUSTER_PROMOTE_STANDBY
public static final byte MSG_CLUSTER_PROMOTE_STANDBYControl-plane: promote the best caught-up standby learner in a group.- See Also:
-
MSG_FEATURE_ACTIVATE
public static final byte MSG_FEATURE_ACTIVATE- See Also:
-
FEATURE_RESERVE_EXPIRY
public static final int FEATURE_RESERVE_EXPIRYReserve-expiry capability flag. The engine has it always on; activating it (LedgerClient#activateFeature) answers OK and writes nothing.- See Also:
-
MSG_TIERED_TRANSFER
Deprecated.Retired: useMSG_TIERED_TRANSFER_BATCH.- See Also:
-
MSG_LIST_ACCOUNTS
public static final byte MSG_LIST_ACCOUNTS- See Also:
-
MSG_LIST_TRANSFERS
public static final byte MSG_LIST_TRANSFERS- See Also:
-
MSG_LIST_PENDING
public static final byte MSG_LIST_PENDING- See Also:
-
MSG_TIERED_RESERVE
Deprecated.Retired: useMSG_TIERED_RESERVE_BATCH.- See Also:
-
MSG_TIERED_COMMIT
Deprecated.Retired: useMSG_TIERED_COMMIT_BATCH.- See Also:
-
MSG_TIERED_ROLLBACK
Deprecated.Retired: useMSG_TIERED_ROLLBACK_BATCH.- See Also:
-
MSG_LIST_REJECTED
public static final byte MSG_LIST_REJECTED- See Also:
-
MSG_TRANSFER_BATCH
public static final byte MSG_TRANSFER_BATCH- See Also:
-
MSG_SEARCH_ACCOUNTS
public static final byte MSG_SEARCH_ACCOUNTS- See Also:
-
MSG_SEARCH_TXNS
public static final byte MSG_SEARCH_TXNS- See Also:
-
MSG_RESERVE_BATCH
public static final byte MSG_RESERVE_BATCH- See Also:
-
MSG_COMMIT_BATCH
public static final byte MSG_COMMIT_BATCH- See Also:
-
MSG_ROLLBACK_BATCH
public static final byte MSG_ROLLBACK_BATCH- See Also:
-
MSG_TIERED_TRANSFER_BATCH
public static final byte MSG_TIERED_TRANSFER_BATCH- See Also:
-
MSG_TIERED_RESERVE_BATCH
public static final byte MSG_TIERED_RESERVE_BATCH- See Also:
-
MSG_TIERED_COMMIT_BATCH
public static final byte MSG_TIERED_COMMIT_BATCH- See Also:
-
MSG_TIERED_ROLLBACK_BATCH
public static final byte MSG_TIERED_ROLLBACK_BATCH- See Also:
-
MSG_UPDATE_ACCOUNT
public static final byte MSG_UPDATE_ACCOUNT- See Also:
-
MSG_GET_ACCOUNT_HISTORY
public static final byte MSG_GET_ACCOUNT_HISTORY- See Also:
-
MSG_CREATE_ACCOUNT_BATCH
public static final byte MSG_CREATE_ACCOUNT_BATCHBatched account create (engine MSG_CREATE_ACCOUNT_BATCH 0x41). Request: u32 count + count * AccountCreate (80 B); OK response: u32 count + count * i32 status (an identical existing account answers OK).- See Also:
-
MSG_LIST_ACCOUNT_BALANCES
public static final byte MSG_LIST_ACCOUNT_BALANCES0x2C: every balance one id holds within ONE ledger, a row per currency.- See Also:
-
MSG_LEDGER_CREATE
public static final byte MSG_LEDGER_CREATE- See Also:
-
MSG_LEDGER_LIST
public static final byte MSG_LEDGER_LIST- See Also:
-
MSG_LEDGER_GET
public static final byte MSG_LEDGER_GET- See Also:
-
MSG_LEDGER_ADD_SOURCE
public static final byte MSG_LEDGER_ADD_SOURCE- See Also:
-
MSG_LEDGER_REMOVE_SOURCE
public static final byte MSG_LEDGER_REMOVE_SOURCE- See Also:
-
MSG_LEDGER_LIST_SOURCES
public static final byte MSG_LEDGER_LIST_SOURCES- See Also:
-
MSG_LEDGER_SET_EXPIRY
public static final byte MSG_LEDGER_SET_EXPIRY0x27: admin per-ledger reservation TTL update.- See Also:
-
MSG_LEDGER_SET_MAX_AMOUNT
public static final byte MSG_LEDGER_SET_MAX_AMOUNT0x28: admin per-ledger transaction amount cap update.- See Also:
-
MSG_SOURCE_CREATE
public static final byte MSG_SOURCE_CREATE- See Also:
-
MSG_SOURCE_LIST
public static final byte MSG_SOURCE_LIST- See Also:
-
MSG_SOURCE_GET
public static final byte MSG_SOURCE_GET- See Also:
-
MSG_SOURCE_SET_ACTIVE
public static final byte MSG_SOURCE_SET_ACTIVE- See Also:
-
MSG_ACCOUNT_SET_ACTIVE
public static final byte MSG_ACCOUNT_SET_ACTIVE- See Also:
-
ACCT_INACTIVE
public static final int ACCT_INACTIVE- See Also:
-
MSG_CURRENCY_CREATE
public static final byte MSG_CURRENCY_CREATE- See Also:
-
MSG_CURRENCY_LIST
public static final byte MSG_CURRENCY_LIST- See Also:
-
MSG_CURRENCY_GET
public static final byte MSG_CURRENCY_GET- See Also:
-
MSG_CURRENCY_SET_ACTIVE
public static final byte MSG_CURRENCY_SET_ACTIVE- See Also:
-
MSG_RESP_OK
public static final byte MSG_RESP_OK- See Also:
-
MSG_RESP_ERROR
public static final byte MSG_RESP_ERROR- See Also:
-
MSG_PONG
public static final byte MSG_PONG- See Also:
-
MSG_VERSION
public static final byte MSG_VERSIONR2-H4: remote build-identity probe. Empty request payload; response payload is a UTF-8 string of the form "tuladbd\nbuild: - See Also:
-
WIRE_FLAG_BATCH_END
public static final short WIRE_FLAG_BATCH_END- See Also:
-
WIRE_FLAG_INTERNAL_REPL
public static final short WIRE_FLAG_INTERNAL_REPL- See Also:
-
WIRE_FLAG_PROXY_BATCH
public static final short WIRE_FLAG_PROXY_BATCH- See Also:
-
WIRE_FLAG_ALLOW_FOLLOWER_READ
public static final short WIRE_FLAG_ALLOW_FOLLOWER_READR2-H2: caller opts into stale follower reads. Only honoured by the server on read RPCs; writes ignore the bit. See the engine `docs/replication-model.md#opt-in-follower-reads-r2-h2` for the staleness contract.- See Also:
-
WIRE_FLAG_HAS_DEADLINE
public static final short WIRE_FLAG_HAS_DEADLINER3-L7: deadline_remaining_ms is meaningful only when this flag is set.- See Also:
-
HEADER_SIZE
public static final int HEADER_SIZE- See Also:
-
-
Method Details
-
u128Le
public static byte[] u128Le(long hi, long lo) -
u128Lo
public static long u128Lo(byte[] data, int offset) -
u128Hi
public static long u128Hi(byte[] data, int offset) -
le
-
frame
public static byte[] frame(byte msgType, short flags, byte[] payload) Header and payload in one buffer, for a single write. Writing the 24-byte header and then the payload puts two segments on the wire per request (TCP_NODELAY is on) and costs two writes. It also lets a pipelined window interleave a partial header with the next frame's payload if anything ever writes concurrently. -
crc32
public static int crc32(byte msgType, short flags, byte[] payload) -
crc32OverFrame
public static int crc32OverFrame(byte[] header, byte[] payload) CRC over a received 24-byte header (with the crc32 field zeroed) plus the payload, matching the wire contract: the CRC covers the full header — includingdeadline_remaining_msandreservedas received — not an assumed-zero reconstruction. Use this to validate inbound frames so a server that populates those fields is not false-rejected. -
header
public static byte[] header(byte msgType, short flags, byte[] payload)
-