@@ -422,72 +422,6 @@ zend_object_value php_phongo_manager_create_object(zend_class_entry *class_type
422
422
return retval ;
423
423
} /* }}} */
424
424
425
- /*
426
- static const char *phongo_cluster_mode_tostring(mongoc_cluster_mode_t mode)
427
- {
428
- switch (mode) {
429
- case MONGOC_CLUSTER_DIRECT:
430
- return "direct";
431
- case MONGOC_CLUSTER_REPLICA_SET:
432
- return "replicaset";
433
- case MONGOC_CLUSTER_SHARDED_CLUSTER:
434
- return "sharded";
435
- break;
436
- }
437
-
438
- return "broken";
439
- }
440
-
441
- static const char *phongo_cluster_state_tostring(mongoc_cluster_state_t state)
442
- {
443
- switch (state) {
444
- case MONGOC_CLUSTER_STATE_BORN:
445
- return "born";
446
- case MONGOC_CLUSTER_STATE_HEALTHY:
447
- return "healthy";
448
- case MONGOC_CLUSTER_STATE_DEAD:
449
- return "dead";
450
- case MONGOC_CLUSTER_STATE_UNHEALTHY:
451
- return "unhealthy";
452
- }
453
-
454
- return "broken";
455
- }
456
- */
457
-
458
- static void add_next_index_node (zval * array , mongoc_cluster_node_t * node )
459
- {
460
- zval * data = NULL ;
461
- php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER ;
462
-
463
- MAKE_STD_ZVAL (state .zchild );
464
-
465
- MAKE_STD_ZVAL (data );
466
- array_init (data );
467
- /*FIXME: What data to dump ?
468
- add_assoc_long_ex(data, ZEND_STRS("ping_avg_msec"), node->ping_avg_msec);
469
- add_assoc_long_ex(data, ZEND_STRS("stamp"), node->stamp);
470
- add_assoc_bool_ex(data, ZEND_STRS("primary"), node->primary);
471
- add_assoc_bool_ex(data, ZEND_STRS("needs_auth"), node->needs_auth);
472
- add_assoc_bool_ex(data, ZEND_STRS("isdbgrid"), node->needs_auth);
473
- add_assoc_long_ex(data, ZEND_STRS("min_wire_version"), node->min_wire_version);
474
- add_assoc_long_ex(data, ZEND_STRS("max_wire_version"), node->max_wire_version);
475
- add_assoc_long_ex(data, ZEND_STRS("max_write_batch_size"), node->max_write_batch_size);
476
- if (node->replSet) {
477
- add_assoc_string_ex(data, ZEND_STRS("replSet"), node->replSet, 0);
478
- } else {
479
- add_assoc_null_ex(data, ZEND_STRS("replSet"));
480
- }
481
- add_assoc_long_ex(data, ZEND_STRS("last_read_msec"), node->last_read_msec);
482
- bson_to_zval(bson_get_data(&node->tags), node->tags.len, &state);
483
- add_assoc_zval_ex(data, ZEND_STRS("tags"), state.zchild);
484
- add_assoc_string_ex(data, ZEND_STRS("host_and_port"), node->host.host_and_port, 0);
485
- */
486
- /* TODO: Should this contain the actual stream too? we have the mongoc_stream_t... */
487
-
488
- add_next_index_zval (array , data );
489
- }
490
-
491
425
HashTable * php_phongo_manager_get_debug_info (zval * object , int * is_temp TSRMLS_DC ) /* {{{ */
492
426
{
493
427
zval * retval = NULL ;
@@ -507,53 +441,6 @@ HashTable *php_phongo_manager_get_debug_info(zval *object, int *is_temp TSRMLS_D
507
441
zval * cluster = NULL ;
508
442
MAKE_STD_ZVAL (cluster );
509
443
array_init (cluster );
510
- /* FIXME: What data to dump ?
511
- add_assoc_string_ex(cluster, ZEND_STRS("mode"), (char *)phongo_cluster_mode_tostring(intern->client->cluster.mode), 0);
512
- add_assoc_string_ex(cluster, ZEND_STRS("state"), (char *)phongo_cluster_state_tostring(intern->client->cluster.state), 0);
513
- add_assoc_long_ex(cluster, ZEND_STRS("request_id"), intern->client->cluster.request_id);
514
- add_assoc_long_ex(cluster, ZEND_STRS("sockettimeoutms"), intern->client->cluster.sockettimeoutms);
515
- add_assoc_long_ex(cluster, ZEND_STRS("last_reconnect"), intern->client->cluster.last_reconnect);
516
- add_assoc_string_ex(cluster, ZEND_STRS("uri"), (char *)mongoc_uri_get_string(intern->client->cluster.uri), 0);
517
- add_assoc_long_ex(cluster, ZEND_STRS("requires_auth"), intern->client->cluster.requires_auth);
518
-
519
- if (intern->client->cluster.nodes_len) {
520
- zval *nodes = NULL;
521
- unsigned int i;
522
-
523
- MAKE_STD_ZVAL(nodes);
524
- array_init(nodes);
525
- for (i = 0; i < intern->client->cluster.nodes_len; i++) {
526
- add_next_index_node(nodes, &intern->client->cluster.nodes[i]);
527
- }
528
- add_assoc_zval_ex(cluster, ZEND_STRS("nodes"), nodes);
529
- }
530
- add_assoc_long_ex(cluster, ZEND_STRS("max_bson_size"), intern->client->cluster.max_bson_size);
531
- add_assoc_long_ex(cluster, ZEND_STRS("max_msg_size"), intern->client->cluster.max_msg_size);
532
- add_assoc_long_ex(cluster, ZEND_STRS("sec_latency_ms"), intern->client->cluster.sec_latency_ms);
533
- {
534
- mongoc_host_list_t host;
535
- zval *peers = NULL;
536
- mongoc_list_t *list;
537
- mongoc_list_t *liter;
538
-
539
- MAKE_STD_ZVAL(peers);
540
- array_init(peers);
541
-
542
- list = intern->client->cluster.peers;
543
- for (liter = list; liter ; liter = liter->next) {
544
-
545
- if (_mongoc_host_list_from_string(&host, liter->data)) {
546
- add_next_index_string(peers, host.host_and_port, 1);
547
- }
548
- }
549
- add_assoc_zval_ex(cluster, ZEND_STRS("peers"), peers);
550
- }
551
- if (intern->client->cluster.replSet) {
552
- add_assoc_string_ex(cluster, ZEND_STRS("replSet"), intern->client->cluster.replSet, 0);
553
- } else {
554
- add_assoc_null_ex(cluster, ZEND_STRS("replSet"));
555
- }
556
- */
557
444
558
445
add_assoc_zval_ex (retval , ZEND_STRS ("cluster" ), cluster );
559
446
}
0 commit comments