@@ -91,7 +91,92 @@ def show_linter_violations(
9191 """Prints all linter violations depending on their severity"""
9292
9393
94- class Console (LinterConsole , abc .ABC ):
94+ class ExporterConsole (abc .ABC ):
95+ @abc .abstractmethod
96+ def start_state_export (
97+ self ,
98+ output_file : Path ,
99+ gateway : t .Optional [str ] = None ,
100+ state_connection_config : t .Optional [ConnectionConfig ] = None ,
101+ environment_names : t .Optional [t .List [str ]] = None ,
102+ local_only : bool = False ,
103+ confirm : bool = True ,
104+ ) -> bool :
105+ """State a state export"""
106+
107+ @abc .abstractmethod
108+ def update_state_export_progress (
109+ self ,
110+ version_count : t .Optional [int ] = None ,
111+ versions_complete : bool = False ,
112+ snapshot_count : t .Optional [int ] = None ,
113+ snapshots_complete : bool = False ,
114+ environment_count : t .Optional [int ] = None ,
115+ environments_complete : bool = False ,
116+ ) -> None :
117+ """Update the state export progress"""
118+
119+ @abc .abstractmethod
120+ def stop_state_export (self , success : bool , output_file : Path ) -> None :
121+ """Finish a state export"""
122+
123+
124+ class StateImporterConsole (abc .ABC ):
125+ @abc .abstractmethod
126+ def start_state_import (
127+ self ,
128+ input_file : Path ,
129+ gateway : str ,
130+ state_connection_config : ConnectionConfig ,
131+ clear : bool = False ,
132+ confirm : bool = True ,
133+ ) -> bool :
134+ """Start a state import"""
135+
136+ @abc .abstractmethod
137+ def update_state_import_progress (
138+ self ,
139+ timestamp : t .Optional [str ] = None ,
140+ state_file_version : t .Optional [int ] = None ,
141+ versions : t .Optional [Versions ] = None ,
142+ snapshot_count : t .Optional [int ] = None ,
143+ snapshots_complete : bool = False ,
144+ environment_count : t .Optional [int ] = None ,
145+ environments_complete : bool = False ,
146+ ) -> None :
147+ """Update the state import process"""
148+
149+ @abc .abstractmethod
150+ def stop_state_import (self , success : bool , input_file : Path ) -> None :
151+ """Finish a state import"""
152+
153+
154+ class JanitorConsole (abc .ABC ):
155+ @abc .abstractmethod
156+ def start_cleanup (self , ignore_ttl : bool ) -> bool :
157+ """Start a janitor / snapshot cleanup run.
158+
159+ Args:
160+ ignore_ttl: Indicates that the user wants to ignore the snapshot TTL and clean up everything not promoted to an environment
161+
162+ Returns:
163+ Whether or not the cleanup run should proceed
164+ """
165+
166+ @abc .abstractmethod
167+ def update_cleanup_progress (self , object_name : str ) -> None :
168+ """Update the snapshot cleanup progress."""
169+
170+ @abc .abstractmethod
171+ def stop_cleanup (self , success : bool = True ) -> None :
172+ """Indicates the janitor / snapshot cleanup run has ended
173+
174+ Args:
175+ success: Whether or not the cleanup completed successfully
176+ """
177+
178+
179+ class Console (LinterConsole , ExporterConsole , StateImporterConsole , JanitorConsole , abc .ABC ):
95180 """Abstract base class for defining classes used for displaying information to the user and also interact
96181 with them when their input is needed."""
97182
@@ -151,29 +236,6 @@ def update_creation_progress(self, snapshot: SnapshotInfoLike) -> None:
151236 def stop_creation_progress (self , success : bool = True ) -> None :
152237 """Stop the snapshot creation progress."""
153238
154- @abc .abstractmethod
155- def start_cleanup (self , ignore_ttl : bool ) -> bool :
156- """Start a janitor / snapshot cleanup run.
157-
158- Args:
159- ignore_ttl: Indicates that the user wants to ignore the snapshot TTL and clean up everything not promoted to an environment
160-
161- Returns:
162- Whether or not the cleanup run should proceed
163- """
164-
165- @abc .abstractmethod
166- def update_cleanup_progress (self , object_name : str ) -> None :
167- """Update the snapshot cleanup progress."""
168-
169- @abc .abstractmethod
170- def stop_cleanup (self , success : bool = True ) -> None :
171- """Indicates the janitor / snapshot cleanup run has ended
172-
173- Args:
174- success: Whether or not the cleanup completed successfully
175- """
176-
177239 @abc .abstractmethod
178240 def start_promotion_progress (
179241 self ,
@@ -219,62 +281,6 @@ def update_env_migration_progress(self, num_tasks: int) -> None:
219281 def stop_env_migration_progress (self , success : bool = True ) -> None :
220282 """Stop the environment migration progress."""
221283
222- @abc .abstractmethod
223- def start_state_export (
224- self ,
225- output_file : Path ,
226- gateway : t .Optional [str ] = None ,
227- state_connection_config : t .Optional [ConnectionConfig ] = None ,
228- environment_names : t .Optional [t .List [str ]] = None ,
229- local_only : bool = False ,
230- confirm : bool = True ,
231- ) -> bool :
232- """State a state export"""
233-
234- @abc .abstractmethod
235- def update_state_export_progress (
236- self ,
237- version_count : t .Optional [int ] = None ,
238- versions_complete : bool = False ,
239- snapshot_count : t .Optional [int ] = None ,
240- snapshots_complete : bool = False ,
241- environment_count : t .Optional [int ] = None ,
242- environments_complete : bool = False ,
243- ) -> None :
244- """Update the state export progress"""
245-
246- @abc .abstractmethod
247- def stop_state_export (self , success : bool , output_file : Path ) -> None :
248- """Finish a state export"""
249-
250- @abc .abstractmethod
251- def start_state_import (
252- self ,
253- input_file : Path ,
254- gateway : str ,
255- state_connection_config : ConnectionConfig ,
256- clear : bool = False ,
257- confirm : bool = True ,
258- ) -> bool :
259- """Start a state import"""
260-
261- @abc .abstractmethod
262- def update_state_import_progress (
263- self ,
264- timestamp : t .Optional [str ] = None ,
265- state_file_version : t .Optional [int ] = None ,
266- versions : t .Optional [Versions ] = None ,
267- snapshot_count : t .Optional [int ] = None ,
268- snapshots_complete : bool = False ,
269- environment_count : t .Optional [int ] = None ,
270- environments_complete : bool = False ,
271- ) -> None :
272- """Update the state import process"""
273-
274- @abc .abstractmethod
275- def stop_state_import (self , success : bool , input_file : Path ) -> None :
276- """Finish a state import"""
277-
278284 @abc .abstractmethod
279285 def show_model_difference_summary (
280286 self ,
@@ -390,10 +396,6 @@ def show_row_diff(
390396 def print_environments (self , environments_summary : t .Dict [str , int ]) -> None :
391397 """Prints all environment names along with expiry datetime."""
392398
393- @abc .abstractmethod
394- def print_connection_config (self , config : ConnectionConfig , title : str = "Connection" ) -> None :
395- """Print connection config information"""
396-
397399 def _limit_model_names (self , tree : Tree , verbosity : Verbosity = Verbosity .DEFAULT ) -> Tree :
398400 """Trim long indirectly modified model lists below threshold."""
399401 modified_length = len (tree .children )
0 commit comments