pub struct SshConnectionConfig {
pub connect_timeout_secs: u32,
pub max_retry_attempts: u32,
pub retry_interval_secs: u32,
pub retry_log_frequency: u32,
}Expand description
SSH connection behavior configuration
Groups all connection-related parameters (timeouts, retries, logging) separately from authentication credentials and target address.
This type encapsulates connection behavior settings that affect how SSH connections are established and retried, distinct from authentication credentials and the target host address.
§Examples
use torrust_tracker_deployer_lib::adapters::ssh::SshConnectionConfig;
// Use default configuration
let config = SshConnectionConfig::default();
// Create custom configuration for fast testing
let fast_config = SshConnectionConfig::new(1, 5, 1, 2);
// Create custom configuration for slow networks
let slow_config = SshConnectionConfig::new(30, 20, 6, 3);Fields§
§connect_timeout_secs: u32SSH connection timeout in seconds
max_retry_attempts: u32Maximum number of connection retry attempts
retry_interval_secs: u32Seconds to wait between retry attempts
retry_log_frequency: u32Log progress every N retry attempts
Implementations§
Source§impl SshConnectionConfig
impl SshConnectionConfig
Sourcepub fn new(
connect_timeout_secs: u32,
max_retry_attempts: u32,
retry_interval_secs: u32,
retry_log_frequency: u32,
) -> Self
pub fn new( connect_timeout_secs: u32, max_retry_attempts: u32, retry_interval_secs: u32, retry_log_frequency: u32, ) -> Self
Create a new connection configuration with custom values
§Arguments
connect_timeout_secs- SSH connection timeout in secondsmax_retry_attempts- Maximum number of connection retry attemptsretry_interval_secs- Seconds to wait between retry attemptsretry_log_frequency- Log progress every N retry attempts
§Examples
use torrust_tracker_deployer_lib::adapters::ssh::SshConnectionConfig;
// Fast configuration for testing
let fast = SshConnectionConfig::new(1, 5, 1, 2);
// Slow configuration for unreliable networks
let slow = SshConnectionConfig::new(30, 20, 6, 3);Sourcepub fn total_timeout_secs(&self) -> u32
pub fn total_timeout_secs(&self) -> u32
Calculate total wait time in seconds (max_retry_attempts × retry_interval_secs)
Returns the maximum time that will be spent waiting for SSH connectivity if all retry attempts are exhausted.
§Examples
use torrust_tracker_deployer_lib::adapters::ssh::SshConnectionConfig;
let config = SshConnectionConfig::default();
assert_eq!(config.total_timeout_secs(), 300); // 60 attempts × 5 secondsTrait Implementations§
Source§impl Clone for SshConnectionConfig
impl Clone for SshConnectionConfig
Source§impl Debug for SshConnectionConfig
impl Debug for SshConnectionConfig
Source§impl Default for SshConnectionConfig
impl Default for SshConnectionConfig
Source§fn default() -> Self
fn default() -> Self
Default connection configuration (production settings)
Uses constants defined at module level:
- Connection timeout:
DEFAULT_CONNECT_TIMEOUT_SECS(5 seconds) - Max retry attempts:
DEFAULT_MAX_RETRY_ATTEMPTS(60) - Retry interval:
DEFAULT_RETRY_INTERVAL_SECS(5 seconds) - Retry log frequency:
DEFAULT_RETRY_LOG_FREQUENCY(every 5 attempts) - Total wait time: 60 × 5 = 300 seconds
Auto Trait Implementations§
impl Freeze for SshConnectionConfig
impl RefUnwindSafe for SshConnectionConfig
impl Send for SshConnectionConfig
impl Sync for SshConnectionConfig
impl Unpin for SshConnectionConfig
impl UnsafeUnpin for SshConnectionConfig
impl UnwindSafe for SshConnectionConfig
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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>
T in a tonic::Request