Class OpMsg
- java.lang.Object
-
- de.caluga.morphium.driver.wireprotocol.WireProtocolMessage
-
- de.caluga.morphium.driver.wireprotocol.OpMsg
-
public class OpMsg extends WireProtocolMessage
see https://github.com/mongodb/specifications/blob/master/source/message/OP_MSG.rstOP_MSG { MsgHeader header; // standard message header uint32 flagBits; // message flags Sections[] sections; // data sections optional
checksum; // optional CRC-32C checksum } struct MsgHeader { int32 messageLength; // total message size, including this int32 requestID; // identifier for this message int32 responseTo; // requestID from the original request // (used in responses from db) int32 opCode; // request type - see table below for details }
section type 0 (BASIC): byte 0; BSON-Document
section type 1 (optimized): byte 1; int32 size CString sequence id; //reference to insert, id is "documents"/ to update id "updates", to delete id is "deletes" BSON-Documents
BSON-Document e.g: {insert: "test_coll", $db: "db", documents: [{_id: 1}]}
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.caluga.morphium.driver.wireprotocol.WireProtocolMessage
WireProtocolMessage.OpCode
-
-
Field Summary
Fields Modifier and Type Field Description static intCHECKSUM_PRESENTstatic intEXHAUST_ALLOWEDstatic intMORE_TO_COMEstatic intOP_CODE
-
Constructor Summary
Constructors Constructor Description OpMsg()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDoc(String seqId, Map<String,Object> o)Map<String,Object>getFirstDoc()intgetFlags()intgetOpCode()byte[]getPayload()booleanhasCursor()voidparsePayload(byte[] bytes, int offset)OpMsgsetFirstDoc(Map<String,Object> o)OpMsgsetFlags(int flags)-
Methods inherited from class de.caluga.morphium.driver.wireprotocol.WireProtocolMessage
bytes, getMessageId, getResponseTo, getSize, parseFromStream, readInt, readLong, readString, setMessageId, setResponseTo, setSize, strLen, writeInt, writeLong, writeString
-
-
-
-
Field Detail
-
OP_CODE
public static final int OP_CODE
- See Also:
- Constant Field Values
-
CHECKSUM_PRESENT
public static final int CHECKSUM_PRESENT
- See Also:
- Constant Field Values
-
MORE_TO_COME
public static final int MORE_TO_COME
- See Also:
- Constant Field Values
-
EXHAUST_ALLOWED
public static final int EXHAUST_ALLOWED
- See Also:
- Constant Field Values
-
-
Method Detail
-
getFlags
public int getFlags()
-
setFlags
public OpMsg setFlags(int flags)
-
parsePayload
public void parsePayload(byte[] bytes, int offset) throws IOException- Specified by:
parsePayloadin classWireProtocolMessage- Throws:
IOException
-
getPayload
public byte[] getPayload() throws IOException- Specified by:
getPayloadin classWireProtocolMessage- Throws:
IOException
-
getOpCode
public int getOpCode()
- Specified by:
getOpCodein classWireProtocolMessage
-
hasCursor
public boolean hasCursor()
-
-