ref: Move context.T out of rpc.ServerCall.
The purpose of this change is to make our usage of context.T more
consistent; it was a bit lame that we gave guidance to never wrap
context.T in another type, but were doing it ourselves. The JS
code is also being changed to follow this convention (in separate
CLs), so we'll be consistent between Go and JS as well.
The server implementation used to look like this:
func (*impl) Foo(call rpc.ServerCall, ...)
Now it looks like this:
func (*impl) Foo(ctx *context.T, call rpc.ServerCall, ...)
Also added a ServerCall.Security() function, which returns the
security.Call. The security.Call is still embedded inside
context.T for now; a subsequent change will remove it from
context.T and add an explicit security.Call argument where
necessary. That's a separate CL since some of the choices may be
more controversial, and it's a smaller set of changes.
MultiPart: 2/8
Change-Id: If1ea84b4263836f7ddd82b965c35178a73d314cf
diff --git a/profiles/internal/rpc/test/simple_test.go b/profiles/internal/rpc/test/simple_test.go
index c83ec25..22c3da4 100644
--- a/profiles/internal/rpc/test/simple_test.go
+++ b/profiles/internal/rpc/test/simple_test.go
@@ -10,6 +10,7 @@
"time"
"v.io/v23"
+ "v.io/v23/context"
"v.io/v23/rpc"
)
@@ -17,7 +18,7 @@
done <-chan struct{}
}
-func (s *simple) Sleep(call rpc.ServerCall) error {
+func (s *simple) Sleep(*context.T, rpc.ServerCall) error {
select {
case <-s.done:
case <-time.After(time.Hour):
@@ -25,15 +26,15 @@
return nil
}
-func (s *simple) Ping(call rpc.ServerCall) (string, error) {
+func (s *simple) Ping(_ *context.T, _ rpc.ServerCall) (string, error) {
return "pong", nil
}
-func (s *simple) Echo(call rpc.ServerCall, arg string) (string, error) {
+func (s *simple) Echo(_ *context.T, _ rpc.ServerCall, arg string) (string, error) {
return arg, nil
}
-func (s *simple) Source(call rpc.StreamServerCall, start int) error {
+func (s *simple) Source(_ *context.T, call rpc.StreamServerCall, start int) error {
i := start
backoff := 25 * time.Millisecond
for {
@@ -48,7 +49,7 @@
}
}
-func (s *simple) Sink(call rpc.StreamServerCall) (int, error) {
+func (s *simple) Sink(_ *context.T, call rpc.StreamServerCall) (int, error) {
i := 0
for {
if err := call.Recv(&i); err != nil {
@@ -60,7 +61,7 @@
}
}
-func (s *simple) Inc(call rpc.StreamServerCall, inc int) (int, error) {
+func (s *simple) Inc(_ *context.T, call rpc.StreamServerCall, inc int) (int, error) {
i := 0
for {
if err := call.Recv(&i); err != nil {