pub struct ServiceManager {
pub naming_service: Arc<NamingService>,
pub service_instance: ServiceInstance,
pub service_name: String,
}Fields§
§naming_service: Arc<NamingService>§service_instance: ServiceInstance§service_name: StringImplementations§
Source§impl ServiceManager
impl ServiceManager
Sourcepub fn new(opt: ServeOptions) -> Result<Self, EzError>
pub fn new(opt: ServeOptions) -> Result<Self, EzError>
Examples found in repository?
examples/grpc_service.rs (line 10)
7fn main() -> Result<(), Box<dyn std::error::Error>> {
8 // TODO Start gRPC or HTTP service.
9
10 let manager = ServiceManager::new(ServeOptions::default())?;
11 if let Err(e) = manager.online() {
12 println!("online fail, caused by: {}", e);
13 std::process::exit(1);
14 };
15
16 std::thread::sleep(std::time::Duration::from_secs(30));
17 // TODO block Listen signal...
18
19 // Go offline before the gRPC or HTTP service shuts down
20 manager.offline()?;
21
22 // TODO Close gRPC or HTTP service.
23 Ok(())
24}Sourcepub fn online(&self) -> Result<(), EzError>
pub fn online(&self) -> Result<(), EzError>
Examples found in repository?
examples/grpc_service.rs (line 11)
7fn main() -> Result<(), Box<dyn std::error::Error>> {
8 // TODO Start gRPC or HTTP service.
9
10 let manager = ServiceManager::new(ServeOptions::default())?;
11 if let Err(e) = manager.online() {
12 println!("online fail, caused by: {}", e);
13 std::process::exit(1);
14 };
15
16 std::thread::sleep(std::time::Duration::from_secs(30));
17 // TODO block Listen signal...
18
19 // Go offline before the gRPC or HTTP service shuts down
20 manager.offline()?;
21
22 // TODO Close gRPC or HTTP service.
23 Ok(())
24}Sourcepub fn offline(&self) -> Result<(), EzError>
pub fn offline(&self) -> Result<(), EzError>
Examples found in repository?
examples/grpc_service.rs (line 20)
7fn main() -> Result<(), Box<dyn std::error::Error>> {
8 // TODO Start gRPC or HTTP service.
9
10 let manager = ServiceManager::new(ServeOptions::default())?;
11 if let Err(e) = manager.online() {
12 println!("online fail, caused by: {}", e);
13 std::process::exit(1);
14 };
15
16 std::thread::sleep(std::time::Duration::from_secs(30));
17 // TODO block Listen signal...
18
19 // Go offline before the gRPC or HTTP service shuts down
20 manager.offline()?;
21
22 // TODO Close gRPC or HTTP service.
23 Ok(())
24}Trait Implementations§
Source§impl Clone for ServiceManager
impl Clone for ServiceManager
Source§fn clone(&self) -> ServiceManager
fn clone(&self) -> ServiceManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ServiceManager
impl !RefUnwindSafe for ServiceManager
impl Send for ServiceManager
impl Sync for ServiceManager
impl Unpin for ServiceManager
impl !UnwindSafe for ServiceManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request