feat(zookeeper): add agent client browsing and node management
This commit is contained in:
1 parent
a0df43c391
commit
0effda91b3
65 files changed
+2037
-420
No files matched your search
@@ -309,6 +309,8 @@ pub enum DatabaseType {
|
||||
Xugu,
|
||||
Iotdb,
|
||||
Etcd,
|
||||
#[serde(rename = "zookeeper")]
|
||||
ZooKeeper,
|
||||
Nacos,
|
||||
#[serde(rename = "iris")]
|
||||
Iris,
|
||||
@@ -789,6 +791,9 @@ impl ConnectionConfig {
|
||||
DatabaseType::Etcd => {
|
||||
format!("etcd://{host}:{port}")
|
||||
}
|
||||
DatabaseType::ZooKeeper => {
|
||||
format!("zookeeper://{host}:{port}")
|
||||
}
|
||||
DatabaseType::Iris => format!("iris://{host}:{port}{db_part}"),
|
||||
DatabaseType::InfluxDb => {
|
||||
let scheme = if self.ssl { "https" } else { "http" };
|
||||
@@ -991,6 +996,13 @@ impl ConnectionConfig {
|
||||
format!("etcd://{}:{}@{host}:{port}", username, password)
|
||||
}
|
||||
}
|
||||
DatabaseType::ZooKeeper => {
|
||||
if self.username.is_empty() {
|
||||
format!("zookeeper://{host}:{port}")
|
||||
} else {
|
||||
format!("zookeeper://{}:{}@{host}:{port}", username, password)
|
||||
}
|
||||
}
|
||||
DatabaseType::Iris => {
|
||||
format!("iris://{}:{}@{host}:{port}{db_part}", username, password)
|
||||
}
|
||||
@@ -1571,6 +1583,27 @@ mod tests {
|
||||
config
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn zookeeper_database_type_uses_stable_wire_name() {
|
||||
assert_eq!(serde_json::to_string(&DatabaseType::ZooKeeper).unwrap(), "\"zookeeper\"");
|
||||
assert_eq!(serde_json::from_str::<DatabaseType>("\"zookeeper\"").unwrap(), DatabaseType::ZooKeeper);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn zookeeper_connection_url_uses_zookeeper_scheme() {
|
||||
let mut config = mysql_config("", "", None);
|
||||
config.db_type = DatabaseType::ZooKeeper;
|
||||
config.host = "zk.local".to_string();
|
||||
config.port = 2181;
|
||||
|
||||
assert_eq!(config.connection_url_with_host("zk.local", 2181), "zookeeper://zk.local:2181");
|
||||
|
||||
config.username = "digest".to_string();
|
||||
config.password = "secret".to_string();
|
||||
|
||||
assert_eq!(config.connection_url_with_host("zk.local", 2181), "zookeeper://digest:secret@zk.local:2181");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn legacy_single_ssh_config_migrates_to_transport_layer() {
|
||||
let config: ConnectionConfig = serde_json::from_value(serde_json::json!({
|
||||
|
||||
Reference in new issue
Block a user