public class GetMore extends AbstractMessage
struct {
MsgHeader header; // standard message header
int32 ZERO; // 0 - reserved for future use
cstring fullCollectionName; // "dbname.collectionname"
int32 numberToReturn; // number of documents to return
int64 cursorID; // cursorID from the OP_REPLY
}
HEADER_SIZE, myCollectionName, myDatabaseName
Constructor and Description |
---|
GetMore(BsonInputStream in)
Creates a new GetMore.
|
GetMore(String databaseName,
String collectionName,
long cursorId,
int numberToReturn,
ReadPreference readPreference)
Creates a new GetMore.
|
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 to get more documents from.
|
int |
getNumberToReturn()
Return the number of documents to return from the cursor.
|
int |
hashCode()
Computes a reasonable hash code.
|
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 GetMore(BsonInputStream in) throws IOException
in
- The stream to read the get_more message from.IOException
- On a failure reading the get_more message.public GetMore(String databaseName, String collectionName, long cursorId, int numberToReturn, ReadPreference readPreference)
databaseName
- The name of the database.collectionName
- The name of the collection.cursorId
- The id of the cursor.numberToReturn
- The number of documents to return.readPreference
- The preferences for which server to send the request.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 getNumberToReturn()
public int hashCode()
hashCode
in class AbstractMessage
public void validateSize(SizeOfVisitor visitor, int maxDocumentSize) throws DocumentToLargeException
Overrridden to be a no-op since the size of a GetMore is fixed.
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 a get_more 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.