orionis 0.613.0__py3-none-any.whl → 0.615.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orionis/container/providers/service_provider.py +31 -9
- orionis/foundation/application.py +100 -61
- orionis/foundation/exceptions/application.py +51 -4
- orionis/foundation/providers/catch_provider.py +11 -32
- orionis/foundation/providers/cli_request_provider.py +13 -28
- orionis/foundation/providers/console_provider.py +14 -48
- orionis/foundation/providers/directory_provider.py +13 -39
- orionis/foundation/providers/dumper_provider.py +13 -63
- orionis/foundation/providers/executor_provider.py +13 -62
- orionis/foundation/providers/inspirational_provider.py +12 -65
- orionis/foundation/providers/logger_provider.py +15 -58
- orionis/foundation/providers/performance_counter_provider.py +13 -39
- orionis/foundation/providers/progress_bar_provider.py +11 -66
- orionis/foundation/providers/reactor_provider.py +14 -65
- orionis/foundation/providers/scheduler_provider.py +13 -35
- orionis/foundation/providers/testing_provider.py +9 -55
- orionis/foundation/providers/workers_provider.py +17 -76
- orionis/metadata/framework.py +1 -1
- orionis/support/facades/application.py +8 -10
- orionis/support/facades/console.py +8 -9
- orionis/support/facades/directory.py +9 -8
- orionis/support/facades/dumper.py +7 -8
- orionis/support/facades/executor.py +10 -11
- orionis/support/facades/inspire.py +9 -10
- orionis/support/facades/logger.py +10 -10
- orionis/support/facades/performance_counter.py +9 -8
- orionis/support/facades/progress_bar.py +10 -8
- orionis/support/facades/reactor.py +9 -9
- orionis/support/facades/testing.py +8 -9
- orionis/support/facades/workers.py +8 -8
- {orionis-0.613.0.dist-info → orionis-0.615.0.dist-info}/METADATA +1 -1
- {orionis-0.613.0.dist-info → orionis-0.615.0.dist-info}/RECORD +35 -36
- orionis/foundation/contracts/config.py +0 -31
- {orionis-0.613.0.dist-info → orionis-0.615.0.dist-info}/WHEEL +0 -0
- {orionis-0.613.0.dist-info → orionis-0.615.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.613.0.dist-info → orionis-0.615.0.dist-info}/top_level.txt +0 -0
|
@@ -3,77 +3,27 @@ from orionis.console.contracts.debug import IDebug
|
|
|
3
3
|
from orionis.container.providers.service_provider import ServiceProvider
|
|
4
4
|
|
|
5
5
|
class DumperProvider(ServiceProvider):
|
|
6
|
-
"""
|
|
7
|
-
Service provider for registering debug and dumper services in the application container.
|
|
8
|
-
|
|
9
|
-
This provider is responsible for binding debug-related interfaces to their concrete
|
|
10
|
-
implementations within the application's dependency injection container. It enables
|
|
11
|
-
comprehensive debug message printing, error reporting, console diagnostics, and
|
|
12
|
-
data dumping functionality throughout the application.
|
|
13
|
-
|
|
14
|
-
The provider follows the service provider pattern, ensuring that debug services
|
|
15
|
-
are properly registered and available for dependency injection across all
|
|
16
|
-
application components that require debugging capabilities.
|
|
17
|
-
|
|
18
|
-
Attributes
|
|
19
|
-
----------
|
|
20
|
-
app : Application
|
|
21
|
-
The application container instance used for service registration and
|
|
22
|
-
dependency injection management.
|
|
23
|
-
|
|
24
|
-
Methods
|
|
25
|
-
-------
|
|
26
|
-
register() -> None
|
|
27
|
-
Register the debug service interface binding in the application container.
|
|
28
|
-
boot() -> None
|
|
29
|
-
Perform any post-registration initialization tasks for the dumper services.
|
|
30
|
-
|
|
31
|
-
Notes
|
|
32
|
-
-----
|
|
33
|
-
This provider registers services as transient, meaning new instances are created
|
|
34
|
-
for each resolution request, ensuring isolated debugging contexts.
|
|
35
|
-
"""
|
|
36
6
|
|
|
37
7
|
def register(self) -> None:
|
|
38
8
|
"""
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
This method binds the IDebug interface to its concrete implementation (Debug class)
|
|
42
|
-
in the application's dependency injection container. The service is registered as
|
|
43
|
-
transient, meaning a new instance will be created each time it is requested.
|
|
44
|
-
The service is also assigned an alias for easy retrieval throughout the application.
|
|
45
|
-
|
|
46
|
-
The registration enables the application to resolve debug-related dependencies
|
|
47
|
-
and provides access to debugging, error reporting, and console diagnostic
|
|
48
|
-
functionality via the registered alias.
|
|
49
|
-
|
|
50
|
-
Returns
|
|
51
|
-
-------
|
|
52
|
-
None
|
|
53
|
-
This method does not return any value. It performs side effects by
|
|
54
|
-
modifying the application container's service registry.
|
|
55
|
-
"""
|
|
56
|
-
|
|
57
|
-
self.app.transient(IDebug, Debug, alias=f"x-{IDebug.__module__}.{IDebug.__name__}")
|
|
58
|
-
|
|
59
|
-
def boot(self) -> None:
|
|
60
|
-
"""
|
|
61
|
-
Perform post-registration initialization for the dumper service provider.
|
|
9
|
+
Registers the debug service in the application container.
|
|
62
10
|
|
|
63
|
-
This method
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
11
|
+
This method binds the `IDebug` interface to its concrete implementation, the `Debug` class,
|
|
12
|
+
within the application's dependency injection container. The service is registered as
|
|
13
|
+
transient, ensuring that a new instance is created each time it is requested. Additionally,
|
|
14
|
+
an alias is assigned to the service for convenient retrieval throughout the application.
|
|
67
15
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
registration is sufficient and complete during the register() phase.
|
|
16
|
+
This registration enables the application to resolve dependencies related to debugging,
|
|
17
|
+
error reporting, and console diagnostics by referencing the interface or its alias.
|
|
71
18
|
|
|
72
19
|
Returns
|
|
73
20
|
-------
|
|
74
21
|
None
|
|
75
|
-
This method does not return any value
|
|
76
|
-
|
|
22
|
+
This method does not return any value. It performs side effects by modifying
|
|
23
|
+
the application's service registry.
|
|
77
24
|
"""
|
|
78
25
|
|
|
79
|
-
|
|
26
|
+
# Register the Debug service as a transient binding for the IDebug interface.
|
|
27
|
+
# A new instance of Debug will be created each time it is requested.
|
|
28
|
+
# The alias allows for easy retrieval of the service elsewhere in the application.
|
|
29
|
+
self.app.transient(IDebug, Debug, alias=f"x-orionis.console.contracts.debug.IDebug")
|
|
@@ -3,49 +3,21 @@ from orionis.console.output.executor import Executor
|
|
|
3
3
|
from orionis.container.providers.service_provider import ServiceProvider
|
|
4
4
|
|
|
5
5
|
class ConsoleExecuteProvider(ServiceProvider):
|
|
6
|
-
"""
|
|
7
|
-
Console executor service provider for dependency injection container registration.
|
|
8
|
-
|
|
9
|
-
This service provider is responsible for registering and configuring console executor
|
|
10
|
-
services within the application's dependency injection container. It binds the
|
|
11
|
-
IExecutor interface to its concrete Executor implementation, enabling standardized
|
|
12
|
-
console operations throughout the application including command execution, output
|
|
13
|
-
formatting, and process management.
|
|
14
|
-
|
|
15
|
-
The provider follows the standard service provider lifecycle pattern, implementing
|
|
16
|
-
both registration and boot phases to ensure proper service initialization and
|
|
17
|
-
configuration within the application container.
|
|
18
|
-
|
|
19
|
-
Attributes
|
|
20
|
-
----------
|
|
21
|
-
app : Container
|
|
22
|
-
The application's dependency injection container instance used for service
|
|
23
|
-
registration and binding management.
|
|
24
|
-
|
|
25
|
-
Methods
|
|
26
|
-
-------
|
|
27
|
-
register() -> None
|
|
28
|
-
Registers the console executor service binding in the container.
|
|
29
|
-
boot() -> None
|
|
30
|
-
Performs post-registration initialization and configuration tasks.
|
|
31
|
-
|
|
32
|
-
Notes
|
|
33
|
-
-----
|
|
34
|
-
This provider registers services as transient bindings to ensure isolated
|
|
35
|
-
execution contexts for each console operation request.
|
|
36
|
-
"""
|
|
37
6
|
|
|
38
7
|
def register(self) -> None:
|
|
39
8
|
"""
|
|
40
|
-
|
|
9
|
+
Registers the console executor service within the application container.
|
|
41
10
|
|
|
42
|
-
This method binds the IExecutor interface to its concrete Executor implementation
|
|
43
|
-
as a transient service.
|
|
44
|
-
|
|
45
|
-
|
|
11
|
+
This method binds the `IExecutor` interface to its concrete `Executor` implementation
|
|
12
|
+
as a transient service. Each time the service is requested from the container, a new
|
|
13
|
+
instance of `Executor` is created, ensuring isolated execution contexts for console
|
|
14
|
+
operations. The service is registered with the alias
|
|
15
|
+
`"x-orionis.console.contracts.executor.IExecutor"` for convenient retrieval and
|
|
16
|
+
identification within the dependency injection container.
|
|
46
17
|
|
|
47
|
-
|
|
48
|
-
|
|
18
|
+
Parameters
|
|
19
|
+
----------
|
|
20
|
+
None
|
|
49
21
|
|
|
50
22
|
Returns
|
|
51
23
|
-------
|
|
@@ -54,27 +26,6 @@ class ConsoleExecuteProvider(ServiceProvider):
|
|
|
54
26
|
registering the executor service binding in the application container.
|
|
55
27
|
"""
|
|
56
28
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"""
|
|
61
|
-
Perform post-registration initialization for the console executor provider.
|
|
62
|
-
|
|
63
|
-
This method is called after the service registration phase and provides
|
|
64
|
-
an opportunity to perform additional setup, configuration, or initialization
|
|
65
|
-
tasks that depend on the registered services. It follows the service provider
|
|
66
|
-
lifecycle pattern where registration occurs first, followed by booting.
|
|
67
|
-
|
|
68
|
-
Currently, this implementation serves as a placeholder and does not perform
|
|
69
|
-
any specific initialization tasks. Subclasses or future implementations may
|
|
70
|
-
override this method to add custom boot logic such as service validation,
|
|
71
|
-
configuration setup, or dependent service initialization.
|
|
72
|
-
|
|
73
|
-
Returns
|
|
74
|
-
-------
|
|
75
|
-
None
|
|
76
|
-
This method does not return any value. It performs initialization
|
|
77
|
-
side effects only.
|
|
78
|
-
"""
|
|
79
|
-
|
|
80
|
-
pass
|
|
29
|
+
# Bind the IExecutor interface to the Executor implementation as a transient service.
|
|
30
|
+
# This ensures a new Executor instance is created on each request.
|
|
31
|
+
self.app.transient(IExecutor, Executor, alias="x-orionis.console.contracts.executor.IExecutor")
|
|
@@ -3,79 +3,26 @@ from orionis.services.inspirational.contracts.inspire import IInspire
|
|
|
3
3
|
from orionis.services.inspirational.inspire import Inspire
|
|
4
4
|
|
|
5
5
|
class InspirationalProvider(ServiceProvider):
|
|
6
|
-
"""
|
|
7
|
-
Service provider for registering inspirational services in the application container.
|
|
8
|
-
|
|
9
|
-
The InspirationalProvider handles the registration and configuration of inspirational
|
|
10
|
-
services within the application's dependency injection container. This provider follows
|
|
11
|
-
the service provider pattern, ensuring that inspirational service implementations are
|
|
12
|
-
properly bound to their corresponding contracts and made available for dependency
|
|
13
|
-
injection throughout the application lifecycle.
|
|
14
|
-
|
|
15
|
-
The provider manages the binding of the IInspire contract to its concrete Inspire
|
|
16
|
-
implementation, configuring it as a transient service to ensure fresh instances
|
|
17
|
-
are created for each resolution request.
|
|
18
|
-
|
|
19
|
-
Attributes
|
|
20
|
-
----------
|
|
21
|
-
app : Application
|
|
22
|
-
The application container instance used for service registration and dependency
|
|
23
|
-
injection management.
|
|
24
|
-
|
|
25
|
-
Notes
|
|
26
|
-
-----
|
|
27
|
-
This provider inherits from ServiceProvider and implements the standard service
|
|
28
|
-
provider lifecycle methods (register and boot) to properly integrate inspirational
|
|
29
|
-
services into the application's service container architecture.
|
|
30
|
-
"""
|
|
31
6
|
|
|
32
7
|
def register(self) -> None:
|
|
33
8
|
"""
|
|
34
|
-
Registers the inspirational service in the application container.
|
|
35
|
-
|
|
36
|
-
This method binds the `IInspire` contract to its concrete implementation `Inspire`
|
|
37
|
-
as a transient service within the application's service container. Transient
|
|
38
|
-
services are created each time they are requested from the container, ensuring
|
|
39
|
-
fresh instances for each resolution. The service is also registered with an
|
|
40
|
-
alias to enable convenient resolution and identification throughout the application.
|
|
41
|
-
|
|
42
|
-
The registration establishes the dependency injection mapping that allows other
|
|
43
|
-
parts of the application to receive the inspirational service implementation
|
|
44
|
-
when requesting the `IInspire` interface.
|
|
45
|
-
|
|
46
|
-
Returns
|
|
47
|
-
-------
|
|
48
|
-
None
|
|
49
|
-
This method performs service registration as a side effect and does not
|
|
50
|
-
return any value.
|
|
51
|
-
"""
|
|
52
|
-
|
|
53
|
-
self.app.transient(IInspire, Inspire, alias=f"x-{IInspire.__module__}.{IInspire.__name__}")
|
|
54
|
-
|
|
55
|
-
def boot(self) -> None:
|
|
56
|
-
"""
|
|
57
|
-
Executes post-registration initialization for the inspirational service.
|
|
58
|
-
|
|
59
|
-
This method is called after all services have been registered in the
|
|
60
|
-
application container and provides an opportunity to perform any additional
|
|
61
|
-
setup, configuration, or initialization logic specific to the inspirational
|
|
62
|
-
service. It follows the service provider lifecycle pattern where registration
|
|
63
|
-
happens first, followed by booting for final setup tasks.
|
|
9
|
+
Registers the inspirational service as a transient binding in the application container.
|
|
64
10
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
to
|
|
11
|
+
This method binds the `IInspire` interface to its concrete implementation `Inspire`
|
|
12
|
+
as a transient service within the application's service container. Each time the
|
|
13
|
+
service is requested, a new instance of `Inspire` will be provided. The service is
|
|
14
|
+
also registered with a specific alias to facilitate convenient resolution and
|
|
15
|
+
identification throughout the application.
|
|
69
16
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
required by specific use cases.
|
|
17
|
+
This registration enables dependency injection, allowing other components to
|
|
18
|
+
receive an instance of `Inspire` whenever the `IInspire` contract is requested.
|
|
73
19
|
|
|
74
20
|
Returns
|
|
75
21
|
-------
|
|
76
22
|
None
|
|
77
|
-
This method does not return any value. It performs
|
|
78
|
-
operations as side effects only.
|
|
23
|
+
This method does not return any value. It performs service registration as a side effect.
|
|
79
24
|
"""
|
|
80
25
|
|
|
81
|
-
|
|
26
|
+
# Register the IInspire contract to the Inspire implementation as a transient service.
|
|
27
|
+
# Each resolution from the container will provide a new instance.
|
|
28
|
+
self.app.transient(IInspire, Inspire, alias="x-orionis.services.inspirational.contracts.inspire.IInspire")
|
|
@@ -3,42 +3,20 @@ from orionis.services.log.contracts.log_service import ILogger
|
|
|
3
3
|
from orionis.services.log.log_service import Logger
|
|
4
4
|
|
|
5
5
|
class LoggerProvider(ServiceProvider):
|
|
6
|
-
"""
|
|
7
|
-
Service provider for logging functionality within the Orionis framework.
|
|
8
|
-
|
|
9
|
-
The LoggerProvider is responsible for registering and configuring the logging
|
|
10
|
-
service implementation in the application's dependency injection container.
|
|
11
|
-
It binds the concrete Logger to the ILogger interface, enabling
|
|
12
|
-
application-wide access to structured logging capabilities.
|
|
13
|
-
|
|
14
|
-
This provider handles the initialization of the logging service with the
|
|
15
|
-
application's configuration and ensures proper registration under both the
|
|
16
|
-
interface contract and an internal framework alias for service resolution.
|
|
17
|
-
|
|
18
|
-
Attributes
|
|
19
|
-
----------
|
|
20
|
-
app : Application
|
|
21
|
-
The application container instance used for service registration and
|
|
22
|
-
configuration retrieval. Inherited from the base ServiceProvider class.
|
|
23
|
-
|
|
24
|
-
Notes
|
|
25
|
-
-----
|
|
26
|
-
This provider follows the two-phase initialization pattern:
|
|
27
|
-
- register(): Performs service binding and container registration
|
|
28
|
-
- boot(): Handles post-registration initialization and setup
|
|
29
|
-
"""
|
|
30
6
|
|
|
31
7
|
def register(self) -> None:
|
|
32
8
|
"""
|
|
33
|
-
|
|
9
|
+
Registers the Logger service implementation in the application container.
|
|
34
10
|
|
|
35
|
-
This method binds the `Logger`
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
11
|
+
This method binds the `Logger` class to the `ILogger` contract within the application's
|
|
12
|
+
dependency injection container. It retrieves the logging configuration from the application,
|
|
13
|
+
creates a `Logger` instance using this configuration, and registers it with an alias for
|
|
14
|
+
internal framework identification. This setup allows the logging service to be resolved
|
|
15
|
+
and used throughout the application via the container.
|
|
39
16
|
|
|
40
|
-
|
|
41
|
-
|
|
17
|
+
Parameters
|
|
18
|
+
----------
|
|
19
|
+
None
|
|
42
20
|
|
|
43
21
|
Returns
|
|
44
22
|
-------
|
|
@@ -47,33 +25,12 @@ class LoggerProvider(ServiceProvider):
|
|
|
47
25
|
as a side effect on the application container.
|
|
48
26
|
"""
|
|
49
27
|
|
|
50
|
-
# Retrieve logging configuration from application
|
|
28
|
+
# Retrieve the logging configuration from the application
|
|
51
29
|
logging_config = self.app.config('logging')
|
|
52
30
|
|
|
53
|
-
#
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
# Register the service instance in the container with interface binding and alias
|
|
57
|
-
self.app.instance(ILogger, logger_service, alias=f"x-{ILogger.__module__}.{ILogger.__name__}")
|
|
58
|
-
|
|
59
|
-
def boot(self) -> None:
|
|
60
|
-
"""
|
|
61
|
-
Perform post-registration initialization for the logging service.
|
|
62
|
-
|
|
63
|
-
This method is called after all service providers have been registered
|
|
64
|
-
and allows for any additional configuration, setup, or initialization
|
|
65
|
-
logic that depends on other services being available in the container.
|
|
66
|
-
|
|
67
|
-
Currently, this method serves as a placeholder and performs no operations,
|
|
68
|
-
but it can be extended to include logging service initialization tasks
|
|
69
|
-
such as setting up log handlers, configuring formatters, or establishing
|
|
70
|
-
connections to external logging systems.
|
|
71
|
-
|
|
72
|
-
Returns
|
|
73
|
-
-------
|
|
74
|
-
None
|
|
75
|
-
This method does not return any value. It performs initialization
|
|
76
|
-
operations as side effects during the application boot process.
|
|
77
|
-
"""
|
|
31
|
+
# Instantiate the Logger with the retrieved configuration
|
|
32
|
+
logger_instance = Logger(logging_config)
|
|
78
33
|
|
|
79
|
-
|
|
34
|
+
# Register the Logger instance in the application container,
|
|
35
|
+
# binding it to the ILogger contract and assigning an alias
|
|
36
|
+
self.app.instance(ILogger, logger_instance, alias="x-orionis.services.log.contracts.log_service.ILogger")
|
|
@@ -8,14 +8,14 @@ class PerformanceCounterProvider(ServiceProvider):
|
|
|
8
8
|
"""
|
|
9
9
|
Registers the performance counter service as a transient dependency in the application container.
|
|
10
10
|
|
|
11
|
-
This method binds the `IPerformanceCounter` interface
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
This method binds the `IPerformanceCounter` interface to the `PerformanceCounter` implementation
|
|
12
|
+
within the application's dependency injection container. The binding uses a transient lifetime,
|
|
13
|
+
ensuring that each resolution of the service provides a new instance of `PerformanceCounter`.
|
|
14
|
+
This is useful for scenarios where independent timing or measurement operations are required
|
|
15
|
+
across different parts of the application.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
An alias, `"x-orionis.support.performance.contracts.counter.IPerformanceCounter"`, is also
|
|
18
|
+
assigned to this binding, enabling alternative resolution or referencing of the service by name.
|
|
19
19
|
|
|
20
20
|
Parameters
|
|
21
21
|
----------
|
|
@@ -24,41 +24,15 @@ class PerformanceCounterProvider(ServiceProvider):
|
|
|
24
24
|
Returns
|
|
25
25
|
-------
|
|
26
26
|
None
|
|
27
|
-
This method performs service registration as a side effect
|
|
27
|
+
This method does not return any value. It performs service registration as a side effect.
|
|
28
28
|
|
|
29
29
|
Notes
|
|
30
30
|
-----
|
|
31
|
-
- The transient lifetime ensures
|
|
32
|
-
- The alias
|
|
31
|
+
- The transient lifetime ensures that each consumer receives a separate instance of the service.
|
|
32
|
+
- The alias allows for flexible service resolution by a specific name.
|
|
33
33
|
"""
|
|
34
34
|
|
|
35
35
|
# Register the IPerformanceCounter interface to the PerformanceCounter implementation
|
|
36
|
-
# with a transient lifetime
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
def boot(self) -> None:
|
|
40
|
-
"""
|
|
41
|
-
Performs initialization and configuration tasks for the performance counter provider during the application's bootstrapping phase.
|
|
42
|
-
|
|
43
|
-
This method is automatically invoked when the provider is loaded by the application. It is intended for setting up or registering
|
|
44
|
-
any performance counters or related resources required by the application. By default, this implementation does not perform any
|
|
45
|
-
actions, but it can be extended in subclasses to include custom initialization logic as needed.
|
|
46
|
-
|
|
47
|
-
Parameters
|
|
48
|
-
----------
|
|
49
|
-
None
|
|
50
|
-
|
|
51
|
-
Returns
|
|
52
|
-
-------
|
|
53
|
-
None
|
|
54
|
-
This method does not return any value. It executes initialization logic as a side effect.
|
|
55
|
-
|
|
56
|
-
Notes
|
|
57
|
-
-----
|
|
58
|
-
- Override this method in subclasses to implement custom bootstrapping behavior for performance counters.
|
|
59
|
-
- This method is part of the provider lifecycle and is called after service registration.
|
|
60
|
-
"""
|
|
61
|
-
|
|
62
|
-
# No initialization logic is required by default.
|
|
63
|
-
# Override this method in subclasses to perform custom setup.
|
|
64
|
-
pass
|
|
36
|
+
# with a transient lifetime. Each resolution yields a new instance.
|
|
37
|
+
# Assign an alias for alternative resolution by name.
|
|
38
|
+
self.app.transient(IPerformanceCounter, PerformanceCounter, alias="x-orionis.support.performance.contracts.counter.IPerformanceCounter")
|
|
@@ -3,73 +3,16 @@ from orionis.console.dynamic.progress_bar import ProgressBar
|
|
|
3
3
|
from orionis.container.providers.service_provider import ServiceProvider
|
|
4
4
|
|
|
5
5
|
class ProgressBarProvider(ServiceProvider):
|
|
6
|
-
"""
|
|
7
|
-
Service provider for dynamic progress bar functionality.
|
|
8
|
-
|
|
9
|
-
This provider is responsible for registering the dynamic progress bar service
|
|
10
|
-
within the application's dependency injection container. It binds the IProgressBar
|
|
11
|
-
interface to its concrete ProgressBar implementation, enabling the creation of
|
|
12
|
-
visual progress indicators for long-running operations in console applications.
|
|
13
|
-
|
|
14
|
-
The provider follows the transient lifetime pattern, ensuring that each request
|
|
15
|
-
for a progress bar service creates a new, independent instance. This approach
|
|
16
|
-
prevents state conflicts when multiple progress bars are used simultaneously
|
|
17
|
-
across different parts of the application.
|
|
18
|
-
|
|
19
|
-
Parameters
|
|
20
|
-
----------
|
|
21
|
-
None
|
|
22
|
-
This class does not accept initialization parameters beyond those
|
|
23
|
-
inherited from the base ServiceProvider class.
|
|
24
|
-
|
|
25
|
-
Returns
|
|
26
|
-
-------
|
|
27
|
-
None
|
|
28
|
-
Service providers do not return values as they are used for
|
|
29
|
-
registration and configuration purposes only.
|
|
30
|
-
|
|
31
|
-
Notes
|
|
32
|
-
-----
|
|
33
|
-
The progress bar service is registered with the alias 'x-orionis.console.dynamic.progress_bar'
|
|
34
|
-
to enable specific identification and retrieval from the container when needed.
|
|
35
|
-
This provider requires the orionis container framework to be properly initialized
|
|
36
|
-
before registration can occur.
|
|
37
|
-
"""
|
|
38
6
|
|
|
39
7
|
def register(self) -> None:
|
|
40
8
|
"""
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
This method binds the IProgressBar interface to the ProgressBar concrete
|
|
44
|
-
implementation using transient lifetime management. The service is registered
|
|
45
|
-
with a specific alias for identification and retrieval within the container.
|
|
46
|
-
|
|
47
|
-
The transient lifetime ensures that a new instance of ProgressBar is created
|
|
48
|
-
each time the IProgressBar interface is resolved from the container.
|
|
49
|
-
|
|
50
|
-
Parameters
|
|
51
|
-
----------
|
|
52
|
-
None
|
|
53
|
-
|
|
54
|
-
Returns
|
|
55
|
-
-------
|
|
56
|
-
None
|
|
57
|
-
This method does not return any value. It performs service registration
|
|
58
|
-
as a side effect on the application container.
|
|
59
|
-
"""
|
|
60
|
-
|
|
61
|
-
self.app.transient(IProgressBar, ProgressBar, alias=f"x-{IProgressBar.__module__}.{IProgressBar.__name__}")
|
|
62
|
-
|
|
63
|
-
def boot(self) -> None:
|
|
64
|
-
"""
|
|
65
|
-
Perform post-registration initialization for the progress bar provider.
|
|
9
|
+
Registers the progress bar service in the application container.
|
|
66
10
|
|
|
67
|
-
This method
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
during registration.
|
|
11
|
+
This method binds the `IProgressBar` interface to its concrete implementation,
|
|
12
|
+
`ProgressBar`, using transient lifetime management. The service is registered
|
|
13
|
+
with a specific alias for easy identification and retrieval from the container.
|
|
14
|
+
Transient lifetime ensures that a new instance of `ProgressBar` is created
|
|
15
|
+
each time the `IProgressBar` interface is resolved.
|
|
73
16
|
|
|
74
17
|
Parameters
|
|
75
18
|
----------
|
|
@@ -78,8 +21,10 @@ class ProgressBarProvider(ServiceProvider):
|
|
|
78
21
|
Returns
|
|
79
22
|
-------
|
|
80
23
|
None
|
|
81
|
-
This method does not return any value. It
|
|
82
|
-
|
|
24
|
+
This method does not return any value. It registers the service as a side effect
|
|
25
|
+
on the application container.
|
|
83
26
|
"""
|
|
84
27
|
|
|
85
|
-
|
|
28
|
+
# Register the ProgressBar implementation as a transient service for IProgressBar.
|
|
29
|
+
# The alias allows for explicit retrieval from the container if needed.
|
|
30
|
+
self.app.transient(IProgressBar, ProgressBar, alias="x-orionis.console.contracts.progress_bar.IProgressBar")
|
|
@@ -3,40 +3,15 @@ from orionis.console.core.reactor import Reactor
|
|
|
3
3
|
from orionis.container.providers.service_provider import ServiceProvider
|
|
4
4
|
|
|
5
5
|
class ReactorProvider(ServiceProvider):
|
|
6
|
-
"""
|
|
7
|
-
Service provider for worker management functionality within the Orionis framework.
|
|
8
|
-
|
|
9
|
-
This provider is responsible for registering and configuring the worker management
|
|
10
|
-
service implementation in the application's dependency injection container. It
|
|
11
|
-
establishes the binding between the IReactor interface contract and its concrete
|
|
12
|
-
Reactor implementation, enabling consistent reactor operations throughout the
|
|
13
|
-
application lifecycle.
|
|
14
|
-
|
|
15
|
-
The provider follows the standard service provider pattern, offering both
|
|
16
|
-
registration and boot phases for complete service lifecycle management.
|
|
17
|
-
|
|
18
|
-
Attributes
|
|
19
|
-
----------
|
|
20
|
-
app : Application
|
|
21
|
-
The main application container instance used for service registration
|
|
22
|
-
and dependency injection management.
|
|
23
|
-
|
|
24
|
-
Notes
|
|
25
|
-
-----
|
|
26
|
-
This provider registers the reactor service with a transient lifetime, ensuring
|
|
27
|
-
that each request for reactor functionality receives a fresh instance. This
|
|
28
|
-
approach is optimal for operations that may maintain temporary state or require
|
|
29
|
-
isolation between different execution contexts.
|
|
30
|
-
"""
|
|
31
6
|
|
|
32
7
|
def register(self) -> None:
|
|
33
8
|
"""
|
|
34
|
-
|
|
9
|
+
Registers the reactor management service in the application container.
|
|
35
10
|
|
|
36
|
-
This method binds the IReactor interface to
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
11
|
+
This method binds the `IReactor` interface to the `Reactor` implementation
|
|
12
|
+
within the application's dependency injection container. The service is registered
|
|
13
|
+
as a singleton, ensuring that the same `Reactor` instance is returned for every
|
|
14
|
+
resolution. An alias is provided for convenient retrieval.
|
|
40
15
|
|
|
41
16
|
Parameters
|
|
42
17
|
----------
|
|
@@ -45,44 +20,18 @@ class ReactorProvider(ServiceProvider):
|
|
|
45
20
|
Returns
|
|
46
21
|
-------
|
|
47
22
|
None
|
|
48
|
-
This method does not return any value. It performs registration
|
|
23
|
+
This method does not return any value. It performs service registration
|
|
49
24
|
as a side effect on the application container.
|
|
50
25
|
|
|
51
26
|
Notes
|
|
52
27
|
-----
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
""
|
|
57
|
-
|
|
58
|
-
# Register the Reactor service with the application container
|
|
59
|
-
# as a singleton, allowing it to be resolved throughout the application lifecycle
|
|
60
|
-
self.app.singleton(IReactor, Reactor, alias=f"x-{IReactor.__module__}.{IReactor.__name__}")
|
|
61
|
-
def boot(self) -> None:
|
|
62
|
-
"""
|
|
63
|
-
Perform post-registration initialization for the reactor management service.
|
|
64
|
-
|
|
65
|
-
This method is invoked after all services have been registered in the container.
|
|
66
|
-
It provides an opportunity for additional setup, configuration, or initialization
|
|
67
|
-
logic that may depend on other services being available. Currently, this method
|
|
68
|
-
does not perform any actions but serves as a placeholder for future enhancements.
|
|
69
|
-
|
|
70
|
-
Parameters
|
|
71
|
-
----------
|
|
72
|
-
None
|
|
73
|
-
|
|
74
|
-
Returns
|
|
75
|
-
-------
|
|
76
|
-
None
|
|
77
|
-
This method does not return any value. It only performs initialization
|
|
78
|
-
side effects if required.
|
|
79
|
-
|
|
80
|
-
Notes
|
|
81
|
-
-----
|
|
82
|
-
- Called automatically during the application boot sequence.
|
|
83
|
-
- Intended for cross-service configuration or runtime setup.
|
|
84
|
-
- No initialization is currently required for the reactor service.
|
|
28
|
+
- The `IReactor` interface is bound to the `Reactor` implementation.
|
|
29
|
+
- The service is registered as a singleton, so only one instance of `Reactor`
|
|
30
|
+
will exist throughout the application lifecycle.
|
|
31
|
+
- The alias "x-orionis.console.contracts.reactor.IReactor" can be used to
|
|
32
|
+
retrieve the service explicitly from the container.
|
|
85
33
|
"""
|
|
86
34
|
|
|
87
|
-
#
|
|
88
|
-
|
|
35
|
+
# Register the Reactor service as a singleton in the application container.
|
|
36
|
+
# This ensures only one instance of Reactor is created and shared.
|
|
37
|
+
self.app.singleton(IReactor, Reactor, alias="x-orionis.console.contracts.reactor.IReactor")
|