public class MetaRequestPacket extends RequestPacket
TESTPaxosClient
.RequestPacket.Keys, RequestPacket.ResponseCodes
PaxosPacket.NodeIDKeys, PaxosPacket.PaxosPacketType
digest, NO_OP, NULL_SOCKADDR, requestID, requestValue, SIZE_ESTIMATE, SIZEOF_REQUEST_FIXED, stop
CHARSET, packetType, paxosID, SIZEOF_PAXOSPACKET_FIXED, version
PACKET_TYPE, type
Constructor and Description |
---|
MetaRequestPacket(byte[] bytes) |
MetaRequestPacket(org.json.JSONObject json) |
MetaRequestPacket(long id,
java.lang.String val,
boolean stop) |
MetaRequestPacket(RequestPacket req) |
MetaRequestPacket(java.lang.String name,
java.lang.String val) |
Modifier and Type | Method and Description |
---|---|
static MetaRequestPacket |
getMetaRequestPacket(byte[] bytes) |
IntegerPacketType |
getRequestType() |
MetaRequestPacket |
getResponse() |
boolean |
needsCoordination() |
byte[] |
toBytes()
The implementation of this method is tied to and must be the inverse of
AppRequestParser.getRequest(byte[], edu.umass.cs.nio.nioutils.NIOHeader)
, i.e., invoking getRequest(request.toBytes(), header).equals(request). |
org.json.JSONObject |
toJSONObjectImpl() |
java.lang.String |
toString()
Learned the hard way that using org.json to stringify is an order of
magnitude slower with large request values compared to manually inserting
the string like below.
|
addDebugInfo, addDebugInfo, addDebugInfo, addDebugInfoDeep, addDebugInfoDeep, batchSize, digestEquals, doubleCheckFields, equals, getACK, getBatched, getByteifiedSelf, getClientAddress, getClientID, getDebugInfo, getDigest, getEntryReplica, getEntryReplicaRequestsAsBatch, getEntryTime, getFirstOnly, getForwardCount, getForwarderID, getListenAddress, getMessageDigest, getNACK, getRandomPValue, getRequestID, getRequestPackets, getRequestValue, getRequestValues, getSamplePValue, getServiceName, getStringifiedSelf, getSummary, getSummaryString, hasRequestValue, isBroadcasted, isMetaValue, isNoop, isPingPonging, isPingPonging, isStopRequest, latchToBatch, lengthEstimate, main, makeNewRequest, makeNoop, printBatched, setBroadcasted, setByteifiedSelf, setDigest, setEntryReplica, setEntryReplicaAndReturnCount, setEntryTime, setForwarderID, setResponse, setReturnRequestValue, setStringifiedSelf, shouldBroadcast, shouldDigest, shouldReturnRequestValue, toBytes, toBytesInstrument, toJSONSmartImpl
getPaxosID, getPaxosIDVersion, getPaxosPacket, getPaxosPacket, getPaxosPacketType, getPaxosPacketType, getSummary, getType, getType, getVersion, isParseable, isRecovery, isRecovery, isStatic, markRecovered, putPaxosID, toBytes, toJSONObject, toJSONSmart, toSingletonArray
couldBeJSON, couldBeJSON, couldBeJSON, couldBeJSONArray, couldBeJSONObject, getPacketType, putPacketType, putPacketType
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getSummary
public MetaRequestPacket(java.lang.String name, java.lang.String val)
name
- val
- public MetaRequestPacket(long id, java.lang.String val, boolean stop)
id
- val
- stop
- public MetaRequestPacket(byte[] bytes) throws java.io.UnsupportedEncodingException, java.net.UnknownHostException
bytes
- java.io.UnsupportedEncodingException
java.net.UnknownHostException
public MetaRequestPacket(org.json.JSONObject json) throws org.json.JSONException
json
- org.json.JSONException
public MetaRequestPacket(RequestPacket req)
req
- public static MetaRequestPacket getMetaRequestPacket(byte[] bytes) throws java.io.UnsupportedEncodingException, java.net.UnknownHostException, org.json.JSONException
bytes
- java.io.UnsupportedEncodingException
java.net.UnknownHostException
org.json.JSONException
public IntegerPacketType getRequestType()
getRequestType
in interface Request
getRequestType
in class RequestPacket
public byte[] toBytes()
Request
AppRequestParser.getRequest(byte[], edu.umass.cs.nio.nioutils.NIOHeader)
, i.e., invoking getRequest(request.toBytes(), header).equals(request).public org.json.JSONObject toJSONObjectImpl() throws org.json.JSONException
toJSONObjectImpl
in class RequestPacket
org.json.JSONException
public java.lang.String toString()
RequestPacket
toString
in interface Request
toString
in class RequestPacket
public boolean needsCoordination()
public MetaRequestPacket getResponse()
getResponse
in interface ClientRequest
getResponse
in class RequestPacket
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);
}