Expand description
§Sai
Sai is a framework for managing lifecycle and dependency of your software components. In some languages, it was called “IoC” and “Dependency Injection”. The main usecase of this framework is on medium/large scale web services.
The Sai ecosystem consists of two major concepts: System, Component. A System is a runtime unit that control lifecycles of all Components. A Component is a group of logic. A Component can depends on other Components and it can also have its own internal state.
Macros§
- combine_
component_ registry - A macro that combines any number of Component Registry
- component_
registry - A macro that helps setting up Component Registry
Structs§
- Injected
- The official wrapper for all dependencies.
- System
- A system is a collection of components + the ability to control the lifecycle of components in a way meeting the dependency requirement of components, e.g. start/stop them.
Traits§
- Component
- A Component is a bunch of business-logic behaviors + startup logic.
- Component
Lifecycle - ComponentLifecycle is simply start()/stop()
- Component
Registry - ComponentRegistry is a data structure for system to find a meta information for component. It’s required for a system to have a ComponentRegistry.
Attribute Macros§
- async_
trait - Re-export from async_trait library
Derive Macros§
- Component
- Dervive Macro for defining a component