north_common/registry/
service_instance.rs1use crate::registry::service_instance_state::ServiceInstanceState;
2use crate::registry::service_status_constants::ServiceStatus;
3use std::collections::HashMap;
4
5#[derive(Default, Clone)]
6pub struct IService {
7 pub name: String,
8 pub id: String,
9 pub port: u32,
10
11 pub region: Option<String>,
12 pub zone: Option<String>,
13
14 pub host: String,
15 pub secure: bool,
16 pub metadata: Option<HashMap<String, String>>,
17 pub tag: Option<Vec<String>>,
18 pub state: ServiceInstanceState,
19}
20
21#[derive(Default, Clone)]
23pub struct ServiceInstanceOptions {
24 pub instance_id: String,
26
27 pub node_id: Option<String>,
29
30 pub service_id: String,
32
33 pub host: String,
35
36 pub status: ServiceStatus,
38
39 pub tags: Option<Vec<String>>,
41
42 pub port: u32,
44
45 pub secure: bool,
47
48 pub state: Option<ServiceInstanceState>,
50
51 pub metadata: Option<HashMap<String, String>>,
53}
54
55pub trait ServiceInstance {
58 fn get_instance_id(&self) -> String;
60
61 fn get_service_id(&self) -> String;
63
64 fn get_host(&self) -> String;
66
67 fn get_port(&self) -> u32;
69
70 fn is_secure(&self) -> bool;
72
73 fn get_uri(&self) -> String;
75
76 fn get_scheme(&self) -> String;
78
79 fn get_metadata(&self) -> HashMap<String, String>;
81
82 fn get_tags(&self) -> Vec<String>;
84
85 fn get_status(&self) -> String;
87
88 fn get_node_id(&self) -> String;
90
91 fn get_state(self) -> ServiceInstanceState;
93}