public abstract class TXPacket extends JSONPacket implements ReplicableRequest, ClientRequest
Modifier and Type | Class and Description |
---|---|
static class |
TXPacket.PacketType
Transaction packet types.
|
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
txid |
PACKET_TYPE, type
Constructor and Description |
---|
TXPacket(IntegerPacketType t,
java.lang.String txid) |
TXPacket(org.json.JSONObject json) |
Modifier and Type | Method and Description |
---|---|
long |
getRequestID()
The uniqueness of this identifier across all requests to a replica group
is important for safety when
PaxosConfig.PC.PREVENT_DOUBLE_EXECUTION is
enabled as gigapaxos may otherwise assume that the duplicate request
identifier corresponds to a retransmission and will send back the
response if any corresponding to the first execution. |
IntegerPacketType |
getRequestType() |
ClientRequest |
getResponse() |
ResponseCode |
getResponseCode() |
java.lang.String |
getServiceName() |
java.lang.String |
getTXID() |
TXPacket.PacketType |
getTXPacketType() |
boolean |
isFailed() |
boolean |
needsCoordination() |
protected TXPacket |
setFailed() |
void |
setResponseCode(ResponseCode code) |
protected org.json.JSONObject |
toJSONObjectImpl() |
couldBeJSON, couldBeJSON, couldBeJSON, couldBeJSONArray, couldBeJSONObject, getPacketType, putPacketType, putPacketType, toJSONObject, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
setNeedsCoordination
getClientAddress
getSummary, toBytes, toString
getSummary
public TXPacket(IntegerPacketType t, java.lang.String txid)
t
- txid
- public TXPacket(org.json.JSONObject json) throws org.json.JSONException
json
- org.json.JSONException
public IntegerPacketType getRequestType()
getRequestType
in interface Request
public TXPacket.PacketType getTXPacketType()
TXPacket.PacketType
public java.lang.String getServiceName()
getServiceName
in interface Request
public long getRequestID()
RequestIdentifier
PaxosConfig.PC.PREVENT_DOUBLE_EXECUTION
is
enabled as gigapaxos may otherwise assume that the duplicate request
identifier corresponds to a retransmission and will send back the
response if any corresponding to the first execution. With
PaxosConfig.PC.PREVENT_DOUBLE_EXECUTION
disabled, the uniqueness is important for liveness as duplicate request
identifiers may result in the client not receiving a response for the
latter request; this is because gigapaxos stores request execution
callbacks indexed by the request identifier, so there must be at most one
outstanding request with a given identifier for a given replica group.getRequestID
in interface RequestIdentifier
public ClientRequest getResponse()
getResponse
in interface ClientRequest
AbstractReplicaCoordinator
, e.g.,
PaxosManager
, will invoke this method immediately after
Application.execute(Request)
and, if the returned response
is non-null, will send it back to the client that issued that
request. Applications are expected to internally implement logic
that sets the response at the end of
Application.execute(Request)
as follows:
public boolean Replicable
.execute(Request request)} {
// execute request to obtain response
request.setResponse(response);
}
public boolean needsCoordination()
needsCoordination
in interface ReplicableRequest
protected org.json.JSONObject toJSONObjectImpl() throws org.json.JSONException
toJSONObjectImpl
in class JSONPacket
org.json.JSONException
public boolean isFailed()
protected TXPacket setFailed()
public ResponseCode getResponseCode()
public void setResponseCode(ResponseCode code)
code
- public java.lang.String getTXID()