Skip to content

Commit c6dc48d

Browse files
authored
CDRIVER-5571 deprecate *_hint for *_server_id (#1601)
* deprecate `*_hint` functions for newly added `*_server_id` functions * call `*_server_id` functions from `*_hint` * update calls to use new `*_server_id` functions * update docs * update NEWS
1 parent cc3ed2c commit c6dc48d

22 files changed

+249
-63
lines changed

NEWS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
libmongoc 1.28.0 (unreleased)
2+
=============================
3+
4+
Deprecated:
5+
6+
* Use of `*_hint` functions is deprecated in favor of more aptly named `*_server_id` functions:
7+
* `mongoc_bulk_operation_set_hint` is deprecated for `mongoc_bulk_operation_set_server_id`
8+
* `mongoc_bulk_operation_get_hint` is deprecated for `mongoc_bulk_operation_get_server_id`
9+
* `mongoc_cursor_set_hint` is deprecated for `mongoc_cursor_set_server_id`
10+
* `mongoc_cursor_get_hint` is deprecated for `mongoc_cursor_get_server_id`
11+
112
libmongoc 1.27.1
213
================
314

src/libmongoc/doc/mongoc_bulk_operation_execute.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ The ``reply`` document counts operations and collects error information. See `Bu
4646

4747
| `Bulk Write Operations <bulk_>`_
4848
49-
| :symbol:`mongoc_bulk_operation_get_hint`, which gets the id of the server used even if the operation failed.
49+
| :symbol:`mongoc_bulk_operation_get_server_id`, which gets the id of the server used even if the operation failed.
5050

src/libmongoc/doc/mongoc_bulk_operation_get_hint.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@
33
mongoc_bulk_operation_get_hint()
44
================================
55

6+
.. warning::
7+
.. deprecated:: 1.28.0
8+
9+
This function is deprecated and should not be used in new code.
10+
11+
Please use :symbol:`mongoc_bulk_operation_get_server_id()` in new code.
12+
613
Synopsis
714
--------
815

916
.. code-block:: c
1017
1118
uint32_t
12-
mongoc_bulk_operation_get_hint (const mongoc_bulk_operation_t *bulk);
19+
mongoc_bulk_operation_get_hint (const mongoc_bulk_operation_t *bulk)
20+
BSON_GNUC_DEPRECATED_FOR (mongoc_bulk_operation_get_server_id);
1321
1422
Parameters
1523
----------
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
:man_page: mongoc_bulk_operation_get_server_id
2+
3+
mongoc_bulk_operation_get_server_id()
4+
=====================================
5+
6+
Synopsis
7+
--------
8+
9+
.. code-block:: c
10+
11+
uint32_t
12+
mongoc_bulk_operation_get_server_id (const mongoc_bulk_operation_t *bulk);
13+
14+
Parameters
15+
----------
16+
17+
* ``bulk``: A :symbol:`mongoc_bulk_operation_t`.
18+
19+
Description
20+
-----------
21+
22+
Retrieves the opaque id of the server used for the operation.
23+
24+
This number is zero until the driver actually uses a server in :symbol:`mongoc_bulk_operation_execute`. The server id is the same number as the return value of a successful :symbol:`mongoc_bulk_operation_execute`, so ``mongoc_bulk_operation_get_server_id`` is useful mainly in case :symbol:`mongoc_bulk_operation_execute` fails and returns zero.
25+

src/libmongoc/doc/mongoc_bulk_operation_set_hint.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,21 @@
33
mongoc_bulk_operation_set_hint()
44
================================
55

6+
.. warning::
7+
.. deprecated:: 1.28.0
8+
9+
This function is deprecated and should not be used in new code.
10+
11+
Please use :symbol:`mongoc_bulk_operation_set_server_id()` in new code.
12+
613
Synopsis
714
--------
815

916
.. code-block:: c
1017
1118
void
12-
mongoc_bulk_operation_set_hint (const mongoc_bulk_operation_t *bulk,
13-
uint32_t server_id);
19+
mongoc_bulk_operation_set_hint (mongoc_bulk_operation_t *bulk, uint32_t server_id)
20+
BSON_GNUC_DEPRECATED_FOR (mongoc_bulk_operation_set_server_id);
1421
1522
Parameters
1623
----------
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
:man_page: mongoc_bulk_operation_set_server_id
2+
3+
mongoc_bulk_operation_set_server_id()
4+
=====================================
5+
6+
Synopsis
7+
--------
8+
9+
.. code-block:: c
10+
11+
void
12+
mongoc_bulk_operation_set_server_id (mongoc_bulk_operation_t *bulk, uint32_t server_id);
13+
14+
Parameters
15+
----------
16+
17+
* ``bulk``: A :symbol:`mongoc_bulk_operation_t`.
18+
* ``server_id``: An opaque id identifying the server to use.
19+
20+
Description
21+
-----------
22+
23+
Specifies which server to use for the operation. This function has an effect only if called before :symbol:`mongoc_bulk_operation_execute`.
24+
25+
Use ``mongoc_bulk_operation_set_server_id`` only for building a language driver that wraps the C Driver. When writing applications in C, leave the server id unset and allow the driver to choose a suitable server for the bulk operation.
26+

src/libmongoc/doc/mongoc_bulk_operation_t.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ After adding all of the write operations to the :symbol:`mongoc_bulk_operation_t
4747
mongoc_bulk_operation_destroy
4848
mongoc_bulk_operation_execute
4949
mongoc_bulk_operation_get_hint
50+
mongoc_bulk_operation_get_server_id
5051
mongoc_bulk_operation_get_write_concern
5152
mongoc_bulk_operation_insert
5253
mongoc_bulk_operation_insert_with_opts
@@ -60,6 +61,7 @@ After adding all of the write operations to the :symbol:`mongoc_bulk_operation_t
6061
mongoc_bulk_operation_set_client_session
6162
mongoc_bulk_operation_set_comment
6263
mongoc_bulk_operation_set_hint
64+
mongoc_bulk_operation_set_server_id
6365
mongoc_bulk_operation_set_let
6466
mongoc_bulk_operation_update
6567
mongoc_bulk_operation_update_many_with_opts

src/libmongoc/doc/mongoc_cursor_get_hint.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@
33
mongoc_cursor_get_hint()
44
========================
55

6+
.. warning::
7+
.. deprecated:: 1.28.0
8+
9+
This function is deprecated and should not be used in new code.
10+
11+
Please use :symbol:`mongoc_cursor_get_server_id()` in new code.
12+
613
Synopsis
714
--------
815

916
.. code-block:: c
1017
1118
uint32_t
12-
mongoc_cursor_get_hint (const mongoc_cursor_t *cursor);
19+
mongoc_cursor_get_hint (const mongoc_cursor_t *cursor) BSON_GNUC_DEPRECATED_FOR (mongoc_cursor_get_server_id);
1320
1421
Parameters
1522
----------
@@ -23,5 +30,5 @@ Retrieves the opaque id of the server used for the operation.
2330

2431
(The function name includes the old term "hint" for the sake of backward compatibility, but we now call this number a "server id".)
2532

26-
This number is zero until the driver actually uses a server when executing the find operation or :symbol:`mongoc_cursor_set_hint` is called.
33+
This number is zero until the driver actually uses a server when executing the find operation or :symbol:`mongoc_cursor_set_server_id` is called.
2734

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
:man_page: mongoc_cursor_get_server_id
2+
3+
mongoc_cursor_get_server_id()
4+
=============================
5+
6+
Synopsis
7+
--------
8+
9+
.. code-block:: c
10+
11+
uint32_t
12+
mongoc_cursor_get_server_id (const mongoc_cursor_t *cursor);
13+
14+
Parameters
15+
----------
16+
17+
* ``cursor``: A :symbol:`mongoc_cursor_t`.
18+
19+
Description
20+
-----------
21+
22+
Retrieves the opaque id of the server used for the operation.
23+
24+
This number is zero until the driver actually uses a server when executing the find operation or :symbol:`mongoc_cursor_set_server_id` is called.
25+

src/libmongoc/doc/mongoc_cursor_set_hint.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@
33
mongoc_cursor_set_hint()
44
========================
55

6+
.. warning::
7+
.. deprecated:: 1.28.0
8+
9+
This function is deprecated and should not be used in new code.
10+
11+
Please use :symbol:`mongoc_cursor_set_server_id()` in new code.
12+
613
Synopsis
714
--------
815

916
.. code-block:: c
1017
1118
bool
12-
mongoc_cursor_set_hint (mongoc_cursor_t *cursor, uint32_t server_id);
19+
mongoc_cursor_set_hint (mongoc_cursor_t *cursor, uint32_t server_id)
20+
BSON_GNUC_DEPRECATED_FOR (mongoc_cursor_set_server_id);
1321
1422
Parameters
1523
----------

0 commit comments

Comments
 (0)