File: mongoc_client_select_server.page

package info (click to toggle)
libmongoc 1.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,824 kB
  • ctags: 4,501
  • sloc: ansic: 57,956; makefile: 717; python: 502; sh: 54
file content (43 lines) | stat: -rw-r--r-- 2,269 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?xml version="1.0"?>

<page xmlns="http://projectmallard.org/1.0/"
      type="topic"
      style="function"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/experimental/ui/"
      id="mongoc_client_select_server">


  <info>
    <link type="guide" xref="mongoc_client_t" group="function"/>
  </info>
  <title>mongoc_client_select_server()</title>

  <section id="synopsis">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[mongoc_server_description_t *
mongoc_client_select_server (mongoc_client_t           *client,
                             bool                       for_writes,
                             const mongoc_read_prefs_t *prefs,
                             bson_error_t              *error);
]]></code></synopsis>
    <p>Choose a server for an operation, according to the logic described in the Server Selection Spec.</p>
    <p>Use this function only for building a language driver that wraps the C Driver. When writing applications in C, higher-level functions automatically select a suitable server.</p>
  </section>

  <section id="parameters">
    <title>Parameters</title>
    <table>
      <tr><td><p>client</p></td><td><p>A <code xref="mongoc_client_t">mongoc_client_t</code>.</p></td></tr>
      <tr><td><p>for_writes</p></td><td><p>Whether to choose a server suitable for writes or reads.</p></td></tr>
      <tr><td><p>prefs</p></td><td><p>An optional <code xref="mongoc_read_prefs_t">mongoc_read_prefs_t</code>. If <code>for_writes</code> is true, <code>prefs</code> must be NULL. Otherwise, use <code>prefs</code> to customize server selection, or pass NULL to use the read preference configured on the client.</p></td></tr>
      <tr><td><p>error</p></td><td><p>An optional location for a <code xref="errors">bson_error_t</code> or <code>NULL</code>.</p></td></tr>
    </table>
  </section>

  <section id="return">
    <title>Returns</title>
    <p>A <code xref="mongoc_server_description_t">mongoc_server_description_t</code> that must be freed with <code xref="mongoc_server_description_destroy">mongoc_server_description_destroy</code>. If no suitable server is found, returns NULL and <code>error</code> is filled out.</p>
  </section>

</page>