Skip to content

Commit

Permalink
CDRIVER-1522 add topology-type getter
Browse files Browse the repository at this point in the history
  • Loading branch information
ajdavis committed Sep 12, 2016
1 parent 08e5cf4 commit f4cfb6e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/mongoc/mongoc-topology-private.h
Expand Up @@ -100,6 +100,9 @@ int64_t
mongoc_topology_server_timestamp (mongoc_topology_t *topology,
uint32_t id);

mongoc_topology_description_type_t
_mongoc_topology_description_get_type (mongoc_topology_t *topology);

bool
_mongoc_topology_start_background_scanner (mongoc_topology_t *topology);

Expand Down
28 changes: 28 additions & 0 deletions src/mongoc/mongoc-topology.c
Expand Up @@ -773,6 +773,34 @@ mongoc_topology_server_timestamp (mongoc_topology_t *topology,
return timestamp;
}

/*
*--------------------------------------------------------------------------
*
* _mongoc_topology_description_get_type --
*
* Return the topology's description's type.
*
* NOTE: this method uses @topology's mutex.
*
* Returns:
* The topology description type.
*
*--------------------------------------------------------------------------
*/
mongoc_topology_description_type_t
_mongoc_topology_description_get_type (mongoc_topology_t *topology)
{
mongoc_topology_description_type_t td_type;

mongoc_mutex_lock (&topology->mutex);

td_type = topology->description.type;

mongoc_mutex_unlock (&topology->mutex);

return td_type;
}

/*
*--------------------------------------------------------------------------
*
Expand Down

0 comments on commit f4cfb6e

Please sign in to comment.