github.com/ergo-services/ergo@v1.999.224/apps/system/app.go (about)

     1  package system
     2  
     3  import (
     4  	"github.com/ergo-services/ergo/etf"
     5  	"github.com/ergo-services/ergo/gen"
     6  	"github.com/ergo-services/ergo/lib"
     7  	"github.com/ergo-services/ergo/node"
     8  )
     9  
    10  func CreateApp(options node.System) gen.ApplicationBehavior {
    11  	return &systemApp{
    12  		options: options,
    13  	}
    14  }
    15  
    16  type systemApp struct {
    17  	gen.Application
    18  	options node.System
    19  }
    20  
    21  func (sa *systemApp) Load(args ...etf.Term) (gen.ApplicationSpec, error) {
    22  	lib.Log("SYSTEM: Application load")
    23  	return gen.ApplicationSpec{
    24  		Name:        "system_app",
    25  		Description: "System Application",
    26  		Version:     "v.1.0",
    27  		Children: []gen.ApplicationChildSpec{
    28  			gen.ApplicationChildSpec{
    29  				Child: &systemAppSup{},
    30  				Name:  "system_app_sup",
    31  				Args:  []etf.Term{sa.options},
    32  			},
    33  		},
    34  	}, nil
    35  }
    36  
    37  func (sa *systemApp) Start(p gen.Process, args ...etf.Term) {
    38  	lib.Log("[%s] SYSTEM: Application started", p.NodeName())
    39  }