all: Create a new client context parameter that will be the first argument of every RPC call.
The important changes are in:
veyron2/model.go
veyron2/ipc/model.go
Most of the rest is wiring. I assume you'll want to suggest alternte names for the new API methods, I figured I'd just send something out to get the conversation going. I've added TODO() as a placeholder. Everywhere that occurs further changes are required to find the proper context to pass through. I just wanted to limit this change somehow.
I'll take another pass at this, but I wanted to give you a chance to give early feedback.
Change-Id: I0c508a0352d1d72ec60dc715d396e8724de9ab91
diff --git a/tools/profile/impl/impl.go b/tools/profile/impl/impl.go
index ccb9038..0d3b745 100644
--- a/tools/profile/impl/impl.go
+++ b/tools/profile/impl/impl.go
@@ -5,6 +5,8 @@
"veyron/lib/cmdline"
"veyron/services/mgmt/profile"
+
+ "veyron2/rt"
)
var cmdLabel = &cmdline.Command{
@@ -24,7 +26,7 @@
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
- label, err := p.Label()
+ label, err := p.Label(rt.R().NewContext())
if err != nil {
return err
}
@@ -49,7 +51,7 @@
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
- desc, err := p.Description()
+ desc, err := p.Description(rt.R().NewContext())
if err != nil {
return err
}
@@ -74,7 +76,7 @@
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
- spec, err := p.Specification()
+ spec, err := p.Specification(rt.R().NewContext())
if err != nil {
return err
}
@@ -107,7 +109,7 @@
Label: "example",
Description: "Example profile to test the profile manager implementation.",
}
- if err := p.Put(spec); err != nil {
+ if err := p.Put(rt.R().NewContext(), spec); err != nil {
return err
}
fmt.Fprintln(cmd.Stdout(), "Specification updated successfully.")
@@ -131,7 +133,7 @@
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
- if err = p.Remove(); err != nil {
+ if err = p.Remove(rt.R().NewContext()); err != nil {
return err
}
fmt.Fprintln(cmd.Stdout(), "Profile removed successfully.")
diff --git a/tools/profile/impl/impl_test.go b/tools/profile/impl/impl_test.go
index 4de7fa8..9435742 100644
--- a/tools/profile/impl/impl_test.go
+++ b/tools/profile/impl/impl_test.go
@@ -31,7 +31,7 @@
suffix string
}
-func (s *server) Label(ipc.Context) (string, error) {
+func (s *server) Label(ipc.ServerContext) (string, error) {
vlog.VI(2).Infof("%v.Label() was called", s.suffix)
if s.suffix != "exists" {
return "", fmt.Errorf("profile doesn't exist: %v", s.suffix)
@@ -39,7 +39,7 @@
return spec.Label, nil
}
-func (s *server) Description(ipc.Context) (string, error) {
+func (s *server) Description(ipc.ServerContext) (string, error) {
vlog.VI(2).Infof("%v.Description() was called", s.suffix)
if s.suffix != "exists" {
return "", fmt.Errorf("profile doesn't exist: %v", s.suffix)
@@ -47,7 +47,7 @@
return spec.Description, nil
}
-func (s *server) Specification(ipc.Context) (profile.Specification, error) {
+func (s *server) Specification(ipc.ServerContext) (profile.Specification, error) {
vlog.VI(2).Infof("%v.Specification() was called", s.suffix)
if s.suffix != "exists" {
return profile.Specification{}, fmt.Errorf("profile doesn't exist: %v", s.suffix)
@@ -55,12 +55,12 @@
return spec, nil
}
-func (s *server) Put(_ ipc.Context, _ profile.Specification) error {
+func (s *server) Put(_ ipc.ServerContext, _ profile.Specification) error {
vlog.VI(2).Infof("%v.Put() was called", s.suffix)
return nil
}
-func (s *server) Remove(ipc.Context) error {
+func (s *server) Remove(ipc.ServerContext) error {
vlog.VI(2).Infof("%v.Remove() was called", s.suffix)
if s.suffix != "exists" {
return fmt.Errorf("profile doesn't exist: %v", s.suffix)