Skip to content

Commit fb7d316

Browse files
committed
Define TopologyDescription::TYPE_LOAD_BALANCED
1 parent d6db848 commit fb7d316

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/MongoDB/TopologyDescription.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@
2828

2929
zend_class_entry* php_phongo_topologydescription_ce;
3030

31+
/* Note: these constants are derived from _mongoc_topology_description_type,
32+
* since mongoc_topology_description_t is private. */
3133
#define PHONGO_TOPOLOGY_UNKNOWN "Unknown"
3234
#define PHONGO_TOPOLOGY_SINGLE "Single"
3335
#define PHONGO_TOPOLOGY_SHARDED "Sharded"
3436
#define PHONGO_TOPOLOGY_REPLICA_SET_NO_PRIMARY "ReplicaSetNoPrimary"
3537
#define PHONGO_TOPOLOGY_REPLICA_SET_WITH_PRIMARY "ReplicaSetWithPrimary"
38+
#define PHONGO_TOPOLOGY_LOAD_BALANCED "LoadBalanced"
3639

3740
/* {{{ proto array MongoDB\Driver\TopologyDescription::getServers()
3841
Returns an array of ServerDescription objects for all known servers in the topology */
@@ -229,6 +232,7 @@ void php_phongo_topologydescription_init_ce(INIT_FUNC_ARGS) /* {{{ */
229232
zend_declare_class_constant_string(php_phongo_topologydescription_ce, ZEND_STRL("TYPE_SHARDED"), PHONGO_TOPOLOGY_SHARDED);
230233
zend_declare_class_constant_string(php_phongo_topologydescription_ce, ZEND_STRL("TYPE_REPLICA_SET_NO_PRIMARY"), PHONGO_TOPOLOGY_REPLICA_SET_NO_PRIMARY);
231234
zend_declare_class_constant_string(php_phongo_topologydescription_ce, ZEND_STRL("TYPE_REPLICA_SET_WITH_PRIMARY"), PHONGO_TOPOLOGY_REPLICA_SET_WITH_PRIMARY);
235+
zend_declare_class_constant_string(php_phongo_topologydescription_ce, ZEND_STRL("TYPE_LOAD_BALANCED"), PHONGO_TOPOLOGY_LOAD_BALANCED);
232236
} /* }}} */
233237

234238
/*

tests/topologyDescription/topologyDescription-constants.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var_dump(MongoDB\Driver\TopologyDescription::TYPE_SINGLE);
88
var_dump(MongoDB\Driver\TopologyDescription::TYPE_SHARDED);
99
var_dump(MongoDB\Driver\TopologyDescription::TYPE_REPLICA_SET_NO_PRIMARY);
1010
var_dump(MongoDB\Driver\TopologyDescription::TYPE_REPLICA_SET_WITH_PRIMARY);
11+
var_dump(MongoDB\Driver\TopologyDescription::TYPE_LOAD_BALANCED);
1112

1213
?>
1314
===DONE===
@@ -18,4 +19,5 @@ string(6) "Single"
1819
string(7) "Sharded"
1920
string(19) "ReplicaSetNoPrimary"
2021
string(21) "ReplicaSetWithPrimary"
22+
string(12) "LoadBalanced"
2123
===DONE===

0 commit comments

Comments
 (0)