public class Reply extends AbstractMessage
struct {
MsgHeader header; // standard message header
int32 responseFlags; // bit vector - see details below
int64 cursorID; // cursor id if client needs to do get more's
int32 startingFrom; // where in the cursor this reply is starting
int32 numberReturned; // number of documents in the reply
document* documents; // documents
}
Modifier and Type | Field and Description |
---|---|
static int |
AWAIT_CAPABLE_BIT
Bit for the await capable flag.
|
static int |
CURSOR_NOT_FOUND_BIT
Bit for the cursor not found flag.
|
static int |
QUERY_FAILURE_BIT
Bit for the query failure flag.
|
static int |
SHARD_CONFIG_STALE_BIT
Bit for the shard configuration stale flag.
|
HEADER_SIZE, myCollectionName, myDatabaseName
Constructor and Description |
---|
Reply(Header header,
BsonInputStream in)
Creates a new Reply.
|
Reply(int responseToId,
long cursorId,
int cursorOffset,
List<Document> results,
boolean awaitCapable,
boolean cursorNotFound,
boolean queryFailed,
boolean shardConfigStale)
Creates a new Reply.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object object)
Determines if the passed object is of this same type as this object and
if so that its fields are equal.
|
long |
getCursorId()
Returns the id of the cursor if the user needs to do a get_more to get
the complete results.
|
int |
getCursorOffset()
Returns the offset (index) of the first document returned from the
cursor.
|
int |
getResponseToId()
Returns the id of the request this response is for.
|
List<Document> |
getResults()
Returns the query results.
|
int |
hashCode()
Computes a reasonable hash code.
|
boolean |
isAwaitCapable()
Returns true if the server is await capable for tailable cursors.
|
boolean |
isCursorNotFound()
Returns true if the cursor in the get_more message was not
found.
|
boolean |
isQueryFailed()
Returns true if the query failed.
|
boolean |
isShardConfigStale()
Returns true if the shard configuration is stale.
|
void |
validateSize(SizeOfVisitor visitor,
int maxDocumentSize)
Validates that the documents with the message do not exceed the maximum
document size specified.
|
void |
write(int messageId,
BsonOutputStream out)
Writes the message from the stream.
|
getCollectionName, getDatabaseName, getReadPreference, init, writeHeader
public static final int AWAIT_CAPABLE_BIT
public static final int CURSOR_NOT_FOUND_BIT
public static final int QUERY_FAILURE_BIT
public static final int SHARD_CONFIG_STALE_BIT
public Reply(Header header, BsonInputStream in) throws IOException
header
- The header from the reply message.in
- Stream to read the reply message from.IOException
- On a failure to read the reply.public Reply(int responseToId, long cursorId, int cursorOffset, List<Document> results, boolean awaitCapable, boolean cursorNotFound, boolean queryFailed, boolean shardConfigStale)
responseToId
- The id of the request this response is for.cursorId
- The id of the cursor if the user needs to do a get_more to get
the complete results.cursorOffset
- The offset (index) of the first document returned from the
cursor.results
- The returned documents.awaitCapable
- If true, indicates the server is await capable for tailable
cursors.cursorNotFound
- If true, indicates that the cursor in the get_more
message was not found.queryFailed
- If true, indicates that the query failed.shardConfigStale
- If true, indicates (to a MongoS?) that its shard configuration
is stale.public boolean equals(Object object)
equals
in class AbstractMessage
object
- The object to compare to.Object.equals(java.lang.Object)
public long getCursorId()
public int getCursorOffset()
public int getResponseToId()
public int hashCode()
hashCode
in class AbstractMessage
public boolean isAwaitCapable()
public boolean isCursorNotFound()
public boolean isQueryFailed()
public boolean isShardConfigStale()
public void validateSize(SizeOfVisitor visitor, int maxDocumentSize) throws DocumentToLargeException
Overrridden to be a no-op since we normally only receive a reply and don't care about the size.
visitor
- The SizeOfVisitor
to compute the size of the document.maxDocumentSize
- The maximum document size to validate against.DocumentToLargeException
- If one of the documents in the message is too large or the
documents in aggregate are too large.public void write(int messageId, BsonOutputStream out) throws IOException
Overridden to write the reply message.
messageId
- The id to be assigned to the message.out
- The sink for data written.IOException
- On an error writing to the stream.Message.write(int, BsonOutputStream)
Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.