func Start()

in lambda/rapid/sandbox.go [52:101]


func Start(s *Sandbox) {
	appCtx := appctx.NewApplicationContext()
	initFlow := core.NewInitFlowSynchronization()
	invokeFlow := core.NewInvokeFlowSynchronization()
	registrationService := core.NewRegistrationService(initFlow, invokeFlow)
	renderingService := rendering.NewRenderingService()
	credentialsService := core.NewCredentialsService()

	if s.StandaloneMode {
		s.InteropServer.SetInternalStateGetter(registrationService.GetInternalStateDescriptor(appCtx))
	}
	server := rapi.NewServer(RuntimeAPIHost, RuntimeAPIPort, appCtx, registrationService, renderingService, s.EnableTelemetryAPI, s.LogsSubscriptionAPI, s.InitCachingEnabled, credentialsService)

	postLoadTimeNs := metering.Monotime()

	runtimeAPIAddr := fmt.Sprintf("%s:%d", server.Host(), server.Port())
	s.Environment.StoreRuntimeAPIEnvironmentVariable(runtimeAPIAddr)

	appctx.StoreInteropServer(appCtx, s.InteropServer)

	start(s.SignalCtx, &rapidContext{
		server:              server,
		appCtx:              appCtx,
		postLoadTimeNs:      postLoadTimeNs,
		initDone:            false,
		initFlow:            initFlow,
		invokeFlow:          invokeFlow,
		registrationService: registrationService,
		renderingService:    renderingService,
		exitPidChan:         make(chan int),
		resetChan:           make(chan *interop.Reset),
		credentialsService:  credentialsService,

		telemetryAPIEnabled: s.EnableTelemetryAPI,
		logsSubscriptionAPI: s.LogsSubscriptionAPI,
		logsEgressAPI:       s.LogsEgressAPI,
		bootstrap:           s.Bootstrap,
		interopServer:       s.InteropServer,
		xray:                s.Tracer,
		environment:         s.Environment,
		standaloneMode:      s.StandaloneMode,
		debugTailLogger:     s.DebugTailLogger,
		platformLogger:      s.PlatformLogger,
		runtimeStdoutWriter: s.RuntimeStdoutWriter,
		runtimeStderrWriter: s.RuntimeStderrWriter,
		preLoadTimeNs:       s.PreLoadTimeNs,
		eventsAPI:           s.EventsAPI,
		initCachingEnabled:  s.InitCachingEnabled,
	})
}