func Start()

in internal/satellite/boot/boot.go [54:86]


func Start(cfg *config.SatelliteConfig, shutdownHookTime time.Duration) error {
	// Init the global components.
	log.Init(cfg.Logger)
	if err := telemetry.Init(cfg.Telemetry); err != nil {
		return err
	}
	api.ShutdownHookTime = shutdownHookTime
	// register the supported plugin types to the registry
	plugins.RegisterPlugins()
	// use context to receive the external signal.
	ctx, cancel := context.WithCancel(context.Background())
	addShutdownListener(cancel)
	// initialize the sharing plugins
	sharing.Load(cfg.Sharing)
	if err := sharing.Prepare(); err != nil {
		return fmt.Errorf("error in preparing the sharing plugins: %v", err)
	}
	defer sharing.Close()
	// boot Satellite
	if modules, err := initModules(cfg); err != nil {
		return err
	} else if err := prepareModules(modules); err != nil {
		return err
	} else if err := sharing.Start(); err != nil {
		return err
	} else {
		if err := telemetry.AfterShardingStart(); err != nil {
			return err
		}
		bootModules(ctx, modules)
		return nil
	}
}