Skip to content

Commit 0807e04

Browse files
bjorihanumantmk
authored andcommitted
CDRIVER-464: Add function to retrieve and set batch_size
The batch size needs to be tweakable between getmores Added: uint32_t mongoc_cursor_get_batch_size (const mongoc_cursor_t *cursor) void mongoc_cursor_set_batch_size (mongoc_cursor_t *cursor, uint32_t batch_size) Closes #120
1 parent 96d48e9 commit 0807e04

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/mongoc/mongoc-cursor.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,22 @@ mongoc_cursor_current (const mongoc_cursor_t *cursor) /* IN */
10561056
}
10571057

10581058

1059+
void
1060+
mongoc_cursor_set_batch_size (mongoc_cursor_t *cursor,
1061+
uint32_t batch_size)
1062+
{
1063+
bson_return_if_fail (cursor);
1064+
cursor->batch_size = batch_size;
1065+
}
1066+
1067+
uint32_t
1068+
mongoc_cursor_get_batch_size (const mongoc_cursor_t *cursor)
1069+
{
1070+
bson_return_val_if_fail (cursor, 0);
1071+
1072+
return cursor->batch_size;
1073+
}
1074+
10591075
uint32_t
10601076
mongoc_cursor_get_hint (const mongoc_cursor_t *cursor)
10611077
{

src/mongoc/mongoc-cursor.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ void mongoc_cursor_get_host (mongoc_cursor_t *cursor,
4343
mongoc_host_list_t *host);
4444
bool mongoc_cursor_is_alive (const mongoc_cursor_t *cursor);
4545
const bson_t *mongoc_cursor_current (const mongoc_cursor_t *cursor);
46+
void mongoc_cursor_set_batch_size (mongoc_cursor_t *cursor,
47+
uint32_t batch_size);
48+
uint32_t mongoc_cursor_get_batch_size (const mongoc_cursor_t *cursor);
4649
uint32_t mongoc_cursor_get_hint (const mongoc_cursor_t *cursor);
4750

4851

0 commit comments

Comments
 (0)