forked from metalbear-co/mirrord
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Middle of refactoring: adding a new builder-ish struct to unify with/…
…without operator targeting in cli.
- Loading branch information
Showing
3 changed files
with
299 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use mirrord_analytics::Reporter; | ||
use mirrord_config::LayerConfig; | ||
use mirrord_operator::client::OperatorApi; | ||
use mirrord_progress::Progress; | ||
|
||
use crate::CliError; | ||
|
||
pub(super) struct OperatorConnection<'a, P, R> | ||
where | ||
P: Progress, | ||
R: Reporter, | ||
{ | ||
config: &'a LayerConfig, | ||
progress: &'a P, | ||
analytics: &'a mut R, | ||
} | ||
|
||
impl<'a, P, R> OperatorConnection<'a, P, R> | ||
where | ||
P: Progress, | ||
R: Reporter, | ||
{ | ||
pub(super) fn new( | ||
config: &'a LayerConfig, | ||
progress: &'a P, | ||
analytics: &'a mut R, | ||
) -> Option<Self> { | ||
let mut operator_subtask = progress.subtask("checking operator"); | ||
if config.operator == Some(false) { | ||
operator_subtask.success(Some("operator disabled")); | ||
None | ||
} else { | ||
Some(Self { | ||
config, | ||
progress, | ||
analytics, | ||
}) | ||
} | ||
} | ||
|
||
pub(super) fn create_api(&mut self) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters