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.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 for specialized overriding  of  how  ObjectIDs
35       are generated based on the applications requirements. For example, dis‐
36       abling of PID caching can  be  configured  if  the  application  cannot
37       detect when a call to fork() has occurred.
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_DISABLE_PID_CACHE |
53                                     BSON_CONTEXT_THREAD_SAFE);
54             bson_oid_init (&oid, ctx);
55
56             bson_context_destroy (ctx);
57
58             return 0;
59          }
60

AUTHOR

62       MongoDB, Inc
63
65       2017-present, MongoDB, Inc
66
67
68
69
701.13.1                           Jan 24, 2019                BSON_CONTEXT_T(3)
Impressum