pub struct BackupTemplateRenderingService { /* private fields */ }Expand description
Service for rendering backup configuration templates
This service encapsulates the logic for rendering backup configurations, including:
- Converting domain
DatabaseConfigto templateBackupDatabaseConfig - Building
BackupContextwith schedule information - Conditional rendering (only when backup is configured)
Implementations§
Source§impl BackupTemplateRenderingService
impl BackupTemplateRenderingService
Sourcepub fn from_paths(templates_dir: PathBuf, build_dir: PathBuf) -> Self
pub fn from_paths(templates_dir: PathBuf, build_dir: PathBuf) -> Self
Create a new service with explicit dependencies
§Arguments
templates_dir- Directory containing template source filesbuild_dir- Directory where rendered templates will be written
Sourcepub async fn render(
&self,
backup_config: Option<&BackupConfig>,
database_config: &DatabaseConfig,
created_at: DateTime<Utc>,
) -> Result<Option<PathBuf>, BackupTemplateRenderingServiceError>
pub async fn render( &self, backup_config: Option<&BackupConfig>, database_config: &DatabaseConfig, created_at: DateTime<Utc>, ) -> Result<Option<PathBuf>, BackupTemplateRenderingServiceError>
Render backup templates if backup is configured
This method converts the domain database configuration to the backup
format and renders the backup configuration templates. Returns None
if backup is not configured.
§Arguments
backup_config- Optional backup configurationdatabase_config- Tracker database configurationcreated_at- Environment creation timestamp
§Returns
Some(PathBuf) with path to the rendered backup build directory if
backup is configured, or None if backup should not be deployed.
§Errors
Returns error if template rendering fails
Auto Trait Implementations§
impl Freeze for BackupTemplateRenderingService
impl RefUnwindSafe for BackupTemplateRenderingService
impl Send for BackupTemplateRenderingService
impl Sync for BackupTemplateRenderingService
impl Unpin for BackupTemplateRenderingService
impl UnsafeUnpin for BackupTemplateRenderingService
impl UnwindSafe for BackupTemplateRenderingService
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> 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>
Converts
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>
Converts
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>
Wrap the input message
T in a tonic::Request