blob: d82a726e4e1681959155db803cc81d4a6cab4803 [file] [log] [blame]
Suharsh Sivakumar628a8ee2015-01-14 11:38:56 -08001package profiles
2
3import (
4 "v.io/core/veyron2"
5 "v.io/core/veyron2/context"
6
7 "v.io/core/veyron/lib/appcycle"
8 _ "v.io/core/veyron/runtimes/google/ipc/protocols/tcp"
9 _ "v.io/core/veyron/runtimes/google/ipc/protocols/ws"
10 _ "v.io/core/veyron/runtimes/google/ipc/protocols/wsh"
11 grt "v.io/core/veyron/runtimes/google/rt"
12)
13
14func init() {
15 veyron2.RegisterProfileInit(Init)
16}
17
Matt Rosencrantzaeed5d52015-01-14 15:18:34 -080018func Init(ctx *context.T) (veyron2.RuntimeX, *context.T, veyron2.Shutdown, error) {
Suharsh Sivakumar628a8ee2015-01-14 11:38:56 -080019 runtime := &grt.RuntimeX{}
Matt Rosencrantzaeed5d52015-01-14 15:18:34 -080020 ctx, shutdown, err := runtime.Init(ctx, nil)
Suharsh Sivakumar628a8ee2015-01-14 11:38:56 -080021 if err != nil {
Matt Rosencrantzaeed5d52015-01-14 15:18:34 -080022 return nil, nil, nil, err
Suharsh Sivakumar628a8ee2015-01-14 11:38:56 -080023 }
Suharsh Sivakumar98aa48c2015-01-14 16:11:30 -080024 veyron2.GetLogger(ctx).VI(1).Infof("Initializing generic profile.")
Suharsh Sivakumar628a8ee2015-01-14 11:38:56 -080025
26 ac := appcycle.New()
27 ctx = runtime.SetAppCycle(ctx, ac)
Matt Rosencrantzaeed5d52015-01-14 15:18:34 -080028
29 profileShutdown := func() {
30 shutdown()
31 ac.Shutdown()
Suharsh Sivakumar628a8ee2015-01-14 11:38:56 -080032 }
Matt Rosencrantzaeed5d52015-01-14 15:18:34 -080033 return runtime, ctx, profileShutdown, nil
Suharsh Sivakumar628a8ee2015-01-14 11:38:56 -080034}