1+ use crate :: ClientSettings ;
12use crate :: event_store:: client:: gossip as wire;
23use crate :: grpc:: HyperClient ;
3- use crate :: http:: http_configure_auth;
44use crate :: request:: build_request_metadata;
55use crate :: types:: Endpoint ;
6- use crate :: { ClientSettings , grpc} ;
76use serde:: { Deserialize , Serialize } ;
87use tonic:: { Request , Status } ;
98use uuid:: Uuid ;
@@ -71,57 +70,6 @@ pub async fn read(
7170 Ok ( members)
7271}
7372
74- pub ( crate ) async fn http_read (
75- setts : & ClientSettings ,
76- handle : grpc:: Handle ,
77- ) -> Result < Vec < MemberInfo > , Box < dyn std:: error:: Error > > {
78- let client = reqwest:: Client :: builder ( )
79- . danger_accept_invalid_certs ( !setts. tls_verify_cert )
80- . build ( ) ?;
81-
82- let default_auth = setts
83- . default_user_name
84- . as_ref ( )
85- . map ( |c| crate :: Authentication :: Basic ( c. clone ( ) ) ) ;
86-
87- let resp = http_configure_auth (
88- client. get ( format ! ( "{}/gossip" , handle. url( ) ) ) ,
89- default_auth. as_ref ( ) ,
90- )
91- . send ( )
92- . await ?;
93-
94- let gossip = resp. json :: < Gossip > ( ) . await ?;
95-
96- Ok ( gossip
97- . members
98- . into_iter ( )
99- . map ( |i| MemberInfo {
100- instance_id : i. instance_id ,
101- time_stamp : i. time_stamp . timestamp ( ) ,
102- state : i. state ,
103- is_alive : i. is_alive ,
104- http_end_point : Endpoint {
105- host : i. external_http_ip ,
106- port : i. external_http_port as u32 ,
107- } ,
108- last_commit_position : i. last_commit_position ,
109- writer_checkpoint : i. writer_checkpoint ,
110- chaser_checkpoint : i. chaser_checkpoint ,
111- epoch_position : i. epoch_position ,
112- epoch_number : i. epoch_number ,
113- epoch_id : i. epoch_id ,
114- node_priority : i. node_priority ,
115- } )
116- . collect ( ) )
117- }
118-
119- #[ derive( Serialize , Deserialize , Debug ) ]
120- #[ serde( rename_all = "camelCase" ) ]
121- struct Gossip {
122- members : Vec < HttpMemberInfo > ,
123- }
124-
12573#[ derive( Debug , Clone ) ]
12674pub struct MemberInfo {
12775 pub instance_id : Uuid ,
@@ -138,31 +86,6 @@ pub struct MemberInfo {
13886 pub node_priority : i64 ,
13987}
14088
141- #[ derive( Deserialize , Serialize , Debug ) ]
142- #[ serde( rename_all = "camelCase" ) ]
143- pub struct HttpMemberInfo {
144- pub instance_id : Uuid ,
145- pub time_stamp : chrono:: DateTime < chrono:: Utc > ,
146- pub state : VNodeState ,
147- pub is_alive : bool ,
148- pub internal_tcp_ip : String ,
149- pub internal_tcp_port : u16 ,
150- pub internal_secure_tcp_port : u16 ,
151- pub external_tcp_ip : String ,
152- pub external_secure_tcp_port : u16 ,
153- #[ serde( rename = "httpEndPointIp" ) ]
154- pub external_http_ip : String ,
155- #[ serde( rename = "httpEndPointPort" ) ]
156- pub external_http_port : u16 ,
157- pub last_commit_position : i64 ,
158- pub writer_checkpoint : i64 ,
159- pub chaser_checkpoint : i64 ,
160- pub epoch_position : i64 ,
161- pub epoch_number : i64 ,
162- pub epoch_id : Uuid ,
163- pub node_priority : i64 ,
164- }
165-
16689#[ derive( Copy , Clone , Debug , Eq , PartialEq , Serialize , Deserialize ) ]
16790#[ serde( rename_all = "PascalCase" ) ]
16891pub enum VNodeState {
0 commit comments