MONGOC_CLIENT_...REAM_INITIATOR(3)

okay bestie, welcome to the libmongoc manual page MONGOC_CLIENT_...REAM_INITIATOR(3) β€” yes the title is giving truncated-chaos, but the actual main character is mongoc_client_set_stream_initiator() πŸ’…βœ¨

✨ SYNOPSIS ✨

          void
          mongoc_client_set_stream_initiator (mongoc_client_t *client,
                                              mongoc_stream_initiator_t initiator,
                                              void *user_data);

Okay so mongoc_client_set_stream_initiator() shall associate a given mongoc_client_t with a new stream initiator. This will completely replace the default transport (buffered TCP, possibly with TLS). No cap, it's a full transport glow-up. The initiator should fulfill the mongoc_stream_t contract. user_data is passed through to the initiator callback and may be used for whatever run time customization is necessary. πŸ¦‹

⚠️ It is a programming error to call this function on a mongoc_client_t from a mongoc_client_pool_t. Like, do not do it. Said with love. πŸ’€

Changed in version 2.0.0: This function logs an error and immediately returns if client is from a mongoc_client_pool_t. Previously this function unsafely applied the initiator to the pooled client. So yeah, the old behavior was lowkey unsafe and we do not stan. πŸ™ˆ

If user_data is passed, it is the application's responsibility to ensure user_data remains valid for the lifetime of the client. Keep that pointer alive, bestie β€” it is not a vibe to have it ghosting you mid-callback. 🫢


🫢 PARAMETERS 🫢

  • client: A mongoc_client_t.
  • initiator: A mongoc_stream_initiator_t.
  • user_data: User supplied pointer for callback function.

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc

2009-present, MongoDB, Inc.


signed off from libmongoc version 2.5.6, dated Oct 09, 202 β€” the year is giving cliffhanger, but the vibes are immaculate. πŸ’–βœ¨

πŸ“¦ where this page comes from