中文
EN
dot
Component development specification, including component definition, component dependencies, component life cycle, dependency injection, and common basic components
- Dot: A component which has no type or interface requirements, anything can be a component
- Line: A container that holds components, adds, deletes, modifies, and injects dependencies into components
- Newer: Construct component, the Newer is used to construct the component, and if it is not specified, then construct it by default "refect.New"
- Lifer: Is the component life cycle management interface, the implementation of the interface and the method will be automatically run by Line, the following are the four interfaces
Creator
Starter
Stopper
Destroyer
- Injecter :It is component dependency injection, adding, deleting and checking components. The creation process of components added through this interface is completed by ourselves, which is part of Line
The process that component runs as follows:
Create Config and Log
- Make Default Log
- Make Config
- Make Log of config
Create
- Builder.BeforeCreate
- dot.Newer
- dot.SetterLine
- dot.SetterTypeAndLiveId
- Events.BeforeCreate //for type id
- Events.BeforeCreate //for live id
- dot.Creator
- Events.AfterCreate //for live id
- Events.AfterCreate //for type id, go to "2. Newer", untill all done
- Inject all dependentes of dots
- AfterAllInjecter
- Builder.AfterCreate
Start
- Builder.BeforeStart
- Events.BeforeStart
- Events.BeforeStart //for live id
- dot.Starter
- Events.AfterStart //for live id
- Events.AfterStart //go to "2. Events.BeforeStart", untill all done
- dot.AfterAllStart
- Builder.AfterStart
Stop
- Builder.BeforeStop
- dot.BeforeAllStopper
- Events.BeforeStop //for type id
- Events.BeforeStop //for live id
- dot.Stopper
- Events.AfterStop //for live id
- Events.AfterStop //for type id go to "2. Events.BeforeStop", until all done
- Builder.AfterStop
Destroy
- Builder.BeforeDestroy
- Events.BeforeDestroy //for type id
- Events.BeforeDestroy //for live id
- dot.Destroyer
- Events.AfterStop //for live id
- Events.AfterStop //for type id go to "2. Events.BeforeDestroy", until all done
- Builder.AfterDestroy
The relationships between components can be set by configuration files or code, Line computes the dependencies between components, regardless of the order in which they are created .
Default components
Config: dots/sconfig
Now use the json format, later will support toml, yaml, command line, and environment variables.
Log: dots/slog
High performance logs based on zap.
GRPC client balance: dots/grpc/conns
Client load balancing for GRPC. "sample /grpc_conns" is an example.
Certificate generated: dots/certificate
Generate root and sub certificates. "sample/certificate" is an example.