text:
/**************************************************
 *
 * Generated by build/generate-future-functions.py.
 *
 * DO NOT EDIT THIS FILE.
 *
 *************************************************/
/* clang-format off */

/*
 * Define two sets of functions: background functions and future functions.

 * A background function like background_mongoc_cursor_next runs a driver
 * operation on a thread.

 * A future function like future_mongoc_cursor_next launches the background
 * operation and returns a future_t that will resolve when the operation
 * finishes.
 *
 * These are used with mock_server_t so you can run the driver on a thread while
 * controlling the server from the main thread.
 */

#include "mongoc/mongoc-topology-private.h"

#include "future-functions.h"

static void *
background_mongoc_async_run (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_void_type;

   mongoc_async_run (
      future_value_get_mongoc_async_ptr (future_get_param (future, 0)));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_bulk_operation_execute (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_uint32_t_type;

   future_value_set_uint32_t (
      &return_value,
      mongoc_bulk_operation_execute (
         future_value_get_mongoc_bulk_operation_ptr (future_get_param (future, 0)),
         future_value_get_bson_ptr (future_get_param (future, 1)),
         future_value_get_bson_error_ptr (future_get_param (future, 2))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_database_read_command_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_database_read_command_with_opts (
         future_value_get_mongoc_database_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 2)),
         future_value_get_const_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_ptr (future_get_param (future, 4)),
         future_value_get_bson_error_ptr (future_get_param (future, 5))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_database_read_write_command_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_database_read_write_command_with_opts (
         future_value_get_mongoc_database_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 2)),
         future_value_get_const_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_ptr (future_get_param (future, 4)),
         future_value_get_bson_error_ptr (future_get_param (future, 5))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_database_write_command_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_database_write_command_with_opts (
         future_value_get_mongoc_database_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_error_ptr (future_get_param (future, 4))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_client_command_simple (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_client_command_simple (
         future_value_get_mongoc_client_ptr (future_get_param (future, 0)),
         future_value_get_const_char_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 3)),
         future_value_get_bson_ptr (future_get_param (future, 4)),
         future_value_get_bson_error_ptr (future_get_param (future, 5))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_client_command_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_client_command_with_opts (
         future_value_get_mongoc_client_ptr (future_get_param (future, 0)),
         future_value_get_const_char_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 3)),
         future_value_get_const_bson_ptr (future_get_param (future, 4)),
         future_value_get_bson_ptr (future_get_param (future, 5)),
         future_value_get_bson_error_ptr (future_get_param (future, 6))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_client_read_command_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_client_read_command_with_opts (
         future_value_get_mongoc_client_ptr (future_get_param (future, 0)),
         future_value_get_const_char_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 3)),
         future_value_get_const_bson_ptr (future_get_param (future, 4)),
         future_value_get_bson_ptr (future_get_param (future, 5)),
         future_value_get_bson_error_ptr (future_get_param (future, 6))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_client_write_command_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_client_write_command_with_opts (
         future_value_get_mongoc_client_ptr (future_get_param (future, 0)),
         future_value_get_const_char_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_const_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_ptr (future_get_param (future, 4)),
         future_value_get_bson_error_ptr (future_get_param (future, 5))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_client_read_write_command_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_client_read_write_command_with_opts (
         future_value_get_mongoc_client_ptr (future_get_param (future, 0)),
         future_value_get_const_char_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 3)),
         future_value_get_const_bson_ptr (future_get_param (future, 4)),
         future_value_get_bson_ptr (future_get_param (future, 5)),
         future_value_get_bson_error_ptr (future_get_param (future, 6))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_client_kill_cursor (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_void_type;

   mongoc_client_kill_cursor (
      future_value_get_mongoc_client_ptr (future_get_param (future, 0)),
      future_value_get_int64_t (future_get_param (future, 1)));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_client_watch (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_mongoc_change_stream_ptr_type;

   future_value_set_mongoc_change_stream_ptr (
      &return_value,
      mongoc_client_watch (
         future_value_get_mongoc_client_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_aggregate (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_mongoc_cursor_ptr_type;

   future_value_set_mongoc_cursor_ptr (
      &return_value,
      mongoc_collection_aggregate (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_mongoc_query_flags_t (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_const_bson_ptr (future_get_param (future, 3)),
         future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 4))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_count (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_int64_t_type;

   future_value_set_int64_t (
      &return_value,
      mongoc_collection_count (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_mongoc_query_flags_t (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_int64_t (future_get_param (future, 3)),
         future_value_get_int64_t (future_get_param (future, 4)),
         future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 5)),
         future_value_get_bson_error_ptr (future_get_param (future, 6))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_count_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_int64_t_type;

   future_value_set_int64_t (
      &return_value,
      mongoc_collection_count_with_opts (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_mongoc_query_flags_t (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_int64_t (future_get_param (future, 3)),
         future_value_get_int64_t (future_get_param (future, 4)),
         future_value_get_const_bson_ptr (future_get_param (future, 5)),
         future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 6)),
         future_value_get_bson_error_ptr (future_get_param (future, 7))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_create_index_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_create_index_with_opts (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_mongoc_index_opt_t (future_get_param (future, 2)),
         future_value_get_const_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_ptr (future_get_param (future, 4)),
         future_value_get_bson_error_ptr (future_get_param (future, 5))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_drop_index_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_drop_index_with_opts (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_char_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_bson_error_ptr (future_get_param (future, 3))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_drop_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_drop_with_opts (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_bson_error_ptr (future_get_param (future, 2))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_find_and_modify_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_find_and_modify_with_opts (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_mongoc_find_and_modify_opts_ptr (future_get_param (future, 2)),
         future_value_get_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_error_ptr (future_get_param (future, 4))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_find_and_modify (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_find_and_modify (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_const_bson_ptr (future_get_param (future, 3)),
         future_value_get_const_bson_ptr (future_get_param (future, 4)),
         future_value_get_bool (future_get_param (future, 5)),
         future_value_get_bool (future_get_param (future, 6)),
         future_value_get_bool (future_get_param (future, 7)),
         future_value_get_bson_ptr (future_get_param (future, 8)),
         future_value_get_bson_error_ptr (future_get_param (future, 9))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_find_indexes_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_mongoc_cursor_ptr_type;

   future_value_set_mongoc_cursor_ptr (
      &return_value,
      mongoc_collection_find_indexes_with_opts (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_stats (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_stats (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_bson_ptr (future_get_param (future, 2)),
         future_value_get_bson_error_ptr (future_get_param (future, 3))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_insert_many (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_insert_many (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr_ptr (future_get_param (future, 1)),
         future_value_get_size_t (future_get_param (future, 2)),
         future_value_get_const_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_ptr (future_get_param (future, 4)),
         future_value_get_bson_error_ptr (future_get_param (future, 5))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_insert_one (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_insert_one (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_error_ptr (future_get_param (future, 4))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_read_command_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_read_command_with_opts (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 2)),
         future_value_get_const_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_ptr (future_get_param (future, 4)),
         future_value_get_bson_error_ptr (future_get_param (future, 5))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_read_write_command_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_read_write_command_with_opts (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 2)),
         future_value_get_const_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_ptr (future_get_param (future, 4)),
         future_value_get_bson_error_ptr (future_get_param (future, 5))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_write_command_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_write_command_with_opts (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_error_ptr (future_get_param (future, 4))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_insert_bulk (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_insert_bulk (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_mongoc_insert_flags_t (future_get_param (future, 1)),
         future_value_get_const_bson_ptr_ptr (future_get_param (future, 2)),
         future_value_get_uint32_t (future_get_param (future, 3)),
         future_value_get_const_mongoc_write_concern_ptr (future_get_param (future, 4)),
         future_value_get_bson_error_ptr (future_get_param (future, 5))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_cluster_run_command_parts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_cluster_run_command_parts (
         future_value_get_mongoc_cluster_ptr (future_get_param (future, 0)),
         future_value_get_mongoc_server_stream_ptr (future_get_param (future, 1)),
         future_value_get_mongoc_cmd_parts_ptr (future_get_param (future, 2)),
         future_value_get_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_error_ptr (future_get_param (future, 4))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_cursor_destroy (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_void_type;

   mongoc_cursor_destroy (
      future_value_get_mongoc_cursor_ptr (future_get_param (future, 0)));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_cursor_next (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_cursor_next (
         future_value_get_mongoc_cursor_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr_ptr (future_get_param (future, 1))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_client_get_database_names_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_char_ptr_ptr_type;

   future_value_set_char_ptr_ptr (
      &return_value,
      mongoc_client_get_database_names_with_opts (
         future_value_get_mongoc_client_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_bson_error_ptr (future_get_param (future, 2))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_client_select_server (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_mongoc_server_description_ptr_type;

   future_value_set_mongoc_server_description_ptr (
      &return_value,
      mongoc_client_select_server (
         future_value_get_mongoc_client_ptr (future_get_param (future, 0)),
         future_value_get_bool (future_get_param (future, 1)),
         future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 2)),
         future_value_get_bson_error_ptr (future_get_param (future, 3))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_client_destroy (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_void_type;

   mongoc_client_destroy (
      future_value_get_mongoc_client_ptr (future_get_param (future, 0)));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_client_pool_destroy (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_void_type;

   mongoc_client_pool_destroy (
      future_value_get_mongoc_client_pool_ptr (future_get_param (future, 0)));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_database_command_simple (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_database_command_simple (
         future_value_get_mongoc_database_ptr (future_get_param (future, 0)),
         future_value_get_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 2)),
         future_value_get_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_error_ptr (future_get_param (future, 4))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_database_drop_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_database_drop_with_opts (
         future_value_get_mongoc_database_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_bson_error_ptr (future_get_param (future, 2))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_database_get_collection_names_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_char_ptr_ptr_type;

   future_value_set_char_ptr_ptr (
      &return_value,
      mongoc_database_get_collection_names_with_opts (
         future_value_get_mongoc_database_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_bson_error_ptr (future_get_param (future, 2))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_database_watch (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_mongoc_change_stream_ptr_type;

   future_value_set_mongoc_change_stream_ptr (
      &return_value,
      mongoc_database_watch (
         future_value_get_mongoc_database_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_gridfs_file_readv (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_ssize_t_type;

   future_value_set_ssize_t (
      &return_value,
      mongoc_gridfs_file_readv (
         future_value_get_mongoc_gridfs_file_ptr (future_get_param (future, 0)),
         future_value_get_mongoc_iovec_ptr (future_get_param (future, 1)),
         future_value_get_size_t (future_get_param (future, 2)),
         future_value_get_size_t (future_get_param (future, 3)),
         future_value_get_uint32_t (future_get_param (future, 4))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_gridfs_find_one (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_mongoc_gridfs_file_ptr_type;

   future_value_set_mongoc_gridfs_file_ptr (
      &return_value,
      mongoc_gridfs_find_one (
         future_value_get_mongoc_gridfs_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_bson_error_ptr (future_get_param (future, 2))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_gridfs_file_remove (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_gridfs_file_remove (
         future_value_get_mongoc_gridfs_file_ptr (future_get_param (future, 0)),
         future_value_get_bson_error_ptr (future_get_param (future, 1))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_gridfs_file_seek (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_int_type;

   future_value_set_int (
      &return_value,
      mongoc_gridfs_file_seek (
         future_value_get_mongoc_gridfs_file_ptr (future_get_param (future, 0)),
         future_value_get_int64_t (future_get_param (future, 1)),
         future_value_get_int (future_get_param (future, 2))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_gridfs_file_writev (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_ssize_t_type;

   future_value_set_ssize_t (
      &return_value,
      mongoc_gridfs_file_writev (
         future_value_get_mongoc_gridfs_file_ptr (future_get_param (future, 0)),
         future_value_get_const_mongoc_iovec_ptr (future_get_param (future, 1)),
         future_value_get_size_t (future_get_param (future, 2)),
         future_value_get_uint32_t (future_get_param (future, 3))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_gridfs_find_one_with_opts (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_mongoc_gridfs_file_ptr_type;

   future_value_set_mongoc_gridfs_file_ptr (
      &return_value,
      mongoc_gridfs_find_one_with_opts (
         future_value_get_mongoc_gridfs_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_bson_error_ptr (future_get_param (future, 3))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_topology_select (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_mongoc_server_description_ptr_type;

   future_value_set_mongoc_server_description_ptr (
      &return_value,
      mongoc_topology_select (
         future_value_get_mongoc_topology_ptr (future_get_param (future, 0)),
         future_value_get_mongoc_ss_optype_t (future_get_param (future, 1)),
         future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 2)),
         future_value_get_bson_error_ptr (future_get_param (future, 3))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_client_get_gridfs (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_mongoc_gridfs_ptr_type;

   future_value_set_mongoc_gridfs_ptr (
      &return_value,
      mongoc_client_get_gridfs (
         future_value_get_mongoc_client_ptr (future_get_param (future, 0)),
         future_value_get_const_char_ptr (future_get_param (future, 1)),
         future_value_get_const_char_ptr (future_get_param (future, 2)),
         future_value_get_bson_error_ptr (future_get_param (future, 3))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_watch (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_mongoc_change_stream_ptr_type;

   future_value_set_mongoc_change_stream_ptr (
      &return_value,
      mongoc_collection_watch (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_change_stream_next (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_change_stream_next (
         future_value_get_mongoc_change_stream_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr_ptr (future_get_param (future, 1))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_change_stream_destroy (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_void_type;

   mongoc_change_stream_destroy (
      future_value_get_mongoc_change_stream_ptr (future_get_param (future, 0)));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_delete_one (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_delete_one (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_error_ptr (future_get_param (future, 4))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_delete_many (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_delete_many (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_error_ptr (future_get_param (future, 4))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_remove (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_remove (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_mongoc_remove_flags_t (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_const_mongoc_write_concern_ptr (future_get_param (future, 3)),
         future_value_get_bson_error_ptr (future_get_param (future, 4))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_update_one (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_update_one (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_const_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_ptr (future_get_param (future, 4)),
         future_value_get_bson_error_ptr (future_get_param (future, 5))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_update_many (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_update_many (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_const_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_ptr (future_get_param (future, 4)),
         future_value_get_bson_error_ptr (future_get_param (future, 5))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_replace_one (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_bool_type;

   future_value_set_bool (
      &return_value,
      mongoc_collection_replace_one (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_const_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_ptr (future_get_param (future, 4)),
         future_value_get_bson_error_ptr (future_get_param (future, 5))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_count_documents (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_int64_t_type;

   future_value_set_int64_t (
      &return_value,
      mongoc_collection_count_documents (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_bson_ptr (future_get_param (future, 2)),
         future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 3)),
         future_value_get_bson_ptr (future_get_param (future, 4)),
         future_value_get_bson_error_ptr (future_get_param (future, 5))
      ));

   future_resolve (future, return_value);

   return NULL;
}

static void *
background_mongoc_collection_estimated_document_count (void *data)
{
   future_t *future = (future_t *) data;
   future_value_t return_value;

   return_value.type = future_value_int64_t_type;

   future_value_set_int64_t (
      &return_value,
      mongoc_collection_estimated_document_count (
         future_value_get_mongoc_collection_ptr (future_get_param (future, 0)),
         future_value_get_const_bson_ptr (future_get_param (future, 1)),
         future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 2)),
         future_value_get_bson_ptr (future_get_param (future, 3)),
         future_value_get_bson_error_ptr (future_get_param (future, 4))
      ));

   future_resolve (future, return_value);

   return NULL;
}

future_t *
future_async_run (
   mongoc_async_ptr async)
{
   future_t *future = future_new (future_value_void_type,
                                  1);

   future_value_set_mongoc_async_ptr (
      future_get_param (future, 0), async);

   future_start (future, background_mongoc_async_run);
   return future;
}

future_t *
future_bulk_operation_execute (
   mongoc_bulk_operation_ptr bulk,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_uint32_t_type,
                                  3);

   future_value_set_mongoc_bulk_operation_ptr (
      future_get_param (future, 0), bulk);

   future_value_set_bson_ptr (
      future_get_param (future, 1), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 2), error);

   future_start (future, background_mongoc_bulk_operation_execute);
   return future;
}

future_t *
future_database_read_command_with_opts (
   mongoc_database_ptr database,
   const_bson_ptr command,
   const_mongoc_read_prefs_ptr read_prefs,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  6);

   future_value_set_mongoc_database_ptr (
      future_get_param (future, 0), database);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), command);

   future_value_set_const_mongoc_read_prefs_ptr (
      future_get_param (future, 2), read_prefs);

   future_value_set_const_bson_ptr (
      future_get_param (future, 3), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 4), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 5), error);

   future_start (future, background_mongoc_database_read_command_with_opts);
   return future;
}

future_t *
future_database_read_write_command_with_opts (
   mongoc_database_ptr database,
   const_bson_ptr command,
   const_mongoc_read_prefs_ptr read_prefs,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  6);

   future_value_set_mongoc_database_ptr (
      future_get_param (future, 0), database);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), command);

   future_value_set_const_mongoc_read_prefs_ptr (
      future_get_param (future, 2), read_prefs);

   future_value_set_const_bson_ptr (
      future_get_param (future, 3), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 4), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 5), error);

   future_start (future, background_mongoc_database_read_write_command_with_opts);
   return future;
}

future_t *
future_database_write_command_with_opts (
   mongoc_database_ptr database,
   const_bson_ptr command,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  5);

   future_value_set_mongoc_database_ptr (
      future_get_param (future, 0), database);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), command);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 3), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 4), error);

   future_start (future, background_mongoc_database_write_command_with_opts);
   return future;
}

future_t *
future_client_command_simple (
   mongoc_client_ptr client,
   const_char_ptr db_name,
   const_bson_ptr command,
   const_mongoc_read_prefs_ptr read_prefs,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  6);

   future_value_set_mongoc_client_ptr (
      future_get_param (future, 0), client);

   future_value_set_const_char_ptr (
      future_get_param (future, 1), db_name);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), command);

   future_value_set_const_mongoc_read_prefs_ptr (
      future_get_param (future, 3), read_prefs);

   future_value_set_bson_ptr (
      future_get_param (future, 4), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 5), error);

   future_start (future, background_mongoc_client_command_simple);
   return future;
}

future_t *
future_client_command_with_opts (
   mongoc_client_ptr client,
   const_char_ptr db_name,
   const_bson_ptr command,
   const_mongoc_read_prefs_ptr read_prefs,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  7);

   future_value_set_mongoc_client_ptr (
      future_get_param (future, 0), client);

   future_value_set_const_char_ptr (
      future_get_param (future, 1), db_name);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), command);

   future_value_set_const_mongoc_read_prefs_ptr (
      future_get_param (future, 3), read_prefs);

   future_value_set_const_bson_ptr (
      future_get_param (future, 4), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 5), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 6), error);

   future_start (future, background_mongoc_client_command_with_opts);
   return future;
}

future_t *
future_client_read_command_with_opts (
   mongoc_client_ptr client,
   const_char_ptr db_name,
   const_bson_ptr command,
   const_mongoc_read_prefs_ptr read_prefs,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  7);

   future_value_set_mongoc_client_ptr (
      future_get_param (future, 0), client);

   future_value_set_const_char_ptr (
      future_get_param (future, 1), db_name);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), command);

   future_value_set_const_mongoc_read_prefs_ptr (
      future_get_param (future, 3), read_prefs);

   future_value_set_const_bson_ptr (
      future_get_param (future, 4), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 5), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 6), error);

   future_start (future, background_mongoc_client_read_command_with_opts);
   return future;
}

future_t *
future_client_write_command_with_opts (
   mongoc_client_ptr client,
   const_char_ptr db_name,
   const_bson_ptr command,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  6);

   future_value_set_mongoc_client_ptr (
      future_get_param (future, 0), client);

   future_value_set_const_char_ptr (
      future_get_param (future, 1), db_name);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), command);

   future_value_set_const_bson_ptr (
      future_get_param (future, 3), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 4), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 5), error);

   future_start (future, background_mongoc_client_write_command_with_opts);
   return future;
}

future_t *
future_client_read_write_command_with_opts (
   mongoc_client_ptr client,
   const_char_ptr db_name,
   const_bson_ptr command,
   const_mongoc_read_prefs_ptr read_prefs,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  7);

   future_value_set_mongoc_client_ptr (
      future_get_param (future, 0), client);

   future_value_set_const_char_ptr (
      future_get_param (future, 1), db_name);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), command);

   future_value_set_const_mongoc_read_prefs_ptr (
      future_get_param (future, 3), read_prefs);

   future_value_set_const_bson_ptr (
      future_get_param (future, 4), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 5), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 6), error);

   future_start (future, background_mongoc_client_read_write_command_with_opts);
   return future;
}

future_t *
future_client_kill_cursor (
   mongoc_client_ptr client,
   int64_t cursor_id)
{
   future_t *future = future_new (future_value_void_type,
                                  2);

   future_value_set_mongoc_client_ptr (
      future_get_param (future, 0), client);

   future_value_set_int64_t (
      future_get_param (future, 1), cursor_id);

   future_start (future, background_mongoc_client_kill_cursor);
   return future;
}

future_t *
future_client_watch (
   mongoc_client_ptr client,
   const_bson_ptr pipeline,
   const_bson_ptr opts)
{
   future_t *future = future_new (future_value_mongoc_change_stream_ptr_type,
                                  3);

   future_value_set_mongoc_client_ptr (
      future_get_param (future, 0), client);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), pipeline);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), opts);

   future_start (future, background_mongoc_client_watch);
   return future;
}

future_t *
future_collection_aggregate (
   mongoc_collection_ptr collection,
   mongoc_query_flags_t flags,
   const_bson_ptr pipeline,
   const_bson_ptr options,
   const_mongoc_read_prefs_ptr read_prefs)
{
   future_t *future = future_new (future_value_mongoc_cursor_ptr_type,
                                  5);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), collection);

   future_value_set_mongoc_query_flags_t (
      future_get_param (future, 1), flags);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), pipeline);

   future_value_set_const_bson_ptr (
      future_get_param (future, 3), options);

   future_value_set_const_mongoc_read_prefs_ptr (
      future_get_param (future, 4), read_prefs);

   future_start (future, background_mongoc_collection_aggregate);
   return future;
}

future_t *
future_collection_count (
   mongoc_collection_ptr collection,
   mongoc_query_flags_t flags,
   const_bson_ptr query,
   int64_t skip,
   int64_t limit,
   const_mongoc_read_prefs_ptr read_prefs,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_int64_t_type,
                                  7);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), collection);

   future_value_set_mongoc_query_flags_t (
      future_get_param (future, 1), flags);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), query);

   future_value_set_int64_t (
      future_get_param (future, 3), skip);

   future_value_set_int64_t (
      future_get_param (future, 4), limit);

   future_value_set_const_mongoc_read_prefs_ptr (
      future_get_param (future, 5), read_prefs);

   future_value_set_bson_error_ptr (
      future_get_param (future, 6), error);

   future_start (future, background_mongoc_collection_count);
   return future;
}

future_t *
future_collection_count_with_opts (
   mongoc_collection_ptr collection,
   mongoc_query_flags_t flags,
   const_bson_ptr query,
   int64_t skip,
   int64_t limit,
   const_bson_ptr opts,
   const_mongoc_read_prefs_ptr read_prefs,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_int64_t_type,
                                  8);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), collection);

   future_value_set_mongoc_query_flags_t (
      future_get_param (future, 1), flags);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), query);

   future_value_set_int64_t (
      future_get_param (future, 3), skip);

   future_value_set_int64_t (
      future_get_param (future, 4), limit);

   future_value_set_const_bson_ptr (
      future_get_param (future, 5), opts);

   future_value_set_const_mongoc_read_prefs_ptr (
      future_get_param (future, 6), read_prefs);

   future_value_set_bson_error_ptr (
      future_get_param (future, 7), error);

   future_start (future, background_mongoc_collection_count_with_opts);
   return future;
}

future_t *
future_collection_create_index_with_opts (
   mongoc_collection_ptr collection,
   const_bson_ptr keys,
   const_mongoc_index_opt_t opt,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  6);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), collection);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), keys);

   future_value_set_const_mongoc_index_opt_t (
      future_get_param (future, 2), opt);

   future_value_set_const_bson_ptr (
      future_get_param (future, 3), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 4), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 5), error);

   future_start (future, background_mongoc_collection_create_index_with_opts);
   return future;
}

future_t *
future_collection_drop_index_with_opts (
   mongoc_collection_ptr collection,
   const_char_ptr index_name,
   const_bson_ptr opts,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  4);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), collection);

   future_value_set_const_char_ptr (
      future_get_param (future, 1), index_name);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), opts);

   future_value_set_bson_error_ptr (
      future_get_param (future, 3), error);

   future_start (future, background_mongoc_collection_drop_index_with_opts);
   return future;
}

future_t *
future_collection_drop_with_opts (
   mongoc_collection_ptr collection,
   const_bson_ptr opts,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  3);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), collection);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), opts);

   future_value_set_bson_error_ptr (
      future_get_param (future, 2), error);

   future_start (future, background_mongoc_collection_drop_with_opts);
   return future;
}

future_t *
future_collection_find_and_modify_with_opts (
   mongoc_collection_ptr collection,
   const_bson_ptr query,
   const_mongoc_find_and_modify_opts_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  5);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), collection);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), query);

   future_value_set_const_mongoc_find_and_modify_opts_ptr (
      future_get_param (future, 2), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 3), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 4), error);

   future_start (future, background_mongoc_collection_find_and_modify_with_opts);
   return future;
}

future_t *
future_collection_find_and_modify (
   mongoc_collection_ptr collection,
   const_bson_ptr query,
   const_bson_ptr sort,
   const_bson_ptr update,
   const_bson_ptr fields,
   bool _remove,
   bool upsert,
   bool _new,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  10);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), collection);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), query);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), sort);

   future_value_set_const_bson_ptr (
      future_get_param (future, 3), update);

   future_value_set_const_bson_ptr (
      future_get_param (future, 4), fields);

   future_value_set_bool (
      future_get_param (future, 5), _remove);

   future_value_set_bool (
      future_get_param (future, 6), upsert);

   future_value_set_bool (
      future_get_param (future, 7), _new);

   future_value_set_bson_ptr (
      future_get_param (future, 8), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 9), error);

   future_start (future, background_mongoc_collection_find_and_modify);
   return future;
}

future_t *
future_collection_find_indexes_with_opts (
   mongoc_collection_ptr collection,
   const_bson_ptr opts)
{
   future_t *future = future_new (future_value_mongoc_cursor_ptr_type,
                                  2);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), collection);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), opts);

   future_start (future, background_mongoc_collection_find_indexes_with_opts);
   return future;
}

future_t *
future_collection_stats (
   mongoc_collection_ptr collection,
   const_bson_ptr options,
   bson_ptr stats,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  4);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), collection);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), options);

   future_value_set_bson_ptr (
      future_get_param (future, 2), stats);

   future_value_set_bson_error_ptr (
      future_get_param (future, 3), error);

   future_start (future, background_mongoc_collection_stats);
   return future;
}

future_t *
future_collection_insert_many (
   mongoc_collection_ptr collection,
   const_bson_ptr_ptr documents,
   size_t n_documents,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  6);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), collection);

   future_value_set_const_bson_ptr_ptr (
      future_get_param (future, 1), documents);

   future_value_set_size_t (
      future_get_param (future, 2), n_documents);

   future_value_set_const_bson_ptr (
      future_get_param (future, 3), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 4), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 5), error);

   future_start (future, background_mongoc_collection_insert_many);
   return future;
}

future_t *
future_collection_insert_one (
   mongoc_collection_ptr collection,
   const_bson_ptr document,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  5);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), collection);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), document);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 3), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 4), error);

   future_start (future, background_mongoc_collection_insert_one);
   return future;
}

future_t *
future_collection_read_command_with_opts (
   mongoc_collection_ptr collection,
   const_bson_ptr command,
   const_mongoc_read_prefs_ptr read_prefs,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  6);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), collection);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), command);

   future_value_set_const_mongoc_read_prefs_ptr (
      future_get_param (future, 2), read_prefs);

   future_value_set_const_bson_ptr (
      future_get_param (future, 3), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 4), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 5), error);

   future_start (future, background_mongoc_collection_read_command_with_opts);
   return future;
}

future_t *
future_collection_read_write_command_with_opts (
   mongoc_collection_ptr collection,
   const_bson_ptr command,
   const_mongoc_read_prefs_ptr read_prefs,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  6);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), collection);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), command);

   future_value_set_const_mongoc_read_prefs_ptr (
      future_get_param (future, 2), read_prefs);

   future_value_set_const_bson_ptr (
      future_get_param (future, 3), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 4), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 5), error);

   future_start (future, background_mongoc_collection_read_write_command_with_opts);
   return future;
}

future_t *
future_collection_write_command_with_opts (
   mongoc_collection_ptr collection,
   const_bson_ptr command,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  5);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), collection);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), command);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 3), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 4), error);

   future_start (future, background_mongoc_collection_write_command_with_opts);
   return future;
}

future_t *
future_collection_insert_bulk (
   mongoc_collection_ptr collection,
   mongoc_insert_flags_t flags,
   const_bson_ptr_ptr documents,
   uint32_t n_documents,
   const_mongoc_write_concern_ptr write_concern,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  6);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), collection);

   future_value_set_mongoc_insert_flags_t (
      future_get_param (future, 1), flags);

   future_value_set_const_bson_ptr_ptr (
      future_get_param (future, 2), documents);

   future_value_set_uint32_t (
      future_get_param (future, 3), n_documents);

   future_value_set_const_mongoc_write_concern_ptr (
      future_get_param (future, 4), write_concern);

   future_value_set_bson_error_ptr (
      future_get_param (future, 5), error);

   future_start (future, background_mongoc_collection_insert_bulk);
   return future;
}

future_t *
future_cluster_run_command_parts (
   mongoc_cluster_ptr cluster,
   mongoc_server_stream_ptr server_stream,
   mongoc_cmd_parts_ptr parts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  5);

   future_value_set_mongoc_cluster_ptr (
      future_get_param (future, 0), cluster);

   future_value_set_mongoc_server_stream_ptr (
      future_get_param (future, 1), server_stream);

   future_value_set_mongoc_cmd_parts_ptr (
      future_get_param (future, 2), parts);

   future_value_set_bson_ptr (
      future_get_param (future, 3), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 4), error);

   future_start (future, background_mongoc_cluster_run_command_parts);
   return future;
}

future_t *
future_cursor_destroy (
   mongoc_cursor_ptr cursor)
{
   future_t *future = future_new (future_value_void_type,
                                  1);

   future_value_set_mongoc_cursor_ptr (
      future_get_param (future, 0), cursor);

   future_start (future, background_mongoc_cursor_destroy);
   return future;
}

future_t *
future_cursor_next (
   mongoc_cursor_ptr cursor,
   const_bson_ptr_ptr doc)
{
   future_t *future = future_new (future_value_bool_type,
                                  2);

   future_value_set_mongoc_cursor_ptr (
      future_get_param (future, 0), cursor);

   future_value_set_const_bson_ptr_ptr (
      future_get_param (future, 1), doc);

   future_start (future, background_mongoc_cursor_next);
   return future;
}

future_t *
future_client_get_database_names_with_opts (
   mongoc_client_ptr client,
   const_bson_ptr opts,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_char_ptr_ptr_type,
                                  3);

   future_value_set_mongoc_client_ptr (
      future_get_param (future, 0), client);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), opts);

   future_value_set_bson_error_ptr (
      future_get_param (future, 2), error);

   future_start (future, background_mongoc_client_get_database_names_with_opts);
   return future;
}

future_t *
future_client_select_server (
   mongoc_client_ptr client,
   bool for_writes,
   const_mongoc_read_prefs_ptr prefs,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_mongoc_server_description_ptr_type,
                                  4);

   future_value_set_mongoc_client_ptr (
      future_get_param (future, 0), client);

   future_value_set_bool (
      future_get_param (future, 1), for_writes);

   future_value_set_const_mongoc_read_prefs_ptr (
      future_get_param (future, 2), prefs);

   future_value_set_bson_error_ptr (
      future_get_param (future, 3), error);

   future_start (future, background_mongoc_client_select_server);
   return future;
}

future_t *
future_client_destroy (
   mongoc_client_ptr client)
{
   future_t *future = future_new (future_value_void_type,
                                  1);

   future_value_set_mongoc_client_ptr (
      future_get_param (future, 0), client);

   future_start (future, background_mongoc_client_destroy);
   return future;
}

future_t *
future_client_pool_destroy (
   mongoc_client_pool_ptr pool)
{
   future_t *future = future_new (future_value_void_type,
                                  1);

   future_value_set_mongoc_client_pool_ptr (
      future_get_param (future, 0), pool);

   future_start (future, background_mongoc_client_pool_destroy);
   return future;
}

future_t *
future_database_command_simple (
   mongoc_database_ptr database,
   bson_ptr command,
   const_mongoc_read_prefs_ptr read_prefs,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  5);

   future_value_set_mongoc_database_ptr (
      future_get_param (future, 0), database);

   future_value_set_bson_ptr (
      future_get_param (future, 1), command);

   future_value_set_const_mongoc_read_prefs_ptr (
      future_get_param (future, 2), read_prefs);

   future_value_set_bson_ptr (
      future_get_param (future, 3), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 4), error);

   future_start (future, background_mongoc_database_command_simple);
   return future;
}

future_t *
future_database_drop_with_opts (
   mongoc_database_ptr database,
   const_bson_ptr opts,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  3);

   future_value_set_mongoc_database_ptr (
      future_get_param (future, 0), database);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), opts);

   future_value_set_bson_error_ptr (
      future_get_param (future, 2), error);

   future_start (future, background_mongoc_database_drop_with_opts);
   return future;
}

future_t *
future_database_get_collection_names_with_opts (
   mongoc_database_ptr database,
   const_bson_ptr opts,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_char_ptr_ptr_type,
                                  3);

   future_value_set_mongoc_database_ptr (
      future_get_param (future, 0), database);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), opts);

   future_value_set_bson_error_ptr (
      future_get_param (future, 2), error);

   future_start (future, background_mongoc_database_get_collection_names_with_opts);
   return future;
}

future_t *
future_database_watch (
   mongoc_database_ptr database,
   const_bson_ptr pipeline,
   const_bson_ptr opts)
{
   future_t *future = future_new (future_value_mongoc_change_stream_ptr_type,
                                  3);

   future_value_set_mongoc_database_ptr (
      future_get_param (future, 0), database);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), pipeline);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), opts);

   future_start (future, background_mongoc_database_watch);
   return future;
}

future_t *
future_gridfs_file_readv (
   mongoc_gridfs_file_ptr file,
   mongoc_iovec_ptr iov,
   size_t iovcnt,
   size_t min_bytes,
   uint32_t timeout_msec)
{
   future_t *future = future_new (future_value_ssize_t_type,
                                  5);

   future_value_set_mongoc_gridfs_file_ptr (
      future_get_param (future, 0), file);

   future_value_set_mongoc_iovec_ptr (
      future_get_param (future, 1), iov);

   future_value_set_size_t (
      future_get_param (future, 2), iovcnt);

   future_value_set_size_t (
      future_get_param (future, 3), min_bytes);

   future_value_set_uint32_t (
      future_get_param (future, 4), timeout_msec);

   future_start (future, background_mongoc_gridfs_file_readv);
   return future;
}

future_t *
future_gridfs_find_one (
   mongoc_gridfs_ptr gridfs,
   const_bson_ptr query,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_mongoc_gridfs_file_ptr_type,
                                  3);

   future_value_set_mongoc_gridfs_ptr (
      future_get_param (future, 0), gridfs);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), query);

   future_value_set_bson_error_ptr (
      future_get_param (future, 2), error);

   future_start (future, background_mongoc_gridfs_find_one);
   return future;
}

future_t *
future_gridfs_file_remove (
   mongoc_gridfs_file_ptr file,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  2);

   future_value_set_mongoc_gridfs_file_ptr (
      future_get_param (future, 0), file);

   future_value_set_bson_error_ptr (
      future_get_param (future, 1), error);

   future_start (future, background_mongoc_gridfs_file_remove);
   return future;
}

future_t *
future_gridfs_file_seek (
   mongoc_gridfs_file_ptr file,
   int64_t delta,
   int whence)
{
   future_t *future = future_new (future_value_int_type,
                                  3);

   future_value_set_mongoc_gridfs_file_ptr (
      future_get_param (future, 0), file);

   future_value_set_int64_t (
      future_get_param (future, 1), delta);

   future_value_set_int (
      future_get_param (future, 2), whence);

   future_start (future, background_mongoc_gridfs_file_seek);
   return future;
}

future_t *
future_gridfs_file_writev (
   mongoc_gridfs_file_ptr file,
   const_mongoc_iovec_ptr iov,
   size_t iovcnt,
   uint32_t timeout_msec)
{
   future_t *future = future_new (future_value_ssize_t_type,
                                  4);

   future_value_set_mongoc_gridfs_file_ptr (
      future_get_param (future, 0), file);

   future_value_set_const_mongoc_iovec_ptr (
      future_get_param (future, 1), iov);

   future_value_set_size_t (
      future_get_param (future, 2), iovcnt);

   future_value_set_uint32_t (
      future_get_param (future, 3), timeout_msec);

   future_start (future, background_mongoc_gridfs_file_writev);
   return future;
}

future_t *
future_gridfs_find_one_with_opts (
   mongoc_gridfs_ptr gridfs,
   const_bson_ptr filter,
   const_bson_ptr opts,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_mongoc_gridfs_file_ptr_type,
                                  4);

   future_value_set_mongoc_gridfs_ptr (
      future_get_param (future, 0), gridfs);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), filter);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), opts);

   future_value_set_bson_error_ptr (
      future_get_param (future, 3), error);

   future_start (future, background_mongoc_gridfs_find_one_with_opts);
   return future;
}

future_t *
future_topology_select (
   mongoc_topology_ptr topology,
   mongoc_ss_optype_t optype,
   const_mongoc_read_prefs_ptr read_prefs,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_mongoc_server_description_ptr_type,
                                  4);

   future_value_set_mongoc_topology_ptr (
      future_get_param (future, 0), topology);

   future_value_set_mongoc_ss_optype_t (
      future_get_param (future, 1), optype);

   future_value_set_const_mongoc_read_prefs_ptr (
      future_get_param (future, 2), read_prefs);

   future_value_set_bson_error_ptr (
      future_get_param (future, 3), error);

   future_start (future, background_mongoc_topology_select);
   return future;
}

future_t *
future_client_get_gridfs (
   mongoc_client_ptr client,
   const_char_ptr db,
   const_char_ptr prefix,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_mongoc_gridfs_ptr_type,
                                  4);

   future_value_set_mongoc_client_ptr (
      future_get_param (future, 0), client);

   future_value_set_const_char_ptr (
      future_get_param (future, 1), db);

   future_value_set_const_char_ptr (
      future_get_param (future, 2), prefix);

   future_value_set_bson_error_ptr (
      future_get_param (future, 3), error);

   future_start (future, background_mongoc_client_get_gridfs);
   return future;
}

future_t *
future_collection_watch (
   mongoc_collection_ptr coll,
   const_bson_ptr pipeline,
   const_bson_ptr opts)
{
   future_t *future = future_new (future_value_mongoc_change_stream_ptr_type,
                                  3);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), coll);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), pipeline);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), opts);

   future_start (future, background_mongoc_collection_watch);
   return future;
}

future_t *
future_change_stream_next (
   mongoc_change_stream_ptr stream,
   const_bson_ptr_ptr bson)
{
   future_t *future = future_new (future_value_bool_type,
                                  2);

   future_value_set_mongoc_change_stream_ptr (
      future_get_param (future, 0), stream);

   future_value_set_const_bson_ptr_ptr (
      future_get_param (future, 1), bson);

   future_start (future, background_mongoc_change_stream_next);
   return future;
}

future_t *
future_change_stream_destroy (
   mongoc_change_stream_ptr stream)
{
   future_t *future = future_new (future_value_void_type,
                                  1);

   future_value_set_mongoc_change_stream_ptr (
      future_get_param (future, 0), stream);

   future_start (future, background_mongoc_change_stream_destroy);
   return future;
}

future_t *
future_collection_delete_one (
   mongoc_collection_ptr coll,
   const_bson_ptr selector,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  5);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), coll);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), selector);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 3), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 4), error);

   future_start (future, background_mongoc_collection_delete_one);
   return future;
}

future_t *
future_collection_delete_many (
   mongoc_collection_ptr coll,
   const_bson_ptr selector,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  5);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), coll);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), selector);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 3), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 4), error);

   future_start (future, background_mongoc_collection_delete_many);
   return future;
}

future_t *
future_collection_remove (
   mongoc_collection_ptr coll,
   mongoc_remove_flags_t flags,
   const_bson_ptr selector,
   const_mongoc_write_concern_ptr write_concern,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  5);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), coll);

   future_value_set_mongoc_remove_flags_t (
      future_get_param (future, 1), flags);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), selector);

   future_value_set_const_mongoc_write_concern_ptr (
      future_get_param (future, 3), write_concern);

   future_value_set_bson_error_ptr (
      future_get_param (future, 4), error);

   future_start (future, background_mongoc_collection_remove);
   return future;
}

future_t *
future_collection_update_one (
   mongoc_collection_ptr coll,
   const_bson_ptr selector,
   const_bson_ptr update,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  6);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), coll);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), selector);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), update);

   future_value_set_const_bson_ptr (
      future_get_param (future, 3), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 4), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 5), error);

   future_start (future, background_mongoc_collection_update_one);
   return future;
}

future_t *
future_collection_update_many (
   mongoc_collection_ptr coll,
   const_bson_ptr selector,
   const_bson_ptr update,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  6);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), coll);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), selector);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), update);

   future_value_set_const_bson_ptr (
      future_get_param (future, 3), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 4), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 5), error);

   future_start (future, background_mongoc_collection_update_many);
   return future;
}

future_t *
future_collection_replace_one (
   mongoc_collection_ptr coll,
   const_bson_ptr selector,
   const_bson_ptr replacement,
   const_bson_ptr opts,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_bool_type,
                                  6);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), coll);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), selector);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), replacement);

   future_value_set_const_bson_ptr (
      future_get_param (future, 3), opts);

   future_value_set_bson_ptr (
      future_get_param (future, 4), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 5), error);

   future_start (future, background_mongoc_collection_replace_one);
   return future;
}

future_t *
future_collection_count_documents (
   mongoc_collection_ptr coll,
   const_bson_ptr filter,
   const_bson_ptr opts,
   const_mongoc_read_prefs_ptr read_prefs,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_int64_t_type,
                                  6);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), coll);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), filter);

   future_value_set_const_bson_ptr (
      future_get_param (future, 2), opts);

   future_value_set_const_mongoc_read_prefs_ptr (
      future_get_param (future, 3), read_prefs);

   future_value_set_bson_ptr (
      future_get_param (future, 4), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 5), error);

   future_start (future, background_mongoc_collection_count_documents);
   return future;
}

future_t *
future_collection_estimated_document_count (
   mongoc_collection_ptr coll,
   const_bson_ptr opts,
   const_mongoc_read_prefs_ptr read_prefs,
   bson_ptr reply,
   bson_error_ptr error)
{
   future_t *future = future_new (future_value_int64_t_type,
                                  5);

   future_value_set_mongoc_collection_ptr (
      future_get_param (future, 0), coll);

   future_value_set_const_bson_ptr (
      future_get_param (future, 1), opts);

   future_value_set_const_mongoc_read_prefs_ptr (
      future_get_param (future, 2), read_prefs);

   future_value_set_bson_ptr (
      future_get_param (future, 3), reply);

   future_value_set_bson_error_ptr (
      future_get_param (future, 4), error);

   future_start (future, background_mongoc_collection_estimated_document_count);
   return future;
}


text:
const puppeteer = require('puppeteer');
const path = require('path');
const cas = require('../../cas.js');

(async () => {
    const browser = await puppeteer.launch(cas.browserOptions());
    const page = await cas.newPage(browser);

    await cas.goto(page, "https://localhost:8443/cas/login");
    await page.waitForTimeout(1000);
    await cas.loginWith(page, "casuser", "Mellon");

    await cas.goto(page, "http://localhost:9443/simplesaml/module.php/core/authenticate.php?as=default-sp");
    await page.waitForTimeout(2000);
    await cas.removeDirectory(path.join(__dirname, '/saml-md'));
    await cas.assertVisibility(page, '#username');
    await cas.assertVisibility(page, '#password');

    await browser.close();
})();

redpajama_set_name: RedPajamaGithub


text:
/*
Changes from V3.0.0
	+ ISRcode pulled inline to reduce stack-usage.

	+ Added functionality to only call vTaskSwitchContext() once
	  when handling multiple interruptsources in a single interruptcall.

	+ Filename changed to a .c extension to allow stepping through code
	  using F7.

Changes from V3.0.1
*/

/*
 * ISR for the tick.
 * This increments the tick count and, if using the preemptive scheduler,
 * performs a context switch.  This must be identical to the manual
 * context switch in how it stores the context of a task.
 */

#ifndef _FREERTOS_DRIVERS_TICK_ISRTICK_C
#define _FREERTOS_DRIVERS_TICK_ISRTICK_C

{
	/*
	 * Was the interrupt the SystemClock?
	 */
	if( bCCP1IF && bCCP1IE )
	{
		/*
		 * Reset the interrupt flag
		 */
		bCCP1IF = 0;

		/*
	 	 * Maintain the tick count.
	 	 */
		vTaskIncrementTick();

		#if configUSE_PREEMPTION == 1
		{
			/*
		 	 * Ask for a switch to the highest priority task
		 	 * that is ready to run.
		 	 */
			uxSwitchRequested = pdTRUE;
		}
		#endif
	}
}

#pragma wizcpp uselib     "$__PATHNAME__/Tick.c"

#endif	/* _FREERTOS_DRIVERS_TICK_ISRTICK_C */


text:
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://www.knime.org/2008/09/XMLConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.knime.org/2008/09/XMLConfig http://www.knime.org/XMLConfig_2008_09.xsd" key="settings.xml">
<entry key="node_file" type="xstring" value="settings.xml"/>
<config key="flow_stack"/>
<config key="internal_node_subsettings">
<entry key="memory_policy" type="xstring" value="CacheSmallInMemory"/>
</config>
<config key="model">
<config key="program_Internals">
<entry key="SettingsModelID" type="xstring" value="SMID_string"/>
<entry key="EnabledStatus" type="xboolean" value="true"/>
</config>
<entry key="program" type="xstring" value="align-it"/>
<config key="arguments_Internals">
<entry key="SettingsModelID" type="xstring" value="SMID_string"/>
<entry key="EnabledStatus" type="xboolean" value="true"/>
</config>
<entry key="arguments" type="xstring" value="args"/>
</config>
<entry key="customDescription" type="xstring" isnull="true" value=""/>
<entry key="state" type="xstring" value="IDLE"/>
<entry key="factory" type="xstring" value="nl.esciencecenter.e3dchem.knime.silicosit.execute.ExecuteFactory"/>
<entry key="node-name" type="xstring" value="Silicos-it executor"/>
<entry key="node-bundle-name" type="xstring" value="KNIME nodes for Silicos-it software"/>
<entry key="node-bundle-symbolic-name" type="xstring" value="nl.esciencecenter.e3dchem.knime.silicosit.plugin"/>
<entry key="node-bundle-vendor" type="xstring" value="Netherlands eScience Center"/>
<entry key="node-bundle-version" type="xstring" value="1.0.1.v201708090758"/>
<entry key="node-feature-name" type="xstring" value="Silicos-it KNIME nodes"/>
<entry key="node-feature-symbolic-name" type="xstring" value="nl.esciencecenter.e3dchem.knime.silicosit.feature.feature.group"/>
<entry key="node-feature-vendor" type="xstring" value="Netherlands eScience Center"/>
<entry key="node-feature-version" type="xstring" value="1.0.1.v201708090758"/>
<config key="factory_settings"/>
<entry key="name" type="xstring" value="Silicos-it executor"/>
<entry key="hasContent" type="xboolean" value="false"/>
<entry key="isInactive" type="xboolean" value="false"/>
<config key="ports">
<config key="port_1">
<entry key="index" type="xint" value="1"/>
<entry key="port_dir_location" type="xstring" isnull="true" value=""/>
</config>
</config>
<config key="filestores">
<entry key="file_store_location" type="xstring" isnull="true" value=""/>
<entry key="file_store_id" type="xstring" isnull="true" value=""/>
</config>
</config>