Mountain/Binary/Service/VineStart.rs
1//! # Vine Start Module
2//!
3//! Initializes and starts the Vine gRPC server.
4
5use log::{error, info};
6
7/// Starts the Vine gRPC server at the specified addresses.
8///
9/// # Arguments
10///
11/// * `ApplicationHandle` - The Tauri application handle
12/// * `PrimaryAddress` - The primary server address (e.g., "\\[::1\\]:50051")
13/// * `SecondaryAddress` - The secondary server address (e.g., "\\[::1\\]:50052")
14///
15/// # Returns
16///
17/// A `Result` indicating success or failure.
18///
19/// # Vine Server Functionality
20///
21/// The Vine gRPC server provides:
22/// - Inter-service communication infrastructure
23/// - gRPC method handling for various services
24/// - Multi-port support for different service types
25///
26/// # Addresses
27///
28/// - Primary: `[::1]:50051` - Main service communication
29/// - Secondary: `[::1]:50052` - Auxiliary service communication
30///
31/// # Errors
32///
33/// Returns an error if Vine server initialization fails.
34pub async fn VineStart(
35 ApplicationHandle:tauri::AppHandle,
36 PrimaryAddress:String,
37 SecondaryAddress:String,
38) -> Result<(), String> {
39 match crate::Vine::Server::Initialize::Initialize(ApplicationHandle, PrimaryAddress, SecondaryAddress) {
40 Ok(()) => {
41 info!("[Vine] [Start] Vine gRPC server started successfully.");
42 Ok(())
43 },
44 Err(e) => {
45 error!("[Vine] [Start] Failed to start: {}", e);
46 Err(format!("Failed to start Vine gRPC server: {}", e))
47 },
48 }
49}