Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeDIForUtil ¶
Initializes DI, so that DICommonUtil can be used with it. For now it only registers `Cleaner` and `CleanRegistry`.
Types ¶
type CleanRegistry ¶
type Cleaner ¶
type Cleaner interface { CleanRegistry // Closes all registered closers. Clean() (err error) }
func NewCleaner ¶
func NewCleaner() Cleaner
type DI ¶
Implementation of DI container used. For now dig is used, rather than some interface for sake of simplicity.
type DICommonUtil ¶
type DICommonUtil struct {
DI
}
Getters/accessors for common utils used in DI by compilation stuff. Note: di must be initialized first in order to use it.
func (*DICommonUtil) CleanupClosers ¶
func (di *DICommonUtil) CleanupClosers() (err error)
Cleans up all closes, which were registered in CleanRegistry.
func (*DICommonUtil) RegisterCloser ¶
func (di *DICommonUtil) RegisterCloser(c io.Closer) (err error)
type SimpleStage ¶
type SimpleStage struct { InitializeImpl func(ctx StageContext) (err error) CompileImpl func(ctx StageContext, c DI) (err error) RewriteImpl func(ctx StageContext, current DI, newContainer DI) (err error) ShutdownImpl func(ctx StageContext, c DI) (err error) }
Stage, which implements it's functionality using functions provided by user. Functions, which are not provided are noop.
func (*SimpleStage) Compile ¶
func (ss *SimpleStage) Compile(ctx StageContext, c DI) (err error)
func (*SimpleStage) Initialize ¶
func (ss *SimpleStage) Initialize(ctx StageContext) (err error)
func (*SimpleStage) Rewrite ¶
func (ss *SimpleStage) Rewrite(ctx StageContext, current DI, newContainer DI) (err error)
func (*SimpleStage) Shutdown ¶
func (ss *SimpleStage) Shutdown(ctx StageContext, c DI) (err error)
type Stage ¶
type Stage interface { // Initializes container. // Called before rewriting of previous container is performed. Initialize(ctx StageContext) (err error) // Performs actual compilation - registers DI types, which // are result of compilation. Compile(ctx StageContext) (err error) // Rewrites all entries from current DI container to next stage's DI container. // So that all redundant dependencies are dropped. // // Called after compile. Rewrite(ctx StageContext, newContainer DI) (err error) // Shutdowns DI container. // This function must perform any kind of cleanup. Shutdown(ctx StageContext) (err error) }
Represents single compilation stage, which is implemented by user.
type StageContext ¶
type StagedCompiler ¶
type StagedCompiler struct { InitializeGlobalContainer func(ctx context.Context, globalDI DI) (err error) Stages []Stage }
func (*StagedCompiler) RunCompilation ¶
func (sm *StagedCompiler) RunCompilation(ctx context.Context) (err error)
type StagedCompilerResult ¶
Click to show internal directories.
Click to hide internal directories.