Skip to content

Commit b7f7805

Browse files
committed
CDRIVER-990 rename wire version constants
1 parent ea68fc7 commit b7f7805

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

src/mongoc/mongoc-client-private.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@
4242
BSON_BEGIN_DECLS
4343

4444
/* protocol versions this driver can speak */
45-
#define MIN_WIRE_VERSION 0
46-
#define MAX_WIRE_VERSION 4
45+
#define WIRE_VERSION_MIN 0
46+
#define WIRE_VERSION_MAX 4
4747

4848
/* first version that supported aggregation cursors */
49-
#define AGGREGATION_CURSOR_WIRE_VERSION 1
49+
#define WIRE_VERSION_AGG_CURSOR 1
5050
/* first version that supported "insert", "update", "delete" commands */
51-
#define WRITE_COMMAND_WIRE_VERSION 2
51+
#define WIRE_VERSION_WRITE_CMD 2
5252
/* first version when SCRAM-SHA-1 replaced MONGODB-CR as default auth mech */
53-
#define SCRAM_DEFAULT_AUTH_WIRE_VERSION 3
53+
#define WIRE_VERSION_SCRAM_DEFAULT 3
5454
/* first version that supported "find" and "getMore" commands */
55-
#define FIND_COMMAND_WIRE_VERSION 4
55+
#define WIRE_VERSION_FIND_CMD 4
5656
/* first version with "killCursors" command */
57-
#define KILLCURSORS_COMMAND_WIRE_VERSION 4
57+
#define WIRE_VERSION_KILLCURSORS_CMD 4
5858
/* first version when findAndModify accepts writeConcern */
59-
#define FAM_WRITE_CONCERN_WIRE_VERSION 4
59+
#define WIRE_VERSION_FAM_WRITE_CONCERN 4
6060

6161

6262
struct _mongoc_client_t

src/mongoc/mongoc-client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ _mongoc_client_kill_cursor (mongoc_client_t *client,
12101210

12111211
if (db && collection &&
12121212
server_stream->sd->max_wire_version >=
1213-
KILLCURSORS_COMMAND_WIRE_VERSION) {
1213+
WIRE_VERSION_KILLCURSORS_CMD) {
12141214
_mongoc_client_killcursors_command (&client->cluster, server_stream,
12151215
cursor_id, db, collection);
12161216
} else {

src/mongoc/mongoc-cluster.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ _mongoc_cluster_auth_node (mongoc_cluster_t *cluster,
10911091

10921092
/* Use cached max_wire_version, not value from sd */
10931093
if (!mechanism) {
1094-
if (max_wire_version < SCRAM_DEFAULT_AUTH_WIRE_VERSION) {
1094+
if (max_wire_version < WIRE_VERSION_SCRAM_DEFAULT) {
10951095
mechanism = "MONGODB-CR";
10961096
} else {
10971097
mechanism = "SCRAM-SHA-1";

src/mongoc/mongoc-collection.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ mongoc_collection_aggregate (mongoc_collection_t *collection, /* IN */
320320

321321
cursor->hint = selected_server->id;
322322
use_cursor =
323-
selected_server->max_wire_version >= AGGREGATION_CURSOR_WIRE_VERSION;
323+
selected_server->max_wire_version >= WIRE_VERSION_AGG_CURSOR;
324324

325325
BSON_APPEND_UTF8 (&command, "aggregate", collection->collection);
326326

@@ -1996,7 +1996,7 @@ mongoc_collection_find_and_modify_with_opts (mongoc_collection_t
19961996

19971997
wc = opts->write_concern ? opts->write_concern : collection->write_concern;
19981998

1999-
if (server_stream->sd->max_wire_version >= FAM_WRITE_CONCERN_WIRE_VERSION) {
1999+
if (server_stream->sd->max_wire_version >= WIRE_VERSION_FAM_WRITE_CONCERN) {
20002000
if (!_mongoc_write_concern_is_valid (wc)) {
20012001
bson_set_error (error,
20022002
MONGOC_ERROR_COMMAND,

src/mongoc/mongoc-cursor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ _use_find_command (const mongoc_cursor_t *cursor,
321321
* used to execute other commands" and "the find command does not support the
322322
* exhaust flag."
323323
*/
324-
return server_stream->sd->max_wire_version >= FIND_COMMAND_WIRE_VERSION &&
324+
return server_stream->sd->max_wire_version >= WIRE_VERSION_FIND_CMD &&
325325
!cursor->is_command &&
326326
!(cursor->flags & MONGOC_QUERY_EXHAUST);
327327
}

src/mongoc/mongoc-write-command.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ _mongoc_write_command_execute (mongoc_write_command_t *command, /* I
956956
BSON_ASSERT (command->hint == server_stream->sd->id);
957957
}
958958

959-
if (server_stream->sd->max_wire_version >= WRITE_COMMAND_WIRE_VERSION) {
959+
if (server_stream->sd->max_wire_version >= WIRE_VERSION_WRITE_CMD) {
960960
_mongoc_write_command (command, client, server_stream, database,
961961
collection, write_concern, offset,
962962
result, &result->error);

0 commit comments

Comments
 (0)