1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
use jvm_serializable::java::io::*;
use multimap::MultiMap;
use serde::{Deserialize, Serialize};
use std::collections::hash_map::RandomState;
use std::sync::{Arc, Mutex, RwLock};
#[jvm_object(io.vertx.core.net.impl.ServerID,5636540499169644934)]
pub struct ServerID {
pub port: i32,
pub host: String,
}
#[jvm_object(io.vertx.core.eventbus.impl.clustered.ClusterNodeInfo,1)]
pub struct ClusterNodeInfo {
pub nodeId: String,
pub serverID: ServerID,
}
pub trait ClusterManager: Send {
fn add_sub(&self, address: String);
fn set_cluster_node_info(&mut self, node: ClusterNodeInfo);
fn get_node_id(&self) -> String;
fn get_nodes(&self) -> Vec<String>;
fn get_ha_infos(&self) -> Arc<Mutex<Vec<ClusterNodeInfo>>>;
fn get_subs(&self) -> Arc<RwLock<MultiMap<String, ClusterNodeInfo>>>;
fn join(&mut self);
fn leave(&self);
fn next(&self, len: usize) -> usize;
}
pub struct NoClusterManager;
impl ClusterManager for NoClusterManager {
fn add_sub(&self, _address: String) {
unimplemented!()
}
fn set_cluster_node_info(&mut self, _node: ClusterNodeInfo) {
unimplemented!()
}
fn get_node_id(&self) -> String {
unimplemented!()
}
fn get_nodes(&self) -> Vec<String> {
unimplemented!()
}
fn get_ha_infos(&self) -> Arc<Mutex<Vec<ClusterNodeInfo>>> {
unimplemented!()
}
fn get_subs(&self) -> Arc<RwLock<MultiMap<String, ClusterNodeInfo, RandomState>>> {
unimplemented!()
}
fn join(&mut self) {
unimplemented!()
}
fn leave(&self) {
unimplemented!()
}
fn next(&self, _len: usize) -> usize {
unimplemented!()
}
}