1BSON_CONTEXT_T(3)                   libbson                  BSON_CONTEXT_T(3)
2
3
4

NAME

6       bson_context_t - bson_context_t
7
8       BSON OID Generation Context
9

SYNOPSIS

11          #include <bson/bson.h>
12
13          typedef enum {
14            BSON_CONTEXT_NONE = 0,
15            BSON_CONTEXT_THREAD_SAFE = (1 << 0),
16            BSON_CONTEXT_DISABLE_HOST_CACHE = (1 << 1),
17            BSON_CONTEXT_DISABLE_PID_CACHE = (1 << 2),
18          #ifdef BSON_HAVE_SYSCALL_TID
19            BSON_CONTEXT_USE_TASK_ID = (1 << 3),
20          #endif
21          } bson_context_flags_t;
22
23          typedef struct _bson_context_t bson_context_t;
24
25          bson_context_t *
26          bson_context_get_default (void) BSON_GNUC_CONST;
27          bson_context_t *
28          bson_context_new (bson_context_flags_t flags);
29          void
30          bson_context_destroy (bson_context_t *context);
31

DESCRIPTION

33       The  bson_context_t  structure is context for generation of BSON Object
34       IDs. This context allows overriding behavior of  generating  ObjectIDs.
35       The  flags  BSON_CONTEXT_NONE,  BSON_CONTEXT_THREAD_SAFE, and BSON_CON‐
36       TEXT_DISABLE_HOST_CACHE are the only ones  used.  The  others  have  no
37       effect.
38

EXAMPLE

40          #include <bson/bson.h>
41
42          int
43          main (int argc, char *argv[])
44          {
45             bson_context_t *ctx = NULL;
46             bson_oid_t oid;
47
48             /* use default context, via bson_context_get_default() */
49             bson_oid_init (&oid, NULL);
50
51             /* specify a local context for additional control */
52             ctx = bson_context_new (BSON_CONTEXT_THREAD_SAFE);
53             bson_oid_init (&oid, ctx);
54
55             bson_context_destroy (ctx);
56
57             return 0;
58          }
59

AUTHOR

61       MongoDB, Inc
62
64       2017-present, MongoDB, Inc
65
66
67
68
691.16.2                           Feb 25, 2020                BSON_CONTEXT_T(3)
Impressum