veyron/runtimes/google: adding AppCycle service implementation to the runtime.
We create a new server for this purpose, and hook things up to the task tracker
mechanism. This CL also ensures that the task tracking channels get closed when
the runtime shuts down (to indicate when the shutdown is imminent).
To faciliate conveying the child's app cycle service name to the parent, we
introduce a config API and a config service (which subsumes the previous
callback mechanism into a more general API). The new mechanics are as follows:
- parent sends a config to the child, part of which is the parent's config
service veyron name;
- the child's app manager calls the parent's config service to let the parent
know what its own veyron name is;
- (if the child is a node manager), it calls the parent's config service to let
the parent know what the child's node manager service veyron name is.
The newly introduced config API and config service will be folded with the
config neighborhood service into "the" veyron config API.
Change-Id: I1ff427ae77097b012aef138df1e6347bf6623e4a
diff --git a/lib/exec/child.go b/lib/exec/child.go
index 45b4a4d..287e521 100644
--- a/lib/exec/child.go
+++ b/lib/exec/child.go
@@ -6,6 +6,8 @@
"io"
"os"
"sync"
+
+ "veyron/lib/config"
)
var (
@@ -14,19 +16,15 @@
)
type ChildHandle struct {
- // CallbackName is a callback name that can be use to notify the
- // parent that the child has started up successfully via the
- // Callback() RPC.
- CallbackName string
+ // Config is passed down from the parent.
+ Config config.Config
// Secret is a secret passed to the child by its parent via a
// trusted channel.
Secret string
- // statusPipe is a pipe that is used to notify the parent that the
- // child process has started successfully. Unlike the Callback()
- // RPC, which is to be invoked by the application to notify the
- // parent that the application is "ready", the statusPipe is to be
- // invoked by the veyron framework to notify the parent that the
- // child process has successfully started.
+ // statusPipe is a pipe that is used to notify the parent that the child
+ // process has started successfully. It is meant to be invoked by the
+ // veyron framework to notify the parent that the child process has
+ // successfully started.
statusPipe *os.File
}
@@ -84,18 +82,22 @@
return nil, ErrUnsupportedVersion
}
dataPipe := os.NewFile(3, "data_rd")
- name, err := decodeString(dataPipe)
+ serializedConfig, err := decodeString(dataPipe)
if err != nil {
return nil, err
}
+ cfg := config.New()
+ if err := cfg.MergeFrom(serializedConfig); err != nil {
+ return nil, err
+ }
secret, err := decodeString(dataPipe)
if err != nil {
return nil, err
}
childHandle = &ChildHandle{
- CallbackName: name,
- Secret: secret,
- statusPipe: os.NewFile(4, "status_wr"),
+ Config: cfg,
+ Secret: secret,
+ statusPipe: os.NewFile(4, "status_wr"),
}
return childHandle, nil
}