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/examples/boxes/android/src/boxesp2p/main.go b/examples/boxes/android/src/boxesp2p/main.go
index b76d464..60cefac 100644
--- a/examples/boxes/android/src/boxesp2p/main.go
+++ b/examples/boxes/android/src/boxesp2p/main.go
@@ -67,8 +67,8 @@
"unsafe"
"veyron/examples/boxes"
- vsync "veyron/runtimes/google/vsync"
inaming "veyron/runtimes/google/naming"
+ vsync "veyron/runtimes/google/vsync"
"veyron/services/store/raw"
storage "veyron/services/store/server"
@@ -88,9 +88,9 @@
}
type goState struct {
- runtime veyron2.Runtime
- store *storage.Server
- ipc ipc.Server
+ runtime veyron2.Runtime
+ store *storage.Server
+ ipc ipc.Server
drawStream boxes.DrawInterfaceDrawStream
signalling boxes.BoxSignalling
@@ -104,11 +104,11 @@
)
const (
- drawServicePort = ":8509"
- storeServicePort = ":8000"
- syncServicePort = ":8001"
- storePath = "/data/data/com.boxes.android.draganddraw/files/vsync"
- storeDatabase = "veyron_store.db"
+ drawServicePort = ":8509"
+ storeServicePort = ":8000"
+ syncServicePort = ":8001"
+ storePath = "/data/data/com.boxes.android.draganddraw/files/vsync"
+ storeDatabase = "veyron_store.db"
)
func (jni *jniState) registerAddBox(env *C.JNIEnv, obj C.jobject) {
@@ -129,7 +129,7 @@
C.callMethod(env, jni.jObj, jni.jMID, jBoxId, &jPoints[0])
}
-func (gs *goState) Draw(context ipc.Context, stream boxes.DrawInterfaceServiceDrawStream) error {
+func (gs *goState) Draw(context ipc.ServerContext, stream boxes.DrawInterfaceServiceDrawStream) error {
// Get the endpoint of the remote process
endPt, err := inaming.NewEndpoint(context.RemoteAddr().String())
if err != nil {
@@ -173,7 +173,7 @@
if err := srv.Register("draw", ipc.SoloDispatcher(drawServer, auth)); err != nil {
panic(fmt.Errorf("Failed Register:%v", err))
}
- endPt, err := srv.Listen("tcp", myIPAddr + drawServicePort)
+ endPt, err := srv.Listen("tcp", myIPAddr+drawServicePort)
if err != nil {
panic(fmt.Errorf("Failed to Listen:%v", err))
}
@@ -265,7 +265,7 @@
}
// Create an endpoint and start listening
- if _, err = gs.ipc.Listen("tcp", myIPAddr + storeServicePort); err != nil {
+ if _, err = gs.ipc.Listen("tcp", myIPAddr+storeServicePort); err != nil {
panic(fmt.Errorf("s.Listen() failed:%v", err))
}
}
@@ -273,11 +273,11 @@
func initSyncService(peerEndpoint string) {
peerSyncAddr := strings.Split(peerEndpoint, ":")[0]
storeName := "/" + myIPAddr + storeServicePort
- srv:= vsync.NewServerSync(vsync.NewSyncd(peerSyncAddr + syncServicePort, peerSyncAddr /* peer deviceID */, myIPAddr /* my deviceID */, storePath, storeName, 1))
+ srv := vsync.NewServerSync(vsync.NewSyncd(peerSyncAddr+syncServicePort, peerSyncAddr /* peer deviceID */, myIPAddr /* my deviceID */, storePath, storeName, 1))
if err := gs.ipc.Register("sync", ipc.SoloDispatcher(srv, nil)); err != nil {
panic(fmt.Errorf("syncd:: error registering service: err %v", err))
}
- if _, err := gs.ipc.Listen("tcp", myIPAddr + syncServicePort); err != nil {
+ if _, err := gs.ipc.Listen("tcp", myIPAddr+syncServicePort); err != nil {
panic(fmt.Errorf("syncd:: error listening to service: err %v", err))
}
}
diff --git a/examples/boxes/boxes.vdl.go b/examples/boxes/boxes.vdl.go
index 00fea43..84d6297 100644
--- a/examples/boxes/boxes.vdl.go
+++ b/examples/boxes/boxes.vdl.go
@@ -30,9 +30,9 @@
// to enable embedding without method collisions. Not to be used directly by clients.
type BoxSignalling_ExcludingUniversal interface {
// Add endpoint information to the signalling server.
- Add(Endpoint string, opts ..._gen_ipc.ClientCallOpt) (err error)
+ Add(ctx _gen_ipc.Context, Endpoint string, opts ..._gen_ipc.CallOpt) (err error)
// Get endpoint information about a peer.
- Get(opts ..._gen_ipc.ClientCallOpt) (reply string, err error)
+ Get(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply string, err error)
}
type BoxSignalling interface {
_gen_ipc.UniversalServiceMethods
@@ -43,9 +43,9 @@
type BoxSignallingService interface {
// Add endpoint information to the signalling server.
- Add(context _gen_ipc.Context, Endpoint string) (err error)
+ Add(context _gen_ipc.ServerContext, Endpoint string) (err error)
// Get endpoint information about a peer.
- Get(context _gen_ipc.Context) (reply string, err error)
+ Get(context _gen_ipc.ServerContext) (reply string, err error)
}
// BindBoxSignalling returns the client stub implementing the BoxSignalling
@@ -91,9 +91,9 @@
name string
}
-func (__gen_c *clientStubBoxSignalling) Add(Endpoint string, opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Add", []interface{}{Endpoint}, opts...); err != nil {
+func (__gen_c *clientStubBoxSignalling) Add(ctx _gen_ipc.Context, Endpoint string, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Add", []interface{}{Endpoint}, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -102,9 +102,9 @@
return
}
-func (__gen_c *clientStubBoxSignalling) Get(opts ..._gen_ipc.ClientCallOpt) (reply string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Get", nil, opts...); err != nil {
+func (__gen_c *clientStubBoxSignalling) Get(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Get", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -113,9 +113,9 @@
return
}
-func (__gen_c *clientStubBoxSignalling) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubBoxSignalling) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -124,9 +124,9 @@
return
}
-func (__gen_c *clientStubBoxSignalling) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubBoxSignalling) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -135,9 +135,9 @@
return
}
-func (__gen_c *clientStubBoxSignalling) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubBoxSignalling) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -225,7 +225,7 @@
// to enable embedding without method collisions. Not to be used directly by clients.
type DrawInterface_ExcludingUniversal interface {
// Send/Receive a stream of boxes with another peer
- Draw(opts ..._gen_ipc.ClientCallOpt) (reply DrawInterfaceDrawStream, err error)
+ Draw(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply DrawInterfaceDrawStream, err error)
}
type DrawInterface interface {
_gen_ipc.UniversalServiceMethods
@@ -236,7 +236,7 @@
type DrawInterfaceService interface {
// Send/Receive a stream of boxes with another peer
- Draw(context _gen_ipc.Context, stream DrawInterfaceServiceDrawStream) (err error)
+ Draw(context _gen_ipc.ServerContext, stream DrawInterfaceServiceDrawStream) (err error)
}
// DrawInterfaceDrawStream is the interface for streaming responses of the method
@@ -267,7 +267,7 @@
// Implementation of the DrawInterfaceDrawStream interface that is not exported.
type implDrawInterfaceDrawStream struct {
- clientCall _gen_ipc.ClientCall
+ clientCall _gen_ipc.Call
}
func (c *implDrawInterfaceDrawStream) Send(item Box) error {
@@ -363,18 +363,18 @@
name string
}
-func (__gen_c *clientStubDrawInterface) Draw(opts ..._gen_ipc.ClientCallOpt) (reply DrawInterfaceDrawStream, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Draw", nil, opts...); err != nil {
+func (__gen_c *clientStubDrawInterface) Draw(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply DrawInterfaceDrawStream, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Draw", nil, opts...); err != nil {
return
}
reply = &implDrawInterfaceDrawStream{clientCall: call}
return
}
-func (__gen_c *clientStubDrawInterface) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubDrawInterface) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -383,9 +383,9 @@
return
}
-func (__gen_c *clientStubDrawInterface) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubDrawInterface) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -394,9 +394,9 @@
return
}
-func (__gen_c *clientStubDrawInterface) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubDrawInterface) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
diff --git a/examples/boxes/signallingserver/main.go b/examples/boxes/signallingserver/main.go
index 08bbd0f..dc413e8 100644
--- a/examples/boxes/signallingserver/main.go
+++ b/examples/boxes/signallingserver/main.go
@@ -19,13 +19,13 @@
type boxAppEndpoint string
-func (b *boxAppEndpoint) Add(_ ipc.Context, Endpoint string) (err error) {
+func (b *boxAppEndpoint) Add(_ ipc.ServerContext, Endpoint string) (err error) {
*b = boxAppEndpoint(Endpoint)
log.Printf("Added endpoint %v to signalling service", *b)
return nil
}
-func (b *boxAppEndpoint) Get(_ ipc.Context) (Endpoint string, err error) {
+func (b *boxAppEndpoint) Get(_ ipc.ServerContext) (Endpoint string, err error) {
log.Printf("Returning endpoints:%v from signalling service", *b)
return string(*b), nil
}
diff --git a/examples/fortune/fortune.vdl.go b/examples/fortune/fortune.vdl.go
index e1382b8..09f5323 100644
--- a/examples/fortune/fortune.vdl.go
+++ b/examples/fortune/fortune.vdl.go
@@ -21,9 +21,9 @@
// to enable embedding without method collisions. Not to be used directly by clients.
type Fortune_ExcludingUniversal interface {
// Get returns a random fortune.
- Get(opts ..._gen_ipc.ClientCallOpt) (reply string, err error)
+ Get(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply string, err error)
// Add stores a fortune in the set used by Get.
- Add(Fortune string, opts ..._gen_ipc.ClientCallOpt) (err error)
+ Add(ctx _gen_ipc.Context, Fortune string, opts ..._gen_ipc.CallOpt) (err error)
}
type Fortune interface {
_gen_ipc.UniversalServiceMethods
@@ -34,9 +34,9 @@
type FortuneService interface {
// Get returns a random fortune.
- Get(context _gen_ipc.Context) (reply string, err error)
+ Get(context _gen_ipc.ServerContext) (reply string, err error)
// Add stores a fortune in the set used by Get.
- Add(context _gen_ipc.Context, Fortune string) (err error)
+ Add(context _gen_ipc.ServerContext, Fortune string) (err error)
}
// BindFortune returns the client stub implementing the Fortune
@@ -82,9 +82,9 @@
name string
}
-func (__gen_c *clientStubFortune) Get(opts ..._gen_ipc.ClientCallOpt) (reply string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Get", nil, opts...); err != nil {
+func (__gen_c *clientStubFortune) Get(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Get", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -93,9 +93,9 @@
return
}
-func (__gen_c *clientStubFortune) Add(Fortune string, opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Add", []interface{}{Fortune}, opts...); err != nil {
+func (__gen_c *clientStubFortune) Add(ctx _gen_ipc.Context, Fortune string, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Add", []interface{}{Fortune}, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -104,9 +104,9 @@
return
}
-func (__gen_c *clientStubFortune) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubFortune) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -115,9 +115,9 @@
return
}
-func (__gen_c *clientStubFortune) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubFortune) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -126,9 +126,9 @@
return
}
-func (__gen_c *clientStubFortune) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubFortune) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
diff --git a/examples/fortune/fortune/main.go b/examples/fortune/fortune/main.go
index 2a92eb6..96bc2bb 100644
--- a/examples/fortune/fortune/main.go
+++ b/examples/fortune/fortune/main.go
@@ -37,7 +37,7 @@
// Issue a Get() rpc specifying the provided pattern for the server's identity as
// an option. If no pattern is provided then the default pattern "*" matches all
// identities.
- fortune, err := s.Get(veyron2.RemoteID(*serverPattern))
+ fortune, err := s.Get(runtime.NewContext(), veyron2.RemoteID(*serverPattern))
if err != nil {
log.Fatal("error getting fortune: ", err)
}
@@ -46,7 +46,7 @@
// If the user specified --new_fortune, Add() it to the server’s set of fortunes.
// Again, the provided pattern on the server's identity is passed as an option.
if *newFortune != "" {
- if err := s.Add(*newFortune, veyron2.RemoteID(*serverPattern)); err != nil {
+ if err := s.Add(runtime.NewContext(), *newFortune, veyron2.RemoteID(*serverPattern)); err != nil {
log.Fatal("error adding fortune: ", err)
}
}
diff --git a/examples/fortune/fortuned/main.go b/examples/fortune/fortuned/main.go
index a49f55a..3e812ac 100644
--- a/examples/fortune/fortuned/main.go
+++ b/examples/fortune/fortuned/main.go
@@ -34,11 +34,11 @@
}
}
-func (f *fortuned) Get(_ ipc.Context) (Fortune string, err error) {
+func (f *fortuned) Get(_ ipc.ServerContext) (Fortune string, err error) {
return f.fortunes[f.random.Intn(len(f.fortunes))], nil
}
-func (f *fortuned) Add(_ ipc.Context, Fortune string) error {
+func (f *fortuned) Add(_ ipc.ServerContext, Fortune string) error {
f.fortunes = append(f.fortunes, Fortune)
return nil
}
diff --git a/examples/inspector/inspector.vdl.go b/examples/inspector/inspector.vdl.go
index 67e0b36..ede2f60 100644
--- a/examples/inspector/inspector.vdl.go
+++ b/examples/inspector/inspector.vdl.go
@@ -29,8 +29,8 @@
// Inspector_ExcludingUniversal is the interface without internal framework-added methods
// to enable embedding without method collisions. Not to be used directly by clients.
type Inspector_ExcludingUniversal interface {
- Ls(Glob string, opts ..._gen_ipc.ClientCallOpt) (reply InspectorLsStream, err error)
- LsDetails(Glob string, opts ..._gen_ipc.ClientCallOpt) (reply InspectorLsDetailsStream, err error)
+ Ls(ctx _gen_ipc.Context, Glob string, opts ..._gen_ipc.CallOpt) (reply InspectorLsStream, err error)
+ LsDetails(ctx _gen_ipc.Context, Glob string, opts ..._gen_ipc.CallOpt) (reply InspectorLsDetailsStream, err error)
}
type Inspector interface {
_gen_ipc.UniversalServiceMethods
@@ -39,8 +39,8 @@
// InspectorService is the interface the server implements.
type InspectorService interface {
- Ls(context _gen_ipc.Context, Glob string, stream InspectorServiceLsStream) (err error)
- LsDetails(context _gen_ipc.Context, Glob string, stream InspectorServiceLsDetailsStream) (err error)
+ Ls(context _gen_ipc.ServerContext, Glob string, stream InspectorServiceLsStream) (err error)
+ LsDetails(context _gen_ipc.ServerContext, Glob string, stream InspectorServiceLsDetailsStream) (err error)
}
// InspectorLsStream is the interface for streaming responses of the method
@@ -61,7 +61,7 @@
// Implementation of the InspectorLsStream interface that is not exported.
type implInspectorLsStream struct {
- clientCall _gen_ipc.ClientCall
+ clientCall _gen_ipc.Call
}
func (c *implInspectorLsStream) Recv() (item string, err error) {
@@ -115,7 +115,7 @@
// Implementation of the InspectorLsDetailsStream interface that is not exported.
type implInspectorLsDetailsStream struct {
- clientCall _gen_ipc.ClientCall
+ clientCall _gen_ipc.Call
}
func (c *implInspectorLsDetailsStream) Recv() (item Details, err error) {
@@ -194,27 +194,27 @@
name string
}
-func (__gen_c *clientStubInspector) Ls(Glob string, opts ..._gen_ipc.ClientCallOpt) (reply InspectorLsStream, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Ls", []interface{}{Glob}, opts...); err != nil {
+func (__gen_c *clientStubInspector) Ls(ctx _gen_ipc.Context, Glob string, opts ..._gen_ipc.CallOpt) (reply InspectorLsStream, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Ls", []interface{}{Glob}, opts...); err != nil {
return
}
reply = &implInspectorLsStream{clientCall: call}
return
}
-func (__gen_c *clientStubInspector) LsDetails(Glob string, opts ..._gen_ipc.ClientCallOpt) (reply InspectorLsDetailsStream, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "LsDetails", []interface{}{Glob}, opts...); err != nil {
+func (__gen_c *clientStubInspector) LsDetails(ctx _gen_ipc.Context, Glob string, opts ..._gen_ipc.CallOpt) (reply InspectorLsDetailsStream, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "LsDetails", []interface{}{Glob}, opts...); err != nil {
return
}
reply = &implInspectorLsDetailsStream{clientCall: call}
return
}
-func (__gen_c *clientStubInspector) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubInspector) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -223,9 +223,9 @@
return
}
-func (__gen_c *clientStubInspector) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubInspector) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -234,9 +234,9 @@
return
}
-func (__gen_c *clientStubInspector) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubInspector) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
diff --git a/examples/inspector/inspector/main.go b/examples/inspector/inspector/main.go
index 1683b16..470044a 100644
--- a/examples/inspector/inspector/main.go
+++ b/examples/inspector/inspector/main.go
@@ -63,7 +63,7 @@
}
// ls and lsdashl are idiomatic for use without stubs
-func ls(call ipc.ClientCall) {
+func ls(call ipc.Call) {
for {
var n string
if err := call.Recv(&n); err != nil {
@@ -77,7 +77,7 @@
}
}
-func lsdashl(call ipc.ClientCall) {
+func lsdashl(call ipc.Call) {
type details struct {
Name string
Size int64
@@ -104,7 +104,7 @@
vlog.Fatalf("failed to create new client: %q", err)
}
defer client.Close()
- call, err := client.StartCall(service, "List", []interface{}{glob, details})
+ call, err := client.StartCall(rt.R().NewContext(), service, "List", []interface{}{glob, details})
if err != nil {
vlog.Fatalf("failed to start call: %q", err)
}
@@ -166,14 +166,15 @@
bail := func(err error) {
vlog.Fatalf("failed to start call: %q", err)
}
+ ctx := rt.R().NewContext()
if details {
- if stream, err := inspector.LsDetails(glob); err != nil {
+ if stream, err := inspector.LsDetails(ctx, glob); err != nil {
bail(err)
} else {
streamDetails(stream)
}
} else {
- if stream, err := inspector.Ls(glob); err != nil {
+ if stream, err := inspector.Ls(ctx, glob); err != nil {
bail(err)
} else {
streamNames(stream)
diff --git a/examples/inspector/inspectord/services.go b/examples/inspector/inspectord/services.go
index b39a073..1a087a6 100644
--- a/examples/inspector/inspectord/services.go
+++ b/examples/inspector/inspectord/services.go
@@ -71,7 +71,7 @@
}
type stubbedServer struct {
- context ipc.Context
+ context ipc.ServerContext
names inspector.InspectorServiceLsStream
details inspector.InspectorServiceLsDetailsStream
}
@@ -145,13 +145,13 @@
}
// Ls is a stubbed server method
-func (s *server) Ls(context ipc.Context, Glob string, Stream inspector.InspectorServiceLsStream) error {
+func (s *server) Ls(context ipc.ServerContext, Glob string, Stream inspector.InspectorServiceLsStream) error {
log.Infof("Ls %q", Glob)
return s.ls(Glob, false, &stubbedServer{context: context, names: Stream})
}
// LsDetails is a stubbed server method
-func (s *server) LsDetails(context ipc.Context, Glob string, Stream inspector.InspectorServiceLsDetailsStream) error {
+func (s *server) LsDetails(context ipc.ServerContext, Glob string, Stream inspector.InspectorServiceLsDetailsStream) error {
log.Infof("LsDetails %q", Glob)
return s.ls(Glob, true, &stubbedServer{context: context, details: Stream})
}
diff --git a/examples/rockpaperscissors/impl/impl.go b/examples/rockpaperscissors/impl/impl.go
index 602fe07..c16d0aa 100644
--- a/examples/rockpaperscissors/impl/impl.go
+++ b/examples/rockpaperscissors/impl/impl.go
@@ -33,7 +33,7 @@
return r.scoreKeeper
}
-func (r *RPS) CreateGame(ctx ipc.Context, opts rps.GameOptions) (rps.GameID, error) {
+func (r *RPS) CreateGame(ctx ipc.ServerContext, opts rps.GameOptions) (rps.GameID, error) {
vlog.VI(1).Infof("CreateGame %+v from %s", opts, ctx.RemoteID())
names := ctx.LocalID().Names()
if len(names) == 0 {
@@ -42,7 +42,7 @@
return r.judge.createGame(names[0], opts)
}
-func (r *RPS) Play(ctx ipc.Context, id rps.GameID, stream rps.JudgeServicePlayStream) (rps.PlayResult, error) {
+func (r *RPS) Play(ctx ipc.ServerContext, id rps.GameID, stream rps.JudgeServicePlayStream) (rps.PlayResult, error) {
vlog.VI(1).Infof("Play %+v from %s", id, ctx.RemoteID())
names := ctx.RemoteID().Names()
if len(names) == 0 {
@@ -51,12 +51,12 @@
return r.judge.play(names[0], id, stream)
}
-func (r *RPS) Challenge(ctx ipc.Context, address string, id rps.GameID) error {
+func (r *RPS) Challenge(ctx ipc.ServerContext, address string, id rps.GameID) error {
vlog.VI(1).Infof("Challenge (%q, %+v) from %s", address, id, ctx.RemoteID())
return r.player.challenge(address, id)
}
-func (r *RPS) Record(ctx ipc.Context, score rps.ScoreCard) error {
+func (r *RPS) Record(ctx ipc.ServerContext, score rps.ScoreCard) error {
vlog.VI(1).Infof("Record (%+v) from %s", score, ctx.RemoteID())
return r.scoreKeeper.Record(ctx, score)
}
diff --git a/examples/rockpaperscissors/impl/judge.go b/examples/rockpaperscissors/impl/judge.go
index 02ac79d..75c2b59 100644
--- a/examples/rockpaperscissors/impl/judge.go
+++ b/examples/rockpaperscissors/impl/judge.go
@@ -11,6 +11,7 @@
"veyron/examples/rockpaperscissors/common"
"veyron2/naming"
+ "veyron2/rt"
"veyron2/vlog"
)
@@ -292,7 +293,7 @@
vlog.Infof("BindRockPaperScissors: %v", err)
return err
}
- err = k.Record(score)
+ err = k.Record(rt.R().TODOContext(), score)
if err != nil {
vlog.Infof("Record: %v", err)
return err
diff --git a/examples/rockpaperscissors/impl/player.go b/examples/rockpaperscissors/impl/player.go
index e423491..fa7ee3a 100644
--- a/examples/rockpaperscissors/impl/player.go
+++ b/examples/rockpaperscissors/impl/player.go
@@ -11,6 +11,7 @@
"veyron2"
"veyron2/naming"
+ "veyron2/rt"
"veyron2/vlog"
)
@@ -77,7 +78,7 @@
if rand.Intn(2) == 1 {
gameType = rps.LizardSpock
}
- return j.CreateGame(rps.GameOptions{NumRounds: int32(numRounds), GameType: gameType})
+ return j.CreateGame(rt.R().TODOContext(), rps.GameOptions{NumRounds: int32(numRounds), GameType: gameType})
}
func (p *Player) sendChallenge(opponent, judge string, gameID rps.GameID) error {
@@ -85,7 +86,7 @@
if err != nil {
return err
}
- return o.Challenge(judge, gameID)
+ return o.Challenge(rt.R().TODOContext(), judge, gameID)
}
// challenge receives an incoming challenge.
@@ -102,7 +103,7 @@
if err != nil {
return rps.PlayResult{}, err
}
- game, err := j.Play(gameID, veyron2.CallTimeout(10*time.Minute))
+ game, err := j.Play(rt.R().TODOContext(), gameID, veyron2.CallTimeout(10*time.Minute))
if err != nil {
return rps.PlayResult{}, err
}
diff --git a/examples/rockpaperscissors/impl/scorekeeper.go b/examples/rockpaperscissors/impl/scorekeeper.go
index e98cc31..91525ae 100644
--- a/examples/rockpaperscissors/impl/scorekeeper.go
+++ b/examples/rockpaperscissors/impl/scorekeeper.go
@@ -20,7 +20,7 @@
return k.numRecords.Value()
}
-func (k *ScoreKeeper) Record(ctx ipc.Context, score rps.ScoreCard) error {
+func (k *ScoreKeeper) Record(ctx ipc.ServerContext, score rps.ScoreCard) error {
vlog.Infof("Received ScoreCard from %s:", ctx.RemoteID())
vlog.Info(common.FormatScoreCard(score))
k.numRecords.Add(1)
diff --git a/examples/rockpaperscissors/rpsscorekeeper/main.go b/examples/rockpaperscissors/rpsscorekeeper/main.go
index 38ca2a7..54a7425 100644
--- a/examples/rockpaperscissors/rpsscorekeeper/main.go
+++ b/examples/rockpaperscissors/rpsscorekeeper/main.go
@@ -27,7 +27,7 @@
ch chan rps.ScoreCard
}
-func (i *impl) Record(ctx ipc.Context, score rps.ScoreCard) error {
+func (i *impl) Record(ctx ipc.ServerContext, score rps.ScoreCard) error {
vlog.VI(1).Infof("Record (%+v) from %s", score, ctx.RemoteID())
i.ch <- score
return nil
diff --git a/examples/rockpaperscissors/service.vdl.go b/examples/rockpaperscissors/service.vdl.go
index 11b55c5..3b2c8cd 100644
--- a/examples/rockpaperscissors/service.vdl.go
+++ b/examples/rockpaperscissors/service.vdl.go
@@ -84,9 +84,9 @@
type Judge_ExcludingUniversal interface {
// CreateGame creates a new game with the given game options and returns a game
// identifier that can be used by the players to join the game.
- CreateGame(Opts GameOptions, opts ..._gen_ipc.ClientCallOpt) (reply GameID, err error)
+ CreateGame(ctx _gen_ipc.Context, Opts GameOptions, opts ..._gen_ipc.CallOpt) (reply GameID, err error)
// Play lets a player join an existing game and play.
- Play(ID GameID, opts ..._gen_ipc.ClientCallOpt) (reply JudgePlayStream, err error)
+ Play(ctx _gen_ipc.Context, ID GameID, opts ..._gen_ipc.CallOpt) (reply JudgePlayStream, err error)
}
type Judge interface {
_gen_ipc.UniversalServiceMethods
@@ -98,9 +98,9 @@
// CreateGame creates a new game with the given game options and returns a game
// identifier that can be used by the players to join the game.
- CreateGame(context _gen_ipc.Context, Opts GameOptions) (reply GameID, err error)
+ CreateGame(context _gen_ipc.ServerContext, Opts GameOptions) (reply GameID, err error)
// Play lets a player join an existing game and play.
- Play(context _gen_ipc.Context, ID GameID, stream JudgeServicePlayStream) (reply PlayResult, err error)
+ Play(context _gen_ipc.ServerContext, ID GameID, stream JudgeServicePlayStream) (reply PlayResult, err error)
}
// JudgePlayStream is the interface for streaming responses of the method
@@ -131,7 +131,7 @@
// Implementation of the JudgePlayStream interface that is not exported.
type implJudgePlayStream struct {
- clientCall _gen_ipc.ClientCall
+ clientCall _gen_ipc.Call
}
func (c *implJudgePlayStream) Send(item PlayerAction) error {
@@ -227,9 +227,9 @@
name string
}
-func (__gen_c *clientStubJudge) CreateGame(Opts GameOptions, opts ..._gen_ipc.ClientCallOpt) (reply GameID, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "CreateGame", []interface{}{Opts}, opts...); err != nil {
+func (__gen_c *clientStubJudge) CreateGame(ctx _gen_ipc.Context, Opts GameOptions, opts ..._gen_ipc.CallOpt) (reply GameID, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "CreateGame", []interface{}{Opts}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -238,18 +238,18 @@
return
}
-func (__gen_c *clientStubJudge) Play(ID GameID, opts ..._gen_ipc.ClientCallOpt) (reply JudgePlayStream, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Play", []interface{}{ID}, opts...); err != nil {
+func (__gen_c *clientStubJudge) Play(ctx _gen_ipc.Context, ID GameID, opts ..._gen_ipc.CallOpt) (reply JudgePlayStream, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Play", []interface{}{ID}, opts...); err != nil {
return
}
reply = &implJudgePlayStream{clientCall: call}
return
}
-func (__gen_c *clientStubJudge) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubJudge) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -258,9 +258,9 @@
return
}
-func (__gen_c *clientStubJudge) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubJudge) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -269,9 +269,9 @@
return
}
-func (__gen_c *clientStubJudge) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubJudge) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -416,7 +416,7 @@
type Player_ExcludingUniversal interface {
// Challenge is used by other players to challenge this player to a game. If
// the challenge is accepted, the method returns nil.
- Challenge(Address string, ID GameID, opts ..._gen_ipc.ClientCallOpt) (err error)
+ Challenge(ctx _gen_ipc.Context, Address string, ID GameID, opts ..._gen_ipc.CallOpt) (err error)
}
type Player interface {
_gen_ipc.UniversalServiceMethods
@@ -428,7 +428,7 @@
// Challenge is used by other players to challenge this player to a game. If
// the challenge is accepted, the method returns nil.
- Challenge(context _gen_ipc.Context, Address string, ID GameID) (err error)
+ Challenge(context _gen_ipc.ServerContext, Address string, ID GameID) (err error)
}
// BindPlayer returns the client stub implementing the Player
@@ -474,9 +474,9 @@
name string
}
-func (__gen_c *clientStubPlayer) Challenge(Address string, ID GameID, opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Challenge", []interface{}{Address, ID}, opts...); err != nil {
+func (__gen_c *clientStubPlayer) Challenge(ctx _gen_ipc.Context, Address string, ID GameID, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Challenge", []interface{}{Address, ID}, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -485,9 +485,9 @@
return
}
-func (__gen_c *clientStubPlayer) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubPlayer) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -496,9 +496,9 @@
return
}
-func (__gen_c *clientStubPlayer) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubPlayer) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -507,9 +507,9 @@
return
}
-func (__gen_c *clientStubPlayer) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubPlayer) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -588,7 +588,7 @@
// ScoreKeeper_ExcludingUniversal is the interface without internal framework-added methods
// to enable embedding without method collisions. Not to be used directly by clients.
type ScoreKeeper_ExcludingUniversal interface {
- Record(Score ScoreCard, opts ..._gen_ipc.ClientCallOpt) (err error)
+ Record(ctx _gen_ipc.Context, Score ScoreCard, opts ..._gen_ipc.CallOpt) (err error)
}
type ScoreKeeper interface {
_gen_ipc.UniversalServiceMethods
@@ -597,7 +597,7 @@
// ScoreKeeperService is the interface the server implements.
type ScoreKeeperService interface {
- Record(context _gen_ipc.Context, Score ScoreCard) (err error)
+ Record(context _gen_ipc.ServerContext, Score ScoreCard) (err error)
}
// BindScoreKeeper returns the client stub implementing the ScoreKeeper
@@ -643,9 +643,9 @@
name string
}
-func (__gen_c *clientStubScoreKeeper) Record(Score ScoreCard, opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Record", []interface{}{Score}, opts...); err != nil {
+func (__gen_c *clientStubScoreKeeper) Record(ctx _gen_ipc.Context, Score ScoreCard, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Record", []interface{}{Score}, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -654,9 +654,9 @@
return
}
-func (__gen_c *clientStubScoreKeeper) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubScoreKeeper) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -665,9 +665,9 @@
return
}
-func (__gen_c *clientStubScoreKeeper) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubScoreKeeper) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -676,9 +676,9 @@
return
}
-func (__gen_c *clientStubScoreKeeper) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubScoreKeeper) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -848,9 +848,9 @@
name string
}
-func (__gen_c *clientStubRockPaperScissors) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubRockPaperScissors) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -859,9 +859,9 @@
return
}
-func (__gen_c *clientStubRockPaperScissors) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubRockPaperScissors) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -870,9 +870,9 @@
return
}
-func (__gen_c *clientStubRockPaperScissors) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubRockPaperScissors) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
diff --git a/examples/storage/mdb/mdb_init/main.go b/examples/storage/mdb/mdb_init/main.go
index 15b2066..4cc4a83 100644
--- a/examples/storage/mdb/mdb_init/main.go
+++ b/examples/storage/mdb/mdb_init/main.go
@@ -148,7 +148,7 @@
func (st *state) put(path string, v interface{}) {
vlog.Infof("Storing %q = %+v", path, v)
st.makeParentDirs(path)
- if _, err := st.store.Bind(path).Put(st.transaction, v); err != nil {
+ if _, err := st.store.Bind(path).Put(rt.R().TODOContext(), st.transaction, v); err != nil {
vlog.Infof("put failed: %s: %s", path, err)
return
}
@@ -159,7 +159,7 @@
func (st *state) putNamed(name, path string, v interface{}) {
vlog.Infof("Storing %s: %q = %+v", name, path, v)
st.makeParentDirs(path)
- s, err := st.store.Bind(path).Put(st.transaction, v)
+ s, err := st.store.Bind(path).Put(rt.R().TODOContext(), st.transaction, v)
if err != nil {
vlog.Infof("Put failed: %s: %s", path, err)
return
@@ -174,10 +174,10 @@
for i, _ := range l {
prefix := filepath.Join(l[:i]...)
o := st.store.Bind(prefix)
- if exist, err := o.Exists(st.transaction); err != nil {
+ if exist, err := o.Exists(rt.R().TODOContext(), st.transaction); err != nil {
vlog.Infof("Error checking existence at %q: %s", prefix, err)
} else if !exist {
- if _, err := o.Put(st.transaction, &schema.Dir{}); err != nil {
+ if _, err := o.Put(rt.R().TODOContext(), st.transaction, &schema.Dir{}); err != nil {
vlog.Infof("Error creating parent %q: %s", prefix, err)
}
}
@@ -186,12 +186,12 @@
// newTransaction starts a new transaction.
func (st *state) newTransaction() {
- st.transaction = primitives.NewTransaction()
+ st.transaction = primitives.NewTransaction(rt.R().TODOContext())
}
// commit commits the current transaction.
func (st *state) commit() {
- if err := st.transaction.Commit(); err != nil {
+ if err := st.transaction.Commit(rt.R().TODOContext()); err != nil {
vlog.Infof("Failed to commit transaction: %s", err)
}
st.transaction = nil
diff --git a/examples/storage/viewer/value.go b/examples/storage/viewer/value.go
index 7bb2dfc..fc1d450 100644
--- a/examples/storage/viewer/value.go
+++ b/examples/storage/viewer/value.go
@@ -5,6 +5,7 @@
"sort"
"time"
+ "veyron2/rt"
"veyron2/storage"
)
@@ -20,7 +21,7 @@
// glob performs a glob expansion of the pattern. The results are sorted.
func glob(st storage.Store, path, pattern string) ([]string, error) {
- results, err := st.Bind(path).GlobT(nil, pattern)
+ results, err := st.Bind(path).GlobT(rt.R().TODOContext(), nil, pattern)
if err != nil {
return nil, err
}
@@ -70,7 +71,7 @@
// exist.
func (v *Value) Get(path string) interface{} {
path = v.fullpath(path)
- e, err := v.store.Bind(path).Get(nil)
+ e, err := v.store.Bind(path).Get(rt.R().TODOContext(), nil)
if err != nil {
return nil
}
diff --git a/examples/storage/viewer/viewer.go b/examples/storage/viewer/viewer.go
index 9237b90..b97d499 100644
--- a/examples/storage/viewer/viewer.go
+++ b/examples/storage/viewer/viewer.go
@@ -24,6 +24,7 @@
"net/http"
"path/filepath"
+ "veyron2/rt"
"veyron2/storage"
"veyron2/vlog"
)
@@ -72,7 +73,7 @@
// is based on the type of the value, under /template/<pkgPath>/<typeName>.
func (s *server) loadTemplate(v interface{}) *template.Template {
path := templatePath(v)
- e, err := s.store.Bind(path).Get(nil)
+ e, err := s.store.Bind(path).Get(rt.R().TODOContext(), nil)
if err != nil {
return nil
}
@@ -124,7 +125,7 @@
// ServeHTTP is the main HTTP handler.
func (s *server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
path := req.URL.Path
- e, err := s.store.Bind(path).Get(nil)
+ e, err := s.store.Bind(path).Get(rt.R().TODOContext(), nil)
if err != nil {
msg := fmt.Sprintf("<html><body><h1>%s</h1><h2>Error: %s</h2></body></html>",
html.EscapeString(path),
diff --git a/examples/todos/test/store_test.go b/examples/todos/test/store_test.go
index 1131530..f1736cf 100644
--- a/examples/todos/test/store_test.go
+++ b/examples/todos/test/store_test.go
@@ -20,6 +20,7 @@
bb "veyron/lib/testutil/blackbox"
+ "veyron2/rt"
"veyron2/storage"
"veyron2/storage/vstore/primitives"
"veyron2/vom"
@@ -118,10 +119,11 @@
// Test cases
func testTodos(t *testing.T, st storage.Store) {
+ ctx := rt.R().NewContext()
// Create lists.
{
// NOTE(sadovsky): Currently, we can't put /x/y until we put / and /x.
- tr := primitives.NewTransaction()
+ tr := primitives.NewTransaction(ctx)
put(t, st, tr, "/", newDir())
put(t, st, tr, "/lists", newDir())
put(t, st, tr, "/lists/drinks", newList())
@@ -131,7 +133,7 @@
// Add some todos.
{
- tr := primitives.NewTransaction()
+ tr := primitives.NewTransaction(ctx)
// NOTE(sadovsky): It feels awkward to create my own names (ids) for these
// Todo objects. I'd like some way to create them in some "directory"
// without explicitly naming them. I.e. in this case I want to think of the
@@ -144,7 +146,7 @@
// Verify some of the photos.
{
- tr := primitives.NewTransaction()
+ tr := primitives.NewTransaction(ctx)
todo := getTodo(t, st, tr, "/lists/drinks/Todos/0")
if todo.Text != "milk" {
t.Errorf("Expected %q, got %q", "milk", todo.Text)
@@ -152,7 +154,7 @@
}
{
- tr := primitives.NewTransaction()
+ tr := primitives.NewTransaction(ctx)
todo := getTodo(t, st, tr, "/lists/snacks/Todos/0")
if todo.Text != "chips" {
t.Errorf("Expected %q, got %q", "chips", todo.Text)
@@ -161,7 +163,7 @@
// Move a todo item from one list to another.
{
- tr := primitives.NewTransaction()
+ tr := primitives.NewTransaction(ctx)
todo := getTodo(t, st, tr, "/lists/drinks/Todos/1")
// NOTE(sadovsky): Remove works for map entries, but not yet for slices.
// Instead, we read the list, prune it, and write it back.
@@ -176,11 +178,11 @@
// Verify that the original todo is no longer there.
// TODO(sadovsky): Use queries to verify that both lists have changed.
{
- tr := primitives.NewTransaction()
+ tr := primitives.NewTransaction(ctx)
// Note, this will be much prettier in veyron2.
_, file, line, _ := runtime.Caller(1)
path := "/lists/drinks/1"
- if _, err := st.Bind(path).Get(tr); err == nil {
+ if _, err := st.Bind(path).Get(ctx, tr); err == nil {
t.Fatalf("%s(%d): got removed object %s", file, line, path)
}
}
diff --git a/examples/todos/test/store_util.go b/examples/todos/test/store_util.go
index 503ea73..aff92b3 100644
--- a/examples/todos/test/store_util.go
+++ b/examples/todos/test/store_util.go
@@ -4,12 +4,13 @@
"runtime"
"testing"
+ "veyron2/rt"
"veyron2/storage"
)
func get(t *testing.T, st storage.Store, tr storage.Transaction, path string) interface{} {
_, file, line, _ := runtime.Caller(1)
- e, err := st.Bind(path).Get(tr)
+ e, err := st.Bind(path).Get(rt.R().NewContext(), tr)
if err != nil {
t.Fatalf("%s(%d): can't get %s: %s", file, line, path, err)
}
@@ -18,7 +19,7 @@
func put(t *testing.T, st storage.Store, tr storage.Transaction, path string, v interface{}) storage.ID {
_, file, line, _ := runtime.Caller(1)
- stat, err := st.Bind(path).Put(tr, v)
+ stat, err := st.Bind(path).Put(rt.R().NewContext(), tr, v)
if err != nil || !stat.ID.IsValid() {
t.Fatalf("%s(%d): can't put %s: %s", file, line, path, err)
}
@@ -26,14 +27,14 @@
}
func remove(t *testing.T, st storage.Store, tr storage.Transaction, path string) {
- if err := st.Bind(path).Remove(tr); err != nil {
+ if err := st.Bind(path).Remove(rt.R().NewContext(), tr); err != nil {
_, file, line, _ := runtime.Caller(1)
t.Errorf("%s(%d): can't remove %s: %s", file, line, path, err)
}
}
func commit(t *testing.T, tr storage.Transaction) {
- if err := tr.Commit(); err != nil {
+ if err := tr.Commit(rt.R().NewContext()); err != nil {
t.Fatalf("Transaction aborted: %s", err)
}
}
diff --git a/examples/todos/todos_init/main.go b/examples/todos/todos_init/main.go
index de829b3..6121a38 100644
--- a/examples/todos/todos_init/main.go
+++ b/examples/todos/todos_init/main.go
@@ -74,7 +74,7 @@
func (st *state) put(path string, v interface{}) {
vlog.Infof("Storing %q = %+v", path, v)
st.makeParentDirs(path)
- if _, err := st.store.Bind(path).Put(st.transaction, v); err != nil {
+ if _, err := st.store.Bind(path).Put(rt.R().TODOContext(), st.transaction, v); err != nil {
vlog.Errorf("put failed: %s: %s", path, err)
return
}
@@ -87,8 +87,8 @@
for i, _ := range l {
prefix := filepath.Join(l[:i]...)
o := st.store.Bind(prefix)
- if _, err := o.Get(st.transaction); err != nil {
- if _, err := o.Put(st.transaction, &schema.Dir{}); err != nil {
+ if _, err := o.Get(rt.R().TODOContext(), st.transaction); err != nil {
+ if _, err := o.Put(rt.R().TODOContext(), st.transaction, &schema.Dir{}); err != nil {
vlog.Errorf("Error creating parent %q: %s", prefix, err)
}
}
@@ -97,12 +97,12 @@
// newTransaction starts a new transaction.
func (st *state) newTransaction() {
- st.transaction = primitives.NewTransaction()
+ st.transaction = primitives.NewTransaction(rt.R().TODOContext())
}
// commit commits the current transaction.
func (st *state) commit() {
- if err := st.transaction.Commit(); err != nil {
+ if err := st.transaction.Commit(rt.R().TODOContext()); err != nil {
vlog.Errorf("Failed to commit transaction: %s", err)
}
st.transaction = nil
diff --git a/examples/tunnel/tunnel.vdl.go b/examples/tunnel/tunnel.vdl.go
index fb26dbb..32fbb6c 100644
--- a/examples/tunnel/tunnel.vdl.go
+++ b/examples/tunnel/tunnel.vdl.go
@@ -45,13 +45,13 @@
// the byte stream is forwarded to the requested network address and all the
// data received from that network connection is sent back in the reply
// stream.
- Forward(network string, address string, opts ..._gen_ipc.ClientCallOpt) (reply TunnelForwardStream, err error)
+ Forward(ctx _gen_ipc.Context, network string, address string, opts ..._gen_ipc.CallOpt) (reply TunnelForwardStream, err error)
// The Shell method is used to either run shell commands remotely, or to open
// an interactive shell. The data received over the byte stream is sent to the
// shell's stdin, and the data received from the shell's stdout and stderr is
// sent back in the reply stream. It returns the exit status of the shell
// command.
- Shell(command string, shellOpts ShellOpts, opts ..._gen_ipc.ClientCallOpt) (reply TunnelShellStream, err error)
+ Shell(ctx _gen_ipc.Context, command string, shellOpts ShellOpts, opts ..._gen_ipc.CallOpt) (reply TunnelShellStream, err error)
}
type Tunnel interface {
_gen_ipc.UniversalServiceMethods
@@ -65,13 +65,13 @@
// the byte stream is forwarded to the requested network address and all the
// data received from that network connection is sent back in the reply
// stream.
- Forward(context _gen_ipc.Context, network string, address string, stream TunnelServiceForwardStream) (err error)
+ Forward(context _gen_ipc.ServerContext, network string, address string, stream TunnelServiceForwardStream) (err error)
// The Shell method is used to either run shell commands remotely, or to open
// an interactive shell. The data received over the byte stream is sent to the
// shell's stdin, and the data received from the shell's stdout and stderr is
// sent back in the reply stream. It returns the exit status of the shell
// command.
- Shell(context _gen_ipc.Context, command string, shellOpts ShellOpts, stream TunnelServiceShellStream) (reply int32, err error)
+ Shell(context _gen_ipc.ServerContext, command string, shellOpts ShellOpts, stream TunnelServiceShellStream) (reply int32, err error)
}
// TunnelForwardStream is the interface for streaming responses of the method
@@ -102,7 +102,7 @@
// Implementation of the TunnelForwardStream interface that is not exported.
type implTunnelForwardStream struct {
- clientCall _gen_ipc.ClientCall
+ clientCall _gen_ipc.Call
}
func (c *implTunnelForwardStream) Send(item []byte) error {
@@ -183,7 +183,7 @@
// Implementation of the TunnelShellStream interface that is not exported.
type implTunnelShellStream struct {
- clientCall _gen_ipc.ClientCall
+ clientCall _gen_ipc.Call
}
func (c *implTunnelShellStream) Send(item ClientShellPacket) error {
@@ -279,27 +279,27 @@
name string
}
-func (__gen_c *clientStubTunnel) Forward(network string, address string, opts ..._gen_ipc.ClientCallOpt) (reply TunnelForwardStream, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Forward", []interface{}{network, address}, opts...); err != nil {
+func (__gen_c *clientStubTunnel) Forward(ctx _gen_ipc.Context, network string, address string, opts ..._gen_ipc.CallOpt) (reply TunnelForwardStream, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Forward", []interface{}{network, address}, opts...); err != nil {
return
}
reply = &implTunnelForwardStream{clientCall: call}
return
}
-func (__gen_c *clientStubTunnel) Shell(command string, shellOpts ShellOpts, opts ..._gen_ipc.ClientCallOpt) (reply TunnelShellStream, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Shell", []interface{}{command, shellOpts}, opts...); err != nil {
+func (__gen_c *clientStubTunnel) Shell(ctx _gen_ipc.Context, command string, shellOpts ShellOpts, opts ..._gen_ipc.CallOpt) (reply TunnelShellStream, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Shell", []interface{}{command, shellOpts}, opts...); err != nil {
return
}
reply = &implTunnelShellStream{clientCall: call}
return
}
-func (__gen_c *clientStubTunnel) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubTunnel) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -308,9 +308,9 @@
return
}
-func (__gen_c *clientStubTunnel) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubTunnel) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -319,9 +319,9 @@
return
}
-func (__gen_c *clientStubTunnel) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubTunnel) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
diff --git a/examples/tunnel/tunneld/impl/impl.go b/examples/tunnel/tunneld/impl/impl.go
index cd210ed..9458947 100644
--- a/examples/tunnel/tunneld/impl/impl.go
+++ b/examples/tunnel/tunneld/impl/impl.go
@@ -22,7 +22,7 @@
type T struct {
}
-func (t *T) Forward(ctx ipc.Context, network, address string, stream tunnel.TunnelServiceForwardStream) error {
+func (t *T) Forward(ctx ipc.ServerContext, network, address string, stream tunnel.TunnelServiceForwardStream) error {
conn, err := net.Dial(network, address)
if err != nil {
return err
@@ -34,7 +34,7 @@
return err
}
-func (t *T) Shell(ctx ipc.Context, command string, shellOpts tunnel.ShellOpts, stream tunnel.TunnelServiceShellStream) (int32, error) {
+func (t *T) Shell(ctx ipc.ServerContext, command string, shellOpts tunnel.ShellOpts, stream tunnel.TunnelServiceShellStream) (int32, error) {
vlog.Infof("SHELL START for %v: %q", ctx.RemoteID(), command)
const nonShellErrorCode = 255
diff --git a/examples/tunnel/vsh/main.go b/examples/tunnel/vsh/main.go
index 943835e..42165b4 100644
--- a/examples/tunnel/vsh/main.go
+++ b/examples/tunnel/vsh/main.go
@@ -96,7 +96,7 @@
opts := shellOptions(cmd)
- stream, err := t.Shell(cmd, opts, veyron2.CallTimeout(24*time.Hour))
+ stream, err := t.Shell(rt.R().TODOContext(), cmd, opts, veyron2.CallTimeout(24*time.Hour))
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
return 1
@@ -196,7 +196,7 @@
vlog.Infof("Accept failed: %v", err)
continue
}
- stream, err := t.Forward(*rprotocol, raddr, veyron2.CallTimeout(24*time.Hour))
+ stream, err := t.Forward(rt.R().TODOContext(), *rprotocol, raddr, veyron2.CallTimeout(24*time.Hour))
if err != nil {
vlog.Infof("Tunnel(%q, %q) failed: %v", *rprotocol, raddr, err)
conn.Close()
diff --git a/examples/unresolve/test_util.go b/examples/unresolve/test_util.go
index 0b6f6c2..7805910 100644
--- a/examples/unresolve/test_util.go
+++ b/examples/unresolve/test_util.go
@@ -80,11 +80,11 @@
type fortune struct{}
-func (*fortune) Get(ipc.Context) (string, error) {
+func (*fortune) Get(ipc.ServerContext) (string, error) {
return fixedFortuneMessage, nil
}
-func (*fortune) Add(ipc.Context, string) error {
+func (*fortune) Add(ipc.ServerContext, string) error {
return nil
}
@@ -100,15 +100,15 @@
custom string
}
-func (*fortuneCustomUnresolve) Get(ipc.Context) (string, error) {
+func (*fortuneCustomUnresolve) Get(ipc.ServerContext) (string, error) {
return fixedFortuneMessage, nil
}
-func (*fortuneCustomUnresolve) Add(ipc.Context, string) error {
+func (*fortuneCustomUnresolve) Add(ipc.ServerContext, string) error {
return nil
}
-func (*fortuneCustomUnresolve) UnresolveStep(context ipc.Context) ([]string, error) {
+func (*fortuneCustomUnresolve) UnresolveStep(context ipc.ServerContext) ([]string, error) {
servers, err := rt.R().MountTable().ResolveToMountTable("I/want/to/know")
if err != nil {
return nil, err
@@ -171,7 +171,7 @@
func resolveStep(t *testing.T, name string) string {
client := createMTClient(name)
- results, suffix, err := client.ResolveStep()
+ results, suffix, err := client.ResolveStep(rt.R().NewContext())
if err != nil {
t.Errorf("ResolveStep on %q failed with %v", name, err)
return ""
@@ -197,11 +197,11 @@
}
type unresolver interface {
- UnresolveStep(...ipc.ClientCallOpt) ([]string, error)
+ UnresolveStep(ipc.Context, ...ipc.CallOpt) ([]string, error)
}
-func unresolveStep(t *testing.T, c unresolver) string {
- unres, err := c.UnresolveStep()
+func unresolveStep(t *testing.T, ctx ipc.Context, c unresolver) string {
+ unres, err := c.UnresolveStep(ctx)
if err != nil {
t.Errorf("UnresolveStep failed with %v", err)
return ""
diff --git a/examples/unresolve/unresolve_test.go b/examples/unresolve/unresolve_test.go
index f7c2e1a..ffb84e2 100644
--- a/examples/unresolve/unresolve_test.go
+++ b/examples/unresolve/unresolve_test.go
@@ -201,6 +201,7 @@
os.Setenv("VEYRON_IDENTITY", idFile)
r, _ := rt.New(veyron2.MountTableRoots([]string{aOA}))
+ ctx := r.NewContext()
resolveCases := []struct {
name, resolved string
@@ -249,19 +250,19 @@
for _, c := range unresolveStepCases {
// Verify that we can talk to the server.
client := createFortuneClient(r, c.name)
- if fortuneMessage, err := client.Get(); err != nil {
+ if fortuneMessage, err := client.Get(r.NewContext()); err != nil {
t.Errorf("fortune.Get failed with %v", err)
} else if fortuneMessage != fixedFortuneMessage {
t.Errorf("fortune expected %q, got %q instead", fixedFortuneMessage, fortuneMessage)
}
// Unresolve, one step.
- if want, got := c.unresStep1, unresolveStep(t, client); want != got {
+ if want, got := c.unresStep1, unresolveStep(t, ctx, client); want != got {
t.Errorf("fortune.UnresolveStep expected %q, got %q instead", want, got)
}
// Go up the tree, unresolve another step.
- if want, got := c.unresStep2, unresolveStep(t, createMTClient(naming.MakeTerminal(c.unresStep1))); want != got {
+ if want, got := c.unresStep2, unresolveStep(t, ctx, createMTClient(naming.MakeTerminal(c.unresStep1))); want != got {
t.Errorf("mt.UnresolveStep expected %q, got %q instead", want, got)
}
}
@@ -271,14 +272,14 @@
// Verify that we can talk to server E.
eClient := createFortuneClient(r, "b/mt/e1/fortune")
- if fortuneMessage, err := eClient.Get(); err != nil {
+ if fortuneMessage, err := eClient.Get(ctx); err != nil {
t.Errorf("fortune.Get failed with %v", err)
} else if fortuneMessage != fixedFortuneMessage {
t.Errorf("fortune expected %q, got %q instead", fixedFortuneMessage, fortuneMessage)
}
// Unresolve E, one step.
- eUnres, err := eClient.UnresolveStep()
+ eUnres, err := eClient.UnresolveStep(ctx)
if err != nil {
t.Errorf("UnresolveStep failed with %v", err)
}
@@ -288,12 +289,12 @@
// Try unresolve step on a random name in B.
if want, got := naming.JoinAddressName(aAddr, "mt/b/mt/some/random/name"),
- unresolveStep(t, createMTClient(naming.JoinAddressName(bAddr, "//mt/some/random/name"))); want != got {
+ unresolveStep(t, ctx, createMTClient(naming.JoinAddressName(bAddr, "//mt/some/random/name"))); want != got {
t.Errorf("b.UnresolveStep expected %q, got %q instead", want, got)
}
// Try unresolve step on a random name in A.
- if unres, err := createMTClient(naming.JoinAddressName(aAddr, "//mt/another/random/name")).UnresolveStep(); err != nil {
+ if unres, err := createMTClient(naming.JoinAddressName(aAddr, "//mt/another/random/name")).UnresolveStep(ctx); err != nil {
t.Errorf("UnresolveStep failed with %v", err)
} else if len(unres) > 0 {
t.Errorf("b.UnresolveStep expected no results, got %q instead", unres)
diff --git a/examples/wspr_sample/cache.vdl.go b/examples/wspr_sample/cache.vdl.go
index da23ee0..d19d606 100644
--- a/examples/wspr_sample/cache.vdl.go
+++ b/examples/wspr_sample/cache.vdl.go
@@ -25,45 +25,45 @@
// to enable embedding without method collisions. Not to be used directly by clients.
type Cache_ExcludingUniversal interface {
// Set sets a value for a key.
- Set(key string, value _gen_vdl.Any, opts ..._gen_ipc.ClientCallOpt) (err error)
+ Set(ctx _gen_ipc.Context, key string, value _gen_vdl.Any, opts ..._gen_ipc.CallOpt) (err error)
// Get returns the value for a key. If the value is not found, returns
// a not found error.
- Get(key string, opts ..._gen_ipc.ClientCallOpt) (reply _gen_vdl.Any, err error)
+ Get(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply _gen_vdl.Any, err error)
// Same as Get, but casts the return argument to an byte.
- GetAsByte(key string, opts ..._gen_ipc.ClientCallOpt) (reply byte, err error)
+ GetAsByte(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply byte, err error)
// Same as Get, but casts the return argument to an int32.
- GetAsInt32(key string, opts ..._gen_ipc.ClientCallOpt) (reply int32, err error)
+ GetAsInt32(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply int32, err error)
// Same as Get, but casts the return argument to an int64.
- GetAsInt64(key string, opts ..._gen_ipc.ClientCallOpt) (reply int64, err error)
+ GetAsInt64(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply int64, err error)
// Same as Get, but casts the return argument to an uint32.
- GetAsUint32(key string, opts ..._gen_ipc.ClientCallOpt) (reply uint32, err error)
+ GetAsUint32(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply uint32, err error)
// Same as Get, but casts the return argument to an uint64.
- GetAsUint64(key string, opts ..._gen_ipc.ClientCallOpt) (reply uint64, err error)
+ GetAsUint64(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply uint64, err error)
// Same as Get, but casts the return argument to an float32.
- GetAsFloat32(key string, opts ..._gen_ipc.ClientCallOpt) (reply float32, err error)
+ GetAsFloat32(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply float32, err error)
// Same as Get, but casts the return argument to an float64.
- GetAsFloat64(key string, opts ..._gen_ipc.ClientCallOpt) (reply float64, err error)
+ GetAsFloat64(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply float64, err error)
// Same as Get, but casts the return argument to a string.
- GetAsString(key string, opts ..._gen_ipc.ClientCallOpt) (reply string, err error)
+ GetAsString(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply string, err error)
// Same as Get, but casts the return argument to a bool.
- GetAsBool(key string, opts ..._gen_ipc.ClientCallOpt) (reply bool, err error)
+ GetAsBool(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply bool, err error)
// Same as Get, but casts the return argument to an error.
- GetAsError(key string, opts ..._gen_ipc.ClientCallOpt) (reply error, err error)
+ GetAsError(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply error, err error)
// AsMap returns the full contents of the cache as a map.
- AsMap(opts ..._gen_ipc.ClientCallOpt) (reply map[string]_gen_vdl.Any, err error)
+ AsMap(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply map[string]_gen_vdl.Any, err error)
// KeyValuePairs returns the full contents of the cache as a slice of pairs.
- KeyValuePairs(opts ..._gen_ipc.ClientCallOpt) (reply []KeyValuePair, err error)
+ KeyValuePairs(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []KeyValuePair, err error)
// MostRecentSet returns the key and value and the timestamp for the most
// recent set operation
// TODO(bprosnitz) support type types and change time to native time type
- MostRecentSet(opts ..._gen_ipc.ClientCallOpt) (value KeyValuePair, time int64, err error)
+ MostRecentSet(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (value KeyValuePair, time int64, err error)
// KeyPage indexes into the keys (in alphanumerically sorted order) and
// returns the indexth page of 10 keys.
- KeyPage(index int64, opts ..._gen_ipc.ClientCallOpt) (reply [10]string, err error)
+ KeyPage(ctx _gen_ipc.Context, index int64, opts ..._gen_ipc.CallOpt) (reply [10]string, err error)
// Size returns the total number of entries in the cache.
- Size(opts ..._gen_ipc.ClientCallOpt) (reply int64, err error)
+ Size(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply int64, err error)
// MultiGet sets up a stream that allows fetching multiple keys.
- MultiGet(opts ..._gen_ipc.ClientCallOpt) (reply CacheMultiGetStream, err error)
+ MultiGet(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply CacheMultiGetStream, err error)
}
type Cache interface {
_gen_ipc.UniversalServiceMethods
@@ -74,45 +74,45 @@
type CacheService interface {
// Set sets a value for a key.
- Set(context _gen_ipc.Context, key string, value _gen_vdl.Any) (err error)
+ Set(context _gen_ipc.ServerContext, key string, value _gen_vdl.Any) (err error)
// Get returns the value for a key. If the value is not found, returns
// a not found error.
- Get(context _gen_ipc.Context, key string) (reply _gen_vdl.Any, err error)
+ Get(context _gen_ipc.ServerContext, key string) (reply _gen_vdl.Any, err error)
// Same as Get, but casts the return argument to an byte.
- GetAsByte(context _gen_ipc.Context, key string) (reply byte, err error)
+ GetAsByte(context _gen_ipc.ServerContext, key string) (reply byte, err error)
// Same as Get, but casts the return argument to an int32.
- GetAsInt32(context _gen_ipc.Context, key string) (reply int32, err error)
+ GetAsInt32(context _gen_ipc.ServerContext, key string) (reply int32, err error)
// Same as Get, but casts the return argument to an int64.
- GetAsInt64(context _gen_ipc.Context, key string) (reply int64, err error)
+ GetAsInt64(context _gen_ipc.ServerContext, key string) (reply int64, err error)
// Same as Get, but casts the return argument to an uint32.
- GetAsUint32(context _gen_ipc.Context, key string) (reply uint32, err error)
+ GetAsUint32(context _gen_ipc.ServerContext, key string) (reply uint32, err error)
// Same as Get, but casts the return argument to an uint64.
- GetAsUint64(context _gen_ipc.Context, key string) (reply uint64, err error)
+ GetAsUint64(context _gen_ipc.ServerContext, key string) (reply uint64, err error)
// Same as Get, but casts the return argument to an float32.
- GetAsFloat32(context _gen_ipc.Context, key string) (reply float32, err error)
+ GetAsFloat32(context _gen_ipc.ServerContext, key string) (reply float32, err error)
// Same as Get, but casts the return argument to an float64.
- GetAsFloat64(context _gen_ipc.Context, key string) (reply float64, err error)
+ GetAsFloat64(context _gen_ipc.ServerContext, key string) (reply float64, err error)
// Same as Get, but casts the return argument to a string.
- GetAsString(context _gen_ipc.Context, key string) (reply string, err error)
+ GetAsString(context _gen_ipc.ServerContext, key string) (reply string, err error)
// Same as Get, but casts the return argument to a bool.
- GetAsBool(context _gen_ipc.Context, key string) (reply bool, err error)
+ GetAsBool(context _gen_ipc.ServerContext, key string) (reply bool, err error)
// Same as Get, but casts the return argument to an error.
- GetAsError(context _gen_ipc.Context, key string) (reply error, err error)
+ GetAsError(context _gen_ipc.ServerContext, key string) (reply error, err error)
// AsMap returns the full contents of the cache as a map.
- AsMap(context _gen_ipc.Context) (reply map[string]_gen_vdl.Any, err error)
+ AsMap(context _gen_ipc.ServerContext) (reply map[string]_gen_vdl.Any, err error)
// KeyValuePairs returns the full contents of the cache as a slice of pairs.
- KeyValuePairs(context _gen_ipc.Context) (reply []KeyValuePair, err error)
+ KeyValuePairs(context _gen_ipc.ServerContext) (reply []KeyValuePair, err error)
// MostRecentSet returns the key and value and the timestamp for the most
// recent set operation
// TODO(bprosnitz) support type types and change time to native time type
- MostRecentSet(context _gen_ipc.Context) (value KeyValuePair, time int64, err error)
+ MostRecentSet(context _gen_ipc.ServerContext) (value KeyValuePair, time int64, err error)
// KeyPage indexes into the keys (in alphanumerically sorted order) and
// returns the indexth page of 10 keys.
- KeyPage(context _gen_ipc.Context, index int64) (reply [10]string, err error)
+ KeyPage(context _gen_ipc.ServerContext, index int64) (reply [10]string, err error)
// Size returns the total number of entries in the cache.
- Size(context _gen_ipc.Context) (reply int64, err error)
+ Size(context _gen_ipc.ServerContext) (reply int64, err error)
// MultiGet sets up a stream that allows fetching multiple keys.
- MultiGet(context _gen_ipc.Context, stream CacheServiceMultiGetStream) (err error)
+ MultiGet(context _gen_ipc.ServerContext, stream CacheServiceMultiGetStream) (err error)
}
// CacheMultiGetStream is the interface for streaming responses of the method
@@ -143,7 +143,7 @@
// Implementation of the CacheMultiGetStream interface that is not exported.
type implCacheMultiGetStream struct {
- clientCall _gen_ipc.ClientCall
+ clientCall _gen_ipc.Call
}
func (c *implCacheMultiGetStream) Send(item string) error {
@@ -239,9 +239,9 @@
name string
}
-func (__gen_c *clientStubCache) Set(key string, value _gen_vdl.Any, opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Set", []interface{}{key, value}, opts...); err != nil {
+func (__gen_c *clientStubCache) Set(ctx _gen_ipc.Context, key string, value _gen_vdl.Any, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Set", []interface{}{key, value}, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -250,9 +250,9 @@
return
}
-func (__gen_c *clientStubCache) Get(key string, opts ..._gen_ipc.ClientCallOpt) (reply _gen_vdl.Any, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Get", []interface{}{key}, opts...); err != nil {
+func (__gen_c *clientStubCache) Get(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply _gen_vdl.Any, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Get", []interface{}{key}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -261,9 +261,9 @@
return
}
-func (__gen_c *clientStubCache) GetAsByte(key string, opts ..._gen_ipc.ClientCallOpt) (reply byte, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetAsByte", []interface{}{key}, opts...); err != nil {
+func (__gen_c *clientStubCache) GetAsByte(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply byte, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetAsByte", []interface{}{key}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -272,9 +272,9 @@
return
}
-func (__gen_c *clientStubCache) GetAsInt32(key string, opts ..._gen_ipc.ClientCallOpt) (reply int32, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetAsInt32", []interface{}{key}, opts...); err != nil {
+func (__gen_c *clientStubCache) GetAsInt32(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply int32, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetAsInt32", []interface{}{key}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -283,9 +283,9 @@
return
}
-func (__gen_c *clientStubCache) GetAsInt64(key string, opts ..._gen_ipc.ClientCallOpt) (reply int64, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetAsInt64", []interface{}{key}, opts...); err != nil {
+func (__gen_c *clientStubCache) GetAsInt64(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply int64, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetAsInt64", []interface{}{key}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -294,9 +294,9 @@
return
}
-func (__gen_c *clientStubCache) GetAsUint32(key string, opts ..._gen_ipc.ClientCallOpt) (reply uint32, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetAsUint32", []interface{}{key}, opts...); err != nil {
+func (__gen_c *clientStubCache) GetAsUint32(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply uint32, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetAsUint32", []interface{}{key}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -305,9 +305,9 @@
return
}
-func (__gen_c *clientStubCache) GetAsUint64(key string, opts ..._gen_ipc.ClientCallOpt) (reply uint64, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetAsUint64", []interface{}{key}, opts...); err != nil {
+func (__gen_c *clientStubCache) GetAsUint64(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply uint64, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetAsUint64", []interface{}{key}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -316,9 +316,9 @@
return
}
-func (__gen_c *clientStubCache) GetAsFloat32(key string, opts ..._gen_ipc.ClientCallOpt) (reply float32, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetAsFloat32", []interface{}{key}, opts...); err != nil {
+func (__gen_c *clientStubCache) GetAsFloat32(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply float32, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetAsFloat32", []interface{}{key}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -327,9 +327,9 @@
return
}
-func (__gen_c *clientStubCache) GetAsFloat64(key string, opts ..._gen_ipc.ClientCallOpt) (reply float64, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetAsFloat64", []interface{}{key}, opts...); err != nil {
+func (__gen_c *clientStubCache) GetAsFloat64(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply float64, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetAsFloat64", []interface{}{key}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -338,9 +338,9 @@
return
}
-func (__gen_c *clientStubCache) GetAsString(key string, opts ..._gen_ipc.ClientCallOpt) (reply string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetAsString", []interface{}{key}, opts...); err != nil {
+func (__gen_c *clientStubCache) GetAsString(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetAsString", []interface{}{key}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -349,9 +349,9 @@
return
}
-func (__gen_c *clientStubCache) GetAsBool(key string, opts ..._gen_ipc.ClientCallOpt) (reply bool, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetAsBool", []interface{}{key}, opts...); err != nil {
+func (__gen_c *clientStubCache) GetAsBool(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply bool, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetAsBool", []interface{}{key}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -360,9 +360,9 @@
return
}
-func (__gen_c *clientStubCache) GetAsError(key string, opts ..._gen_ipc.ClientCallOpt) (reply error, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetAsError", []interface{}{key}, opts...); err != nil {
+func (__gen_c *clientStubCache) GetAsError(ctx _gen_ipc.Context, key string, opts ..._gen_ipc.CallOpt) (reply error, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetAsError", []interface{}{key}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -371,9 +371,9 @@
return
}
-func (__gen_c *clientStubCache) AsMap(opts ..._gen_ipc.ClientCallOpt) (reply map[string]_gen_vdl.Any, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "AsMap", nil, opts...); err != nil {
+func (__gen_c *clientStubCache) AsMap(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply map[string]_gen_vdl.Any, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "AsMap", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -382,9 +382,9 @@
return
}
-func (__gen_c *clientStubCache) KeyValuePairs(opts ..._gen_ipc.ClientCallOpt) (reply []KeyValuePair, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "KeyValuePairs", nil, opts...); err != nil {
+func (__gen_c *clientStubCache) KeyValuePairs(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []KeyValuePair, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "KeyValuePairs", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -393,9 +393,9 @@
return
}
-func (__gen_c *clientStubCache) MostRecentSet(opts ..._gen_ipc.ClientCallOpt) (value KeyValuePair, time int64, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "MostRecentSet", nil, opts...); err != nil {
+func (__gen_c *clientStubCache) MostRecentSet(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (value KeyValuePair, time int64, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "MostRecentSet", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&value, &time, &err); ierr != nil {
@@ -404,9 +404,9 @@
return
}
-func (__gen_c *clientStubCache) KeyPage(index int64, opts ..._gen_ipc.ClientCallOpt) (reply [10]string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "KeyPage", []interface{}{index}, opts...); err != nil {
+func (__gen_c *clientStubCache) KeyPage(ctx _gen_ipc.Context, index int64, opts ..._gen_ipc.CallOpt) (reply [10]string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "KeyPage", []interface{}{index}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -415,9 +415,9 @@
return
}
-func (__gen_c *clientStubCache) Size(opts ..._gen_ipc.ClientCallOpt) (reply int64, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Size", nil, opts...); err != nil {
+func (__gen_c *clientStubCache) Size(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply int64, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Size", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -426,18 +426,18 @@
return
}
-func (__gen_c *clientStubCache) MultiGet(opts ..._gen_ipc.ClientCallOpt) (reply CacheMultiGetStream, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "MultiGet", nil, opts...); err != nil {
+func (__gen_c *clientStubCache) MultiGet(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply CacheMultiGetStream, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "MultiGet", nil, opts...); err != nil {
return
}
reply = &implCacheMultiGetStream{clientCall: call}
return
}
-func (__gen_c *clientStubCache) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubCache) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -446,9 +446,9 @@
return
}
-func (__gen_c *clientStubCache) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubCache) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -457,9 +457,9 @@
return
}
-func (__gen_c *clientStubCache) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubCache) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
diff --git a/examples/wspr_sample/error_thrower.vdl.go b/examples/wspr_sample/error_thrower.vdl.go
index 5ca7e3e..765ec73 100644
--- a/examples/wspr_sample/error_thrower.vdl.go
+++ b/examples/wspr_sample/error_thrower.vdl.go
@@ -19,25 +19,25 @@
// to enable embedding without method collisions. Not to be used directly by clients.
type ErrorThrower_ExcludingUniversal interface {
// Throws veyron2/vError.Aborted error
- ThrowAborted(opts ..._gen_ipc.ClientCallOpt) (err error)
+ ThrowAborted(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error)
// Throws veyron2/vError.BadArg error
- ThrowBadArg(opts ..._gen_ipc.ClientCallOpt) (err error)
+ ThrowBadArg(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error)
// Throws veyron2/vError.BadProtocol error
- ThrowBadProtocol(opts ..._gen_ipc.ClientCallOpt) (err error)
+ ThrowBadProtocol(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error)
// Throws veyron2/vError.Internal error
- ThrowInternal(opts ..._gen_ipc.ClientCallOpt) (err error)
+ ThrowInternal(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error)
// Throws veyron2/vError.NotAuthorized error
- ThrowNotAuthorized(opts ..._gen_ipc.ClientCallOpt) (err error)
+ ThrowNotAuthorized(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error)
// Throws veyron2/vError.NotFound error
- ThrowNotFound(opts ..._gen_ipc.ClientCallOpt) (err error)
+ ThrowNotFound(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error)
// Throws veyron2/vError.Unknown error
- ThrowUnknown(opts ..._gen_ipc.ClientCallOpt) (err error)
+ ThrowUnknown(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error)
// Throws normal Go error
- ThrowGoError(opts ..._gen_ipc.ClientCallOpt) (err error)
+ ThrowGoError(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error)
// Throws custom error created by using Standard
- ThrowCustomStandardError(opts ..._gen_ipc.ClientCallOpt) (err error)
+ ThrowCustomStandardError(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error)
// Lists all errors Ids available in veyron2/verror
- ListAllBuiltInErrorIDs(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error)
+ ListAllBuiltInErrorIDs(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error)
}
type ErrorThrower interface {
_gen_ipc.UniversalServiceMethods
@@ -48,25 +48,25 @@
type ErrorThrowerService interface {
// Throws veyron2/vError.Aborted error
- ThrowAborted(context _gen_ipc.Context) (err error)
+ ThrowAborted(context _gen_ipc.ServerContext) (err error)
// Throws veyron2/vError.BadArg error
- ThrowBadArg(context _gen_ipc.Context) (err error)
+ ThrowBadArg(context _gen_ipc.ServerContext) (err error)
// Throws veyron2/vError.BadProtocol error
- ThrowBadProtocol(context _gen_ipc.Context) (err error)
+ ThrowBadProtocol(context _gen_ipc.ServerContext) (err error)
// Throws veyron2/vError.Internal error
- ThrowInternal(context _gen_ipc.Context) (err error)
+ ThrowInternal(context _gen_ipc.ServerContext) (err error)
// Throws veyron2/vError.NotAuthorized error
- ThrowNotAuthorized(context _gen_ipc.Context) (err error)
+ ThrowNotAuthorized(context _gen_ipc.ServerContext) (err error)
// Throws veyron2/vError.NotFound error
- ThrowNotFound(context _gen_ipc.Context) (err error)
+ ThrowNotFound(context _gen_ipc.ServerContext) (err error)
// Throws veyron2/vError.Unknown error
- ThrowUnknown(context _gen_ipc.Context) (err error)
+ ThrowUnknown(context _gen_ipc.ServerContext) (err error)
// Throws normal Go error
- ThrowGoError(context _gen_ipc.Context) (err error)
+ ThrowGoError(context _gen_ipc.ServerContext) (err error)
// Throws custom error created by using Standard
- ThrowCustomStandardError(context _gen_ipc.Context) (err error)
+ ThrowCustomStandardError(context _gen_ipc.ServerContext) (err error)
// Lists all errors Ids available in veyron2/verror
- ListAllBuiltInErrorIDs(context _gen_ipc.Context) (reply []string, err error)
+ ListAllBuiltInErrorIDs(context _gen_ipc.ServerContext) (reply []string, err error)
}
// BindErrorThrower returns the client stub implementing the ErrorThrower
@@ -112,9 +112,9 @@
name string
}
-func (__gen_c *clientStubErrorThrower) ThrowAborted(opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "ThrowAborted", nil, opts...); err != nil {
+func (__gen_c *clientStubErrorThrower) ThrowAborted(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "ThrowAborted", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -123,9 +123,9 @@
return
}
-func (__gen_c *clientStubErrorThrower) ThrowBadArg(opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "ThrowBadArg", nil, opts...); err != nil {
+func (__gen_c *clientStubErrorThrower) ThrowBadArg(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "ThrowBadArg", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -134,9 +134,9 @@
return
}
-func (__gen_c *clientStubErrorThrower) ThrowBadProtocol(opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "ThrowBadProtocol", nil, opts...); err != nil {
+func (__gen_c *clientStubErrorThrower) ThrowBadProtocol(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "ThrowBadProtocol", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -145,9 +145,9 @@
return
}
-func (__gen_c *clientStubErrorThrower) ThrowInternal(opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "ThrowInternal", nil, opts...); err != nil {
+func (__gen_c *clientStubErrorThrower) ThrowInternal(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "ThrowInternal", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -156,9 +156,9 @@
return
}
-func (__gen_c *clientStubErrorThrower) ThrowNotAuthorized(opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "ThrowNotAuthorized", nil, opts...); err != nil {
+func (__gen_c *clientStubErrorThrower) ThrowNotAuthorized(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "ThrowNotAuthorized", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -167,9 +167,9 @@
return
}
-func (__gen_c *clientStubErrorThrower) ThrowNotFound(opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "ThrowNotFound", nil, opts...); err != nil {
+func (__gen_c *clientStubErrorThrower) ThrowNotFound(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "ThrowNotFound", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -178,9 +178,9 @@
return
}
-func (__gen_c *clientStubErrorThrower) ThrowUnknown(opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "ThrowUnknown", nil, opts...); err != nil {
+func (__gen_c *clientStubErrorThrower) ThrowUnknown(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "ThrowUnknown", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -189,9 +189,9 @@
return
}
-func (__gen_c *clientStubErrorThrower) ThrowGoError(opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "ThrowGoError", nil, opts...); err != nil {
+func (__gen_c *clientStubErrorThrower) ThrowGoError(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "ThrowGoError", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -200,9 +200,9 @@
return
}
-func (__gen_c *clientStubErrorThrower) ThrowCustomStandardError(opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "ThrowCustomStandardError", nil, opts...); err != nil {
+func (__gen_c *clientStubErrorThrower) ThrowCustomStandardError(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "ThrowCustomStandardError", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -211,9 +211,9 @@
return
}
-func (__gen_c *clientStubErrorThrower) ListAllBuiltInErrorIDs(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "ListAllBuiltInErrorIDs", nil, opts...); err != nil {
+func (__gen_c *clientStubErrorThrower) ListAllBuiltInErrorIDs(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "ListAllBuiltInErrorIDs", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -222,9 +222,9 @@
return
}
-func (__gen_c *clientStubErrorThrower) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubErrorThrower) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -233,9 +233,9 @@
return
}
-func (__gen_c *clientStubErrorThrower) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubErrorThrower) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -244,9 +244,9 @@
return
}
-func (__gen_c *clientStubErrorThrower) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubErrorThrower) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
diff --git a/examples/wspr_sample/sampled/lib/cache_impl.go b/examples/wspr_sample/sampled/lib/cache_impl.go
index f039400..b2dfeff 100644
--- a/examples/wspr_sample/sampled/lib/cache_impl.go
+++ b/examples/wspr_sample/sampled/lib/cache_impl.go
@@ -29,7 +29,7 @@
}
// Set sets a value for a key. This should never return an error.
-func (c *cacheImpl) Set(_ ipc.Context, key string, value vdl.Any) error {
+func (c *cacheImpl) Set(_ ipc.ServerContext, key string, value vdl.Any) error {
c.cache[key] = value
c.mostRecent = sample.KeyValuePair{Key: key, Value: value}
c.lastUpdateTime = time.Now()
@@ -38,7 +38,7 @@
// Get returns the value for a key. If the key is not in the map, it returns
// an error.
-func (c *cacheImpl) Get(_ ipc.Context, key string) (vdl.Any, error) {
+func (c *cacheImpl) Get(_ ipc.ServerContext, key string) (vdl.Any, error) {
if value, ok := c.cache[key]; ok {
return value, nil
}
@@ -62,72 +62,72 @@
}
// Same as Get, but casts the return argument to an int32.
-func (c *cacheImpl) GetAsInt32(_ ipc.Context, key string) (int32, error) {
+func (c *cacheImpl) GetAsInt32(_ ipc.ServerContext, key string) (int32, error) {
v, err := c.getWithTypeCheck(key, reflect.TypeOf(int32(0)))
return v.(int32), err
}
// Same as Get, but casts the return argument to an int64.
-func (c *cacheImpl) GetAsInt64(_ ipc.Context, key string) (int64, error) {
+func (c *cacheImpl) GetAsInt64(_ ipc.ServerContext, key string) (int64, error) {
v, err := c.getWithTypeCheck(key, reflect.TypeOf(int64(0)))
return v.(int64), err
}
// Same as Get, but casts the return argument to an uint8.
-func (c *cacheImpl) GetAsByte(_ ipc.Context, key string) (byte, error) {
+func (c *cacheImpl) GetAsByte(_ ipc.ServerContext, key string) (byte, error) {
v, err := c.getWithTypeCheck(key, reflect.TypeOf(byte(0)))
return v.(uint8), err
}
// Same as Get, but casts the return argument to an uint32.
-func (c *cacheImpl) GetAsUint32(_ ipc.Context, key string) (uint32, error) {
+func (c *cacheImpl) GetAsUint32(_ ipc.ServerContext, key string) (uint32, error) {
v, err := c.getWithTypeCheck(key, reflect.TypeOf(uint32(0)))
return v.(uint32), err
}
// Same as Get, but casts the return argument to an uint64.
-func (c *cacheImpl) GetAsUint64(_ ipc.Context, key string) (uint64, error) {
+func (c *cacheImpl) GetAsUint64(_ ipc.ServerContext, key string) (uint64, error) {
v, err := c.getWithTypeCheck(key, reflect.TypeOf(uint64(0)))
return v.(uint64), err
}
// Same as Get, but casts the return argument to a float32.
-func (c *cacheImpl) GetAsFloat32(_ ipc.Context, key string) (float32, error) {
+func (c *cacheImpl) GetAsFloat32(_ ipc.ServerContext, key string) (float32, error) {
v, err := c.getWithTypeCheck(key, reflect.TypeOf(float32(0)))
return v.(float32), err
}
// Same as Get, but casts the return argument to a float64.
-func (c *cacheImpl) GetAsFloat64(_ ipc.Context, key string) (float64, error) {
+func (c *cacheImpl) GetAsFloat64(_ ipc.ServerContext, key string) (float64, error) {
v, err := c.getWithTypeCheck(key, reflect.TypeOf(float64(0)))
return v.(float64), err
}
// Same as Get, but casts the return argument to a string.
-func (c *cacheImpl) GetAsString(_ ipc.Context, key string) (string, error) {
+func (c *cacheImpl) GetAsString(_ ipc.ServerContext, key string) (string, error) {
v, err := c.getWithTypeCheck(key, reflect.TypeOf(""))
return v.(string), err
}
// Same as Get, but casts the return argument to a bool.
-func (c *cacheImpl) GetAsBool(_ ipc.Context, key string) (bool, error) {
+func (c *cacheImpl) GetAsBool(_ ipc.ServerContext, key string) (bool, error) {
v, err := c.getWithTypeCheck(key, reflect.TypeOf(false))
return v.(bool), err
}
// Same as Get, but converts the string return argument to an error.
-func (c *cacheImpl) GetAsError(_ ipc.Context, key string) (storedError error, callError error) {
+func (c *cacheImpl) GetAsError(_ ipc.ServerContext, key string) (storedError error, callError error) {
v, err := c.getWithTypeCheck(key, reflect.TypeOf([]error{}).Elem())
return v.(error), err
}
// AsMap returns the full contents of the cache as a map.
-func (c *cacheImpl) AsMap(ipc.Context) (map[string]vdl.Any, error) {
+func (c *cacheImpl) AsMap(ipc.ServerContext) (map[string]vdl.Any, error) {
return c.cache, nil
}
// KeyValuePairs returns the full contents of the cache as a slice of pairs.
-func (c *cacheImpl) KeyValuePairs(ipc.Context) ([]sample.KeyValuePair, error) {
+func (c *cacheImpl) KeyValuePairs(ipc.ServerContext) ([]sample.KeyValuePair, error) {
kvp := make([]sample.KeyValuePair, 0, len(c.cache))
for key, val := range c.cache {
kvp = append(kvp, sample.KeyValuePair{key, val})
@@ -138,7 +138,7 @@
// MostRecentSet returns the key and value and the timestamp for the most
// recent set operation
// TODO(bprosnitz) support type types and change time to native time type
-func (c *cacheImpl) MostRecentSet(ipc.Context) (sample.KeyValuePair, int64, error) {
+func (c *cacheImpl) MostRecentSet(ipc.ServerContext) (sample.KeyValuePair, int64, error) {
var err error
if c.lastUpdateTime.IsZero() {
err = verror.NotFoundf("no values in the cache so cannot return most recent.")
@@ -148,7 +148,7 @@
// KeyPage indexes into the keys (in alphanumerically sorted order) and
// returns the indexth page of 10 keys.
-func (c *cacheImpl) KeyPage(_ ipc.Context, index int64) ([10]string, error) {
+func (c *cacheImpl) KeyPage(_ ipc.ServerContext, index int64) ([10]string, error) {
results := [10]string{}
keys := sort.StringSlice{}
@@ -174,14 +174,14 @@
}
// Size returns the total number of entries in the cache.
-func (c *cacheImpl) Size(ipc.Context) (int64, error) {
+func (c *cacheImpl) Size(ipc.ServerContext) (int64, error) {
return int64(len(c.cache)), nil
}
// MultiGet handles a stream of get requests. Returns an error if one of the
// keys in the stream is not in the map or if there was an issue reading
// the stream.
-func (c *cacheImpl) MultiGet(_ ipc.Context, stream sample.CacheServiceMultiGetStream) error {
+func (c *cacheImpl) MultiGet(_ ipc.ServerContext, stream sample.CacheServiceMultiGetStream) error {
for {
key, err := stream.Recv()
if err == io.EOF {
diff --git a/examples/wspr_sample/sampled/lib/error_thrower_impl.go b/examples/wspr_sample/sampled/lib/error_thrower_impl.go
index 3ad7e68..e352b62 100644
--- a/examples/wspr_sample/sampled/lib/error_thrower_impl.go
+++ b/examples/wspr_sample/sampled/lib/error_thrower_impl.go
@@ -16,46 +16,46 @@
type errorThrowerImpl struct{}
-func (e *errorThrowerImpl) ThrowAborted(_ ipc.Context) error {
+func (e *errorThrowerImpl) ThrowAborted(_ ipc.ServerContext) error {
return verror.Abortedf("Aborted!")
}
-func (e *errorThrowerImpl) ThrowBadArg(_ ipc.Context) error {
+func (e *errorThrowerImpl) ThrowBadArg(_ ipc.ServerContext) error {
return verror.BadArgf("BadArg!")
}
-func (e *errorThrowerImpl) ThrowBadProtocol(_ ipc.Context) error {
+func (e *errorThrowerImpl) ThrowBadProtocol(_ ipc.ServerContext) error {
return verror.BadProtocolf("BadProtocol!")
}
-func (e *errorThrowerImpl) ThrowInternal(_ ipc.Context) error {
+func (e *errorThrowerImpl) ThrowInternal(_ ipc.ServerContext) error {
return verror.Internalf("Internal!")
}
-func (e *errorThrowerImpl) ThrowNotAuthorized(_ ipc.Context) error {
+func (e *errorThrowerImpl) ThrowNotAuthorized(_ ipc.ServerContext) error {
return verror.NotAuthorizedf("NotAuthorized!")
}
-func (e *errorThrowerImpl) ThrowNotFound(_ ipc.Context) error {
+func (e *errorThrowerImpl) ThrowNotFound(_ ipc.ServerContext) error {
return verror.NotFoundf("NotFound!")
}
-func (e *errorThrowerImpl) ThrowUnknown(_ ipc.Context) error {
+func (e *errorThrowerImpl) ThrowUnknown(_ ipc.ServerContext) error {
return verror.Unknownf("Unknown!")
}
-func (e *errorThrowerImpl) ThrowGoError(_ ipc.Context) error {
+func (e *errorThrowerImpl) ThrowGoError(_ ipc.ServerContext) error {
return errors.New("GoError!")
}
-func (e *errorThrowerImpl) ThrowCustomStandardError(_ ipc.Context) error {
+func (e *errorThrowerImpl) ThrowCustomStandardError(_ ipc.ServerContext) error {
return verror.Standard{
ID: "MyCustomError",
Msg: "CustomStandard!",
}
}
-func (e *errorThrowerImpl) ListAllBuiltInErrorIDs(_ ipc.Context) ([]string, error) {
+func (e *errorThrowerImpl) ListAllBuiltInErrorIDs(_ ipc.ServerContext) ([]string, error) {
// TODO(aghassemi) Use when we have enum for error IDs in IDL
// This is not used yet but the idea is to pass all error types in veyron2/verror to
// JavaScript so if a new one is added, this test would break and we add the new one to
diff --git a/examples/wspr_sample/sampled/lib/sampled_test.go b/examples/wspr_sample/sampled/lib/sampled_test.go
index 6b51edb..9ee0d18 100644
--- a/examples/wspr_sample/sampled/lib/sampled_test.go
+++ b/examples/wspr_sample/sampled/lib/sampled_test.go
@@ -57,6 +57,7 @@
testCase{"err_string", "GetAsString", true, true},
}
r := rt.Init()
+ ctx := r.NewContext()
s, endpoint, err := StartServer(r)
if err != nil {
@@ -69,13 +70,13 @@
}
for _, test := range tests {
// Call Set().
- if err := c.Set(test.mapFieldName, test.v); err != nil {
+ if err := c.Set(ctx, test.mapFieldName, test.v); err != nil {
t.Errorf("error setting: %v (test case: %v)", err, test)
continue
}
meth := reflect.ValueOf(c).MethodByName(test.nameOfGetMethod)
- out := meth.Call([]reflect.Value{reflect.ValueOf(test.mapFieldName)})
+ out := meth.Call([]reflect.Value{reflect.ValueOf(ctx), reflect.ValueOf(test.mapFieldName)})
if !test.shouldGetError {
if out[1].Interface() != nil {
t.Errorf("error getting: %v (test case: %v)", err, test)
@@ -93,52 +94,52 @@
// settable mirrors the cache's Set method to provide a consistent way to populate test cases.
type settable interface {
- Set(key string, val vdl.Any, opts ...ipc.ClientCallOpt) error
+ Set(ctx ipc.Context, key string, val vdl.Any, opts ...ipc.CallOpt) error
}
// populateObject populates a settable with 12 values.
-func populateObject(s settable) error {
- if err := s.Set("A", int8(3)); err != nil {
+func populateObject(ctx ipc.Context, s settable) error {
+ if err := s.Set(ctx, "A", int8(3)); err != nil {
return err
}
// Set "A" again to ensure it takes the second value.
- if err := s.Set("A", "A"); err != nil {
+ if err := s.Set(ctx, "A", "A"); err != nil {
return err
}
- if err := s.Set("B", uint16(5)); err != nil {
+ if err := s.Set(ctx, "B", uint16(5)); err != nil {
return err
}
- if err := s.Set("C", uint32(7)); err != nil {
+ if err := s.Set(ctx, "C", uint32(7)); err != nil {
return err
}
- if err := s.Set("D", verror.ToStandard(errors.New("Err"))); err != nil {
+ if err := s.Set(ctx, "D", verror.ToStandard(errors.New("Err"))); err != nil {
return err
}
- if err := s.Set("E", true); err != nil {
+ if err := s.Set(ctx, "E", true); err != nil {
return err
}
- if err := s.Set("F", float32(5.4)); err != nil {
+ if err := s.Set(ctx, "F", float32(5.4)); err != nil {
return err
}
- if err := s.Set("G", struct {
+ if err := s.Set(ctx, "G", struct {
X int
Y string
}{4, "G"}); err != nil {
return err
}
- if err := s.Set("H", uint64(8)); err != nil {
+ if err := s.Set(ctx, "H", uint64(8)); err != nil {
return err
}
- if err := s.Set("I", "I"); err != nil {
+ if err := s.Set(ctx, "I", "I"); err != nil {
return err
}
- if err := s.Set("J", float64(8.3)); err != nil {
+ if err := s.Set(ctx, "J", float64(8.3)); err != nil {
return err
}
- if err := s.Set("K", int64(2)); err != nil {
+ if err := s.Set(ctx, "K", int64(2)); err != nil {
return err
}
- if err := s.Set("L", int8(9)); err != nil {
+ if err := s.Set(ctx, "L", int8(9)); err != nil {
return err
}
return nil
@@ -156,7 +157,7 @@
t.Fatal("failed to connect client: ", err)
}
- if err := populateObject(c.(settable)); err != nil {
+ if err := populateObject(r.NewContext(), c.(settable)); err != nil {
t.Fatal("error populating cache: ", err)
}
@@ -166,7 +167,7 @@
// settableMap is a map that implements the settable interface.
type settableMap map[string]vdl.Any
-func (sm settableMap) Set(key string, val vdl.Any, opts ...ipc.ClientCallOpt) error {
+func (sm settableMap) Set(ctx ipc.Context, key string, val vdl.Any, opts ...ipc.CallOpt) error {
sm[key] = val
return nil
}
@@ -176,13 +177,15 @@
c, s := setupManyResults(t)
defer s.Stop()
- res, err := c.AsMap()
+ ctx := rt.R().NewContext()
+
+ res, err := c.AsMap(ctx)
if err != nil {
t.Fatal("error calling AsMap: ", err)
}
m := settableMap(make(map[string]vdl.Any))
- if err := populateObject(m); err != nil {
+ if err := populateObject(ctx, m); err != nil {
t.Fatal("error populating map: ", err)
}
@@ -199,13 +202,14 @@
c, s := setupManyResults(t)
defer s.Stop()
- res, err := c.KeyValuePairs()
+ ctx := rt.R().NewContext()
+ res, err := c.KeyValuePairs(ctx)
if err != nil {
t.Fatal("error calling KeyValuePairs: ", err)
}
m := settableMap(make(map[string]vdl.Any))
- if err := populateObject(m); err != nil {
+ if err := populateObject(ctx, m); err != nil {
t.Fatal("error populating map: ", err)
}
@@ -222,7 +226,8 @@
c, s := setupManyResults(t)
defer s.Stop()
- sz, err := c.Size()
+ ctx := rt.R().NewContext()
+ sz, err := c.Size(ctx)
if err != nil {
t.Fatal("error calling Size: ", err)
}
@@ -230,7 +235,7 @@
t.Fatal("wrong number of results: ", sz)
}
- res, err := c.KeyPage(1)
+ res, err := c.KeyPage(ctx, 1)
if err != nil {
t.Fatal("error calling AsMap: ", err)
}
@@ -245,13 +250,15 @@
c, s := setupManyResults(t)
defer s.Stop()
+ ctx := rt.R().NewContext()
+
timeBefore := time.Now().Unix()
- if err := c.Set("B", int32(8)); err != nil {
+ if err := c.Set(ctx, "B", int32(8)); err != nil {
t.Fatal("error calling Set: ", err)
}
timeAfter := time.Now().Unix()
- kvp, setTime, err := c.MostRecentSet()
+ kvp, setTime, err := c.MostRecentSet(ctx)
if err != nil {
t.Fatal("error calling MostRecentSet: ", err)
}
@@ -270,7 +277,7 @@
c, s := setupManyResults(t)
defer s.Stop()
- stream, err := c.MultiGet()
+ stream, err := c.MultiGet(rt.R().NewContext())
if err != nil {
t.Fatal("error calling MultiGet: ", err)
}
diff --git a/runtimes/google/ipc/client.go b/runtimes/google/ipc/client.go
index f1dbeb5..16a711c 100644
--- a/runtimes/google/ipc/client.go
+++ b/runtimes/google/ipc/client.go
@@ -114,12 +114,12 @@
return flow, suffix, nil
}
-func (c *client) StartCall(name, method string, args []interface{}, opts ...ipc.ClientCallOpt) (ipc.ClientCall, error) {
+func (c *client) StartCall(ctx ipc.Context, name, method string, args []interface{}, opts ...ipc.CallOpt) (ipc.Call, error) {
return c.startCall(name, method, args, opts...)
}
// startCall ensures StartCall always returns verror.E.
-func (c *client) startCall(name, method string, args []interface{}, opts ...ipc.ClientCallOpt) (ipc.ClientCall, verror.E) {
+func (c *client) startCall(name, method string, args []interface{}, opts ...ipc.CallOpt) (ipc.Call, verror.E) {
servers, err := c.mt.Resolve(name)
if err != nil {
return nil, verror.NotFoundf("ipc: Resolve(%q) failed: %v", name, err)
@@ -177,7 +177,7 @@
return nil, errNoServers
}
-func (c *client) getCallTimeout(opts []ipc.ClientCallOpt) time.Duration {
+func (c *client) getCallTimeout(opts []ipc.CallOpt) time.Duration {
timeout := c.callTimeout
for _, opt := range opts {
if ct, ok := opt.(veyron2.CallTimeout); ok {
@@ -358,7 +358,7 @@
fc.flow.Cancel()
}
-func matchServerID(id security.PublicID, opts []ipc.ClientCallOpt) verror.E {
+func matchServerID(id security.PublicID, opts []ipc.CallOpt) verror.E {
for _, opt := range opts {
if pattern, ok := opt.(veyron2.RemoteID); ok && !id.Match(security.PrincipalPattern(pattern)) {
return verror.NotAuthorizedf("ipc: server identity %q does not have a name matching the provided pattern %q", id, pattern)
diff --git a/runtimes/google/ipc/context.go b/runtimes/google/ipc/context.go
new file mode 100644
index 0000000..561886d
--- /dev/null
+++ b/runtimes/google/ipc/context.go
@@ -0,0 +1,14 @@
+package ipc
+
+import (
+ "veyron2/ipc"
+)
+
+// context implements the ipc.ServerContext interface.
+type context struct{}
+
+// InternalNewContext creates a new ipc.Context. This function should only
+// be called from within the runtime implementation.
+func InternalNewContext() ipc.Context {
+ return &context{}
+}
diff --git a/runtimes/google/ipc/full_test.go b/runtimes/google/ipc/full_test.go
index 941f6bd..54e56ca 100644
--- a/runtimes/google/ipc/full_test.go
+++ b/runtimes/google/ipc/full_test.go
@@ -38,6 +38,8 @@
var errAuthorizer = errors.New("ipc: application Authorizer denied access")
+type fakeContext struct{}
+
type userType string
type testServer struct{}
@@ -343,7 +345,7 @@
stopServer(t, server, mt)
continue
}
- if _, err := client.StartCall("mountpoint/server/suffix", "irrelevant", nil, veyron2.RemoteID(test.pattern)); !matchesErrorPattern(err, test.err) {
+ if _, err := client.StartCall(&fakeContext{}, "mountpoint/server/suffix", "irrelevant", nil, veyron2.RemoteID(test.pattern)); !matchesErrorPattern(err, test.err) {
t.Errorf(`%s: client.StartCall: got error "%v", want to match "%v"`, name, err, test.err)
}
client.Close()
@@ -394,7 +396,7 @@
defer b.cleanup(t)
for _, test := range tests {
vlog.VI(1).Infof("%s client.StartCall", name(test))
- call, err := b.client.StartCall(test.name, test.method, test.args)
+ call, err := b.client.StartCall(&fakeContext{}, test.name, test.method, test.args)
if err != test.startErr {
t.Errorf(`%s client.StartCall got error "%v", want "%v"`, name(test), err, test.startErr)
continue
@@ -506,7 +508,7 @@
t.Fatalf("InternalNewClient failed: %v", err)
}
defer client.Close()
- call, err := client.StartCall(test.name, test.method, test.args)
+ call, err := client.StartCall(&fakeContext{}, test.name, test.method, test.args)
if err != nil {
t.Errorf(`%s client.StartCall got unexpected error: "%v"`, name(test), err)
continue
@@ -562,7 +564,7 @@
}
}
-func waitForCancel(t *testing.T, ts *cancelTestServer, call ipc.ClientCall) {
+func waitForCancel(t *testing.T, ts *cancelTestServer, call ipc.Call) {
<-ts.started
call.Cancel()
<-ts.cancelled
@@ -574,7 +576,7 @@
b := createBundle(t, clientID, serverID, ts)
defer b.cleanup(t)
- call, err := b.client.StartCall("mountpoint/server/suffix", "CancelStreamReader", []interface{}{})
+ call, err := b.client.StartCall(&fakeContext{}, "mountpoint/server/suffix", "CancelStreamReader", []interface{}{})
if err != nil {
t.Fatalf("Start call failed: %v", err)
}
@@ -594,7 +596,7 @@
b := createBundle(t, clientID, serverID, ts)
defer b.cleanup(t)
- call, err := b.client.StartCall("mountpoint/server/suffix", "CancelStreamIgnorer", []interface{}{})
+ call, err := b.client.StartCall(&fakeContext{}, "mountpoint/server/suffix", "CancelStreamIgnorer", []interface{}{})
if err != nil {
t.Fatalf("Start call failed: %v", err)
}
@@ -630,7 +632,7 @@
b := createBundle(t, clientID, serverID, s)
defer b.cleanup(t)
- call, err := b.client.StartCall("mountpoint/server/suffix", "RecvInGoroutine", []interface{}{})
+ call, err := b.client.StartCall(&fakeContext{}, "mountpoint/server/suffix", "RecvInGoroutine", []interface{}{})
if err != nil {
t.Fatalf("StartCall failed: %v", err)
}
@@ -670,7 +672,7 @@
publisher.AddServer("/@2@tcp@localhost:10000@@1000000@2000000@@")
publisher.AddServer("/@2@tcp@localhost:10001@@2000000@3000000@@")
- _, err := b.client.StartCall("incompatible/server/suffix", "Echo", []interface{}{"foo"})
+ _, err := b.client.StartCall(&fakeContext{}, "incompatible/server/suffix", "Echo", []interface{}{"foo"})
if !strings.Contains(err.Error(), version.NoCompatibleVersionErr.Error()) {
t.Errorf("Expected error %v, found: %v", version.NoCompatibleVersionErr, err)
}
@@ -678,7 +680,7 @@
// Now add a server with a compatible endpoint and try again.
b.server.Publish("incompatible")
- call, err := b.client.StartCall("incompatible/server/suffix", "Echo", []interface{}{"foo"})
+ call, err := b.client.StartCall(&fakeContext{}, "incompatible/server/suffix", "Echo", []interface{}{"foo"})
if err != nil {
t.Fatal(err)
}
@@ -775,7 +777,7 @@
}
serverName := naming.JoinAddressName(ep.String(), "server/suffix")
makeCall := func() (string, error) {
- call, err := b.client.StartCall(serverName, "Echo", []interface{}{"bratman"})
+ call, err := b.client.StartCall(&fakeContext{}, serverName, "Echo", []interface{}{"bratman"})
if err != nil {
return "", err
}
diff --git a/runtimes/google/ipc/jni/arg_getter.go b/runtimes/google/ipc/jni/arg_getter.go
index d704016..25c2003 100644
--- a/runtimes/google/ipc/jni/arg_getter.go
+++ b/runtimes/google/ipc/jni/arg_getter.go
@@ -40,8 +40,8 @@
m := t.Method(i)
in := make([]reflect.Type, m.Type.NumIn()-1)
idx := 0
- contextType := reflect.TypeOf((*ipc.Context)(nil)).Elem()
- optType := reflect.TypeOf((*ipc.ClientCallOpt)(nil)).Elem()
+ contextType := reflect.TypeOf((*ipc.ServerContext)(nil)).Elem()
+ optType := reflect.TypeOf((*ipc.CallOpt)(nil)).Elem()
for j := 0; j < m.Type.NumIn(); j++ {
argType := m.Type.In(j)
if j == 0 && argType == contextType { // skip the Context argument.
diff --git a/runtimes/google/ipc/jni/client.go b/runtimes/google/ipc/jni/client.go
index b7881d7..10e4474 100644
--- a/runtimes/google/ipc/jni/client.go
+++ b/runtimes/google/ipc/jni/client.go
@@ -59,7 +59,7 @@
args[i] = derefOrDie(argptrs[i])
}
// Process options.
- options := []ipc.ClientCallOpt{}
+ options := []ipc.CallOpt{}
if int(jTimeout) >= 0 {
options = append(options, veyron2.CallTimeout(time.Duration(int(jTimeout))*time.Millisecond))
}
@@ -83,7 +83,7 @@
}
type clientCall struct {
- call ipc.ClientCall
+ call ipc.Call
resultptrs []interface{}
}
diff --git a/runtimes/google/ipc/jni/jni.go b/runtimes/google/ipc/jni/jni.go
index d20b2bc..1fb6a61 100644
--- a/runtimes/google/ipc/jni/jni.go
+++ b/runtimes/google/ipc/jni/jni.go
@@ -70,9 +70,9 @@
return C.jlong(uintptr(unsafe.Pointer(c)))
}
-// getClientCall returns the clientCall referenced by the provided pointer,
+// getCall returns the clientCall referenced by the provided pointer,
// or nil if the pointer is 0.
-func getClientCall(env *C.JNIEnv, ptr C.jlong) *clientCall {
+func getCall(env *C.JNIEnv, ptr C.jlong) *clientCall {
if ptr == C.jlong(0) {
jThrow(env, "Go client call pointer is nil")
return nil
@@ -219,11 +219,11 @@
}
}
-//export Java_com_veyron_runtimes_google_ipc_Runtime_00024ClientCall_nativeFinish
-func Java_com_veyron_runtimes_google_ipc_Runtime_00024ClientCall_nativeFinish(env *C.JNIEnv, jClient C.jobject, goClientCallPtr C.jlong) C.jobjectArray {
- c := getClientCall(env, goClientCallPtr)
+//export Java_com_veyron_runtimes_google_ipc_Runtime_00024Call_nativeFinish
+func Java_com_veyron_runtimes_google_ipc_Runtime_00024Call_nativeFinish(env *C.JNIEnv, jClient C.jobject, goCallPtr C.jlong) C.jobjectArray {
+ c := getCall(env, goCallPtr)
if c == nil {
- jThrow(env, fmt.Sprintf("Couldn't find Go client with pointer: %d", int(goClientCallPtr)))
+ jThrow(env, fmt.Sprintf("Couldn't find Go client with pointer: %d", int(goCallPtr)))
return nil
}
ret, err := c.Finish(env)
@@ -237,17 +237,17 @@
return ret
}
-//export Java_com_veyron_runtimes_google_ipc_Runtime_00024ClientCall_nativeCancel
-func Java_com_veyron_runtimes_google_ipc_Runtime_00024ClientCall_nativeCancel(env *C.JNIEnv, jClient C.jobject, goClientCallPtr C.jlong) {
- c := getClientCall(env, goClientCallPtr)
+//export Java_com_veyron_runtimes_google_ipc_Runtime_00024Call_nativeCancel
+func Java_com_veyron_runtimes_google_ipc_Runtime_00024Call_nativeCancel(env *C.JNIEnv, jClient C.jobject, goCallPtr C.jlong) {
+ c := getCall(env, goCallPtr)
if c != nil {
c.Cancel()
}
}
-//export Java_com_veyron_runtimes_google_ipc_Runtime_00024ClientCall_nativeFinalize
-func Java_com_veyron_runtimes_google_ipc_Runtime_00024ClientCall_nativeFinalize(env *C.JNIEnv, jClient C.jobject, goClientCallPtr C.jlong) {
- c := getClientCall(env, goClientCallPtr)
+//export Java_com_veyron_runtimes_google_ipc_Runtime_00024Call_nativeFinalize
+func Java_com_veyron_runtimes_google_ipc_Runtime_00024Call_nativeFinalize(env *C.JNIEnv, jClient C.jobject, goCallPtr C.jlong) {
+ c := getCall(env, goCallPtr)
if c != nil {
refs.delete(c)
}
diff --git a/runtimes/google/ipc/server.go b/runtimes/google/ipc/server.go
index 13944d3..3588459 100644
--- a/runtimes/google/ipc/server.go
+++ b/runtimes/google/ipc/server.go
@@ -467,7 +467,7 @@
return fs.dec.Decode(itemptr)
}
-// Implementations of ipc.Context methods.
+// Implementations of ipc.ServerContext methods.
func (fs *flowServer) Server() ipc.Server { return fs.server }
func (fs *flowServer) Method() string { return fs.method }
diff --git a/runtimes/google/lib/proximity/service.go b/runtimes/google/lib/proximity/service.go
index 6647fb0..fcba302 100644
--- a/runtimes/google/lib/proximity/service.go
+++ b/runtimes/google/lib/proximity/service.go
@@ -110,7 +110,7 @@
advDoneChan chan bool
}
-func (s *service) RegisterName(_ ipc.Context, name string) error {
+func (s *service) RegisterName(_ ipc.ServerContext, name string) error {
s.nameLock.Lock()
defer s.nameLock.Unlock()
if v, ok := s.names[name]; ok {
@@ -124,7 +124,7 @@
return nil
}
-func (s *service) UnregisterName(_ ipc.Context, name string) error {
+func (s *service) UnregisterName(_ ipc.ServerContext, name string) error {
s.nameLock.Lock()
defer s.nameLock.Unlock()
v, ok := s.names[name]
@@ -141,7 +141,7 @@
// NearbyDevices returns the list of nearby devices, sorted in increasing
// distance order.
-func (s *service) NearbyDevices(_ ipc.Context) ([]prox.Device, error) {
+func (s *service) NearbyDevices(_ ipc.ServerContext) ([]prox.Device, error) {
s.deviceLock.RLock()
defer s.deviceLock.RUnlock()
return s.nearby, nil
diff --git a/runtimes/google/naming/mounttable/all_test.go b/runtimes/google/naming/mounttable/all_test.go
index 0ba9f41..e771e7b 100644
--- a/runtimes/google/naming/mounttable/all_test.go
+++ b/runtimes/google/naming/mounttable/all_test.go
@@ -61,8 +61,10 @@
return "Who's there?"
}
-func knockKnock(t *testing.T, client ipc.Client, name string) {
- call, err := client.StartCall(name, "KnockKnock", nil)
+func knockKnock(t *testing.T, runtime veyron2.Runtime, name string) {
+ client := runtime.Client()
+ ctx := runtime.NewContext()
+ call, err := client.StartCall(ctx, name, "KnockKnock", nil)
if err != nil {
boom(t, "StartCall failed: %s", err)
}
@@ -317,9 +319,9 @@
}
}
- knockKnock(t, r.Client(), "joke1")
- knockKnock(t, r.Client(), "joke2/joke2")
- knockKnock(t, r.Client(), "mt3/joke3/joke3")
+ knockKnock(t, r, "joke1")
+ knockKnock(t, r, "joke2/joke2")
+ knockKnock(t, r, "mt3/joke3/joke3")
// Try various globs.
globTests := []struct {
diff --git a/runtimes/google/naming/mounttable/glob.go b/runtimes/google/naming/mounttable/glob.go
index 8abadce..ddc5ae6 100644
--- a/runtimes/google/naming/mounttable/glob.go
+++ b/runtimes/google/naming/mounttable/glob.go
@@ -36,7 +36,8 @@
}
for _, s := range mtServers {
- call, err := ns.rt.Client().StartCall(s, "Glob", []interface{}{pstr}, callTimeout)
+ client := ns.rt.Client()
+ call, err := client.StartCall(ns.rt.TODOContext(), s, "Glob", []interface{}{pstr}, callTimeout)
if err != nil {
lastErr = err
continue // try another instance
diff --git a/runtimes/google/naming/mounttable/mount.go b/runtimes/google/naming/mounttable/mount.go
index 7d83f01..c781f3d 100644
--- a/runtimes/google/naming/mounttable/mount.go
+++ b/runtimes/google/naming/mounttable/mount.go
@@ -3,12 +3,13 @@
import (
"time"
- "veyron2/ipc"
+ "veyron2"
)
// mountIntoMountTable mounts a single server into a single mount table.
-func mountIntoMountTable(client ipc.Client, name, server string, ttl time.Duration) error {
- call, err := client.StartCall(name, "Mount", []interface{}{server, uint32(ttl.Seconds())}, callTimeout)
+func mountIntoMountTable(runtime veyron2.Runtime, name, server string, ttl time.Duration) error {
+ client := runtime.Client()
+ call, err := client.StartCall(runtime.TODOContext(), name, "Mount", []interface{}{server, uint32(ttl.Seconds())}, callTimeout)
if err != nil {
return err
}
@@ -19,8 +20,9 @@
}
// unmountFromMountTable removes a single mounted server from a single mount table.
-func unmountFromMountTable(client ipc.Client, name, server string) error {
- call, err := client.StartCall(name, "Unmount", []interface{}{server}, callTimeout)
+func unmountFromMountTable(runtime veyron2.Runtime, name, server string) error {
+ client := runtime.Client()
+ call, err := client.StartCall(runtime.TODOContext(), name, "Unmount", []interface{}{server}, callTimeout)
if err != nil {
return err
}
@@ -40,7 +42,7 @@
c := make(chan error, len(mtServers))
for _, mt := range mtServers {
go func() {
- c <- mountIntoMountTable(ns.rt.Client(), mt, server, ttl)
+ c <- mountIntoMountTable(ns.rt, mt, server, ttl)
}()
}
// Return error if any mounts failed, since otherwise we'll get
@@ -64,7 +66,7 @@
c := make(chan error, len(mts))
for _, mt := range mts {
go func() {
- c <- unmountFromMountTable(ns.rt.Client(), mt, server)
+ c <- unmountFromMountTable(ns.rt, mt, server)
}()
}
// Return error if any mounts failed, since otherwise we'll get
diff --git a/runtimes/google/naming/mounttable/resolve.go b/runtimes/google/naming/mounttable/resolve.go
index 3efe3c7..d7272d3 100644
--- a/runtimes/google/naming/mounttable/resolve.go
+++ b/runtimes/google/naming/mounttable/resolve.go
@@ -3,6 +3,7 @@
import (
"errors"
+ "veyron2"
"veyron2/ipc"
"veyron2/naming"
"veyron2/verror"
@@ -18,7 +19,8 @@
return
}
-func resolveAgainstMountTable(client ipc.Client, names []string) ([]string, error) {
+func resolveAgainstMountTable(runtime veyron2.Runtime, names []string) ([]string, error) {
+ client := runtime.Client()
// Try each server till one answers.
finalErr := errors.New("no servers to resolve query")
for _, name := range names {
@@ -26,7 +28,7 @@
// address, without recursing through ourselves. To this we force
// the entire name component to be terminal.
name = naming.MakeTerminal(name)
- call, err := client.StartCall(name, "ResolveStep", nil, callTimeout)
+ call, err := client.StartCall(runtime.TODOContext(), name, "ResolveStep", nil, callTimeout)
if err != nil {
finalErr = err
vlog.VI(2).Infof("ResolveStep.StartCall %s failed: %s", name, err)
@@ -86,7 +88,7 @@
}
var err error
curr := names
- if names, err = resolveAgainstMountTable(ns.rt.Client(), names); err != nil {
+ if names, err = resolveAgainstMountTable(ns.rt, names); err != nil {
// If the name could not be found in the mount table, return an error.
if verror.Equal(naming.ErrNoSuchNameRoot, err) {
@@ -116,7 +118,7 @@
vlog.VI(2).Infof("ResolveToMountTable loop %s", names)
var err error
curr := names
- if names, err = resolveAgainstMountTable(ns.rt.Client(), names); err != nil {
+ if names, err = resolveAgainstMountTable(ns.rt, names); err != nil {
if verror.Equal(naming.ErrNoSuchNameRoot, err) {
return makeTerminal(last), nil
}
@@ -144,7 +146,7 @@
return nil, naming.ErrResolutionDepthExceeded
}
-func finishUnresolve(call ipc.ClientCall) ([]string, error) {
+func finishUnresolve(call ipc.Call) ([]string, error) {
var newNames []string
var unresolveErr error
if err := call.Finish(&newNames, &unresolveErr); err != nil {
@@ -153,11 +155,12 @@
return newNames, unresolveErr
}
-func unresolveAgainstServer(client ipc.Client, names []string) ([]string, error) {
+func unresolveAgainstServer(runtime veyron2.Runtime, names []string) ([]string, error) {
+ client := runtime.Client()
finalErr := errors.New("no servers to unresolve")
for _, name := range names {
name = naming.MakeTerminal(name)
- call, err := client.StartCall(name, "UnresolveStep", nil, callTimeout)
+ call, err := client.StartCall(runtime.TODOContext(), name, "UnresolveStep", nil, callTimeout)
if err != nil {
finalErr = err
vlog.VI(2).Infof("StartCall %q.UnresolveStep() failed: %s", name, err)
@@ -192,7 +195,7 @@
for remaining := maxDepth; remaining > 0; remaining-- {
vlog.VI(2).Infof("Unresolve loop %s", names)
curr := names
- if names, err = unresolveAgainstServer(ns.rt.Client(), names); err != nil {
+ if names, err = unresolveAgainstServer(ns.rt, names); err != nil {
return nil, err
}
if len(names) == 0 {
diff --git a/runtimes/google/rt/ipc.go b/runtimes/google/rt/ipc.go
index 7f1c3ec..2c16c3d 100644
--- a/runtimes/google/rt/ipc.go
+++ b/runtimes/google/rt/ipc.go
@@ -37,6 +37,14 @@
return rt.client
}
+func (rt *vrt) NewContext() ipc.Context {
+ return iipc.InternalNewContext()
+}
+
+func (rt *vrt) TODOContext() ipc.Context {
+ return iipc.InternalNewContext()
+}
+
func (rt *vrt) NewServer(opts ...ipc.ServerOpt) (ipc.Server, error) {
// Start the http debug server exactly once for this process
rt.startHTTPDebugServerOnce()
diff --git a/runtimes/google/testing/mocks/ipc/simple_client.go b/runtimes/google/testing/mocks/ipc/simple_client.go
index 201e96c..907ecf8 100644
--- a/runtimes/google/testing/mocks/ipc/simple_client.go
+++ b/runtimes/google/testing/mocks/ipc/simple_client.go
@@ -39,7 +39,7 @@
func (c *SimpleMockClient) IPCBindOpt() {}
// StartCall Implements ipc.Client
-func (c *SimpleMockClient) StartCall(name, method string, args []interface{}, opts ...ipc.ClientCallOpt) (ipc.ClientCall, error) {
+func (c *SimpleMockClient) StartCall(ctx ipc.Context, name, method string, args []interface{}, opts ...ipc.CallOpt) (ipc.Call, error) {
results, ok := c.results[method]
if !ok {
return nil, errors.New(fmt.Sprintf("method %s not found", method))
@@ -60,22 +60,22 @@
func (*SimpleMockClient) Close() {
}
-// mockCall implements ipc.ClientCall
+// mockCall implements ipc.Call
type mockCall struct {
mockStream
results []interface{}
}
-// Cancel implements ipc.ClientCall
+// Cancel implements ipc.Call
func (*mockCall) Cancel() {
}
-// CloseSend implements ipc.ClientCall
+// CloseSend implements ipc.Call
func (*mockCall) CloseSend() error {
return nil
}
-// Finish implements ipc.ClientCall
+// Finish implements ipc.Call
func (mc *mockCall) Finish(resultptrs ...interface{}) error {
if got, want := len(resultptrs), len(mc.results); got != want {
return errors.New(fmt.Sprintf("wrong number of output results; expected resultptrs of size %d but got %d", want, got))
diff --git a/runtimes/google/testing/mocks/ipc/simple_client_test.go b/runtimes/google/testing/mocks/ipc/simple_client_test.go
index cfb8426..8adecd1 100644
--- a/runtimes/google/testing/mocks/ipc/simple_client_test.go
+++ b/runtimes/google/testing/mocks/ipc/simple_client_test.go
@@ -4,6 +4,8 @@
"testing"
)
+type fakeContext struct{}
+
func TestSuccessfulCalls(t *testing.T) {
method1ExpectedResult := []interface{}{"one", 2}
@@ -16,8 +18,10 @@
"method3": method3ExpectedResult,
})
+ ctx := &fakeContext{}
+
// method1
- method1Call, err := client.StartCall("name/obj", "method1", []interface{}{})
+ method1Call, err := client.StartCall(ctx, "name/obj", "method1", []interface{}{})
if err != nil {
t.Errorf("StartCall: did not expect an error return")
return
@@ -35,7 +39,7 @@
}
// method2
- method2Call, err := client.StartCall("name/obj", "method2", []interface{}{})
+ method2Call, err := client.StartCall(ctx, "name/obj", "method2", []interface{}{})
if err != nil {
t.Errorf(`StartCall: did not expect an error return`)
return
@@ -48,7 +52,7 @@
// method3
var result interface{}
- method3Call, err := client.StartCall("name/obj", "method3", []interface{}{})
+ method3Call, err := client.StartCall(ctx, "name/obj", "method3", []interface{}{})
if err != nil {
t.Errorf(`StartCall: did not expect an error return`)
return
@@ -70,7 +74,7 @@
sampleStruct{name: "bar"},
},
})
- call, _ := client.StartCall("name/obj", "foo", []interface{}{})
+ call, _ := client.StartCall(&fakeContext{}, "name/obj", "foo", []interface{}{})
var result sampleStruct
call.Finish(&result)
if result.name != "bar" {
@@ -83,7 +87,7 @@
client := NewSimpleClient(map[string][]interface{}{
"bar": []interface{}{},
})
- _, err := client.StartCall("name/obj", "wrongMethodName", []interface{}{})
+ _, err := client.StartCall(&fakeContext{}, "name/obj", "wrongMethodName", []interface{}{})
if err == nil {
t.Errorf(`StartCall: should have returned an error on invalid method name`)
return
@@ -97,18 +101,19 @@
})
errMsg := "Expected method to be called %d times but it was called %d"
+ ctx := &fakeContext{}
// method 1
if n := client.TimesCalled("method1"); n != 0 {
t.Errorf(errMsg, 0, n)
return
}
- client.StartCall("name/of/object", "method1", []interface{}{})
+ client.StartCall(ctx, "name/of/object", "method1", []interface{}{})
if n := client.TimesCalled("method1"); n != 1 {
t.Errorf(errMsg, 1, n)
return
}
- client.StartCall("name/of/object", "method1", []interface{}{})
+ client.StartCall(ctx, "name/of/object", "method1", []interface{}{})
if n := client.TimesCalled("method1"); n != 2 {
t.Errorf(errMsg, 2, n)
return
@@ -119,7 +124,7 @@
t.Errorf(errMsg, 0, n)
return
}
- client.StartCall("name/of/object", "method2", []interface{}{})
+ client.StartCall(ctx, "name/of/object", "method2", []interface{}{})
if n := client.TimesCalled("method2"); n != 1 {
t.Errorf(errMsg, 1, n)
return
diff --git a/runtimes/google/vsync/initiator.go b/runtimes/google/vsync/initiator.go
index 7380819..a9a30f4 100644
--- a/runtimes/google/vsync/initiator.go
+++ b/runtimes/google/vsync/initiator.go
@@ -11,6 +11,7 @@
"veyron/services/store/raw"
"veyron2/naming"
+ "veyron2/rt"
"veyron2/storage"
"veyron2/vlog"
)
@@ -198,7 +199,7 @@
vlog.VI(1).Infof("GetDeltasFromPeer:: Sending local information: %v", local)
// Issue a GetDeltas() rpc.
- stream, err := c.GetDeltas(local, i.syncd.id)
+ stream, err := c.GetDeltas(rt.R().TODOContext(), local, i.syncd.id)
if err != nil {
vlog.Errorf("GetDeltasFromPeer:: error getting deltas: err %v", err)
return
@@ -504,7 +505,7 @@
// to prevent a race with watcher. The next iteration will
// clean up this coordination.
if store := i.syncd.store; store != nil && len(m) > 0 {
- stream, err := store.PutMutations()
+ stream, err := store.PutMutations(rt.R().TODOContext())
if err != nil {
vlog.Errorf("updateStoreAndSync:: putmutations err %v", err)
return err
diff --git a/runtimes/google/vsync/vsync.vdl.go b/runtimes/google/vsync/vsync.vdl.go
index 35c2ec1..82037e2 100644
--- a/runtimes/google/vsync/vsync.vdl.go
+++ b/runtimes/google/vsync/vsync.vdl.go
@@ -77,7 +77,7 @@
type Sync_ExcludingUniversal interface {
// GetDeltas returns a device's current generation vector and all the missing log records
// when compared to the incoming generation vector.
- GetDeltas(In GenVector, ClientID DeviceID, opts ..._gen_ipc.ClientCallOpt) (reply SyncGetDeltasStream, err error)
+ GetDeltas(ctx _gen_ipc.Context, In GenVector, ClientID DeviceID, opts ..._gen_ipc.CallOpt) (reply SyncGetDeltasStream, err error)
}
type Sync interface {
_gen_ipc.UniversalServiceMethods
@@ -89,7 +89,7 @@
// GetDeltas returns a device's current generation vector and all the missing log records
// when compared to the incoming generation vector.
- GetDeltas(context _gen_ipc.Context, In GenVector, ClientID DeviceID, stream SyncServiceGetDeltasStream) (reply GenVector, err error)
+ GetDeltas(context _gen_ipc.ServerContext, In GenVector, ClientID DeviceID, stream SyncServiceGetDeltasStream) (reply GenVector, err error)
}
// SyncGetDeltasStream is the interface for streaming responses of the method
@@ -110,7 +110,7 @@
// Implementation of the SyncGetDeltasStream interface that is not exported.
type implSyncGetDeltasStream struct {
- clientCall _gen_ipc.ClientCall
+ clientCall _gen_ipc.Call
}
func (c *implSyncGetDeltasStream) Recv() (item LogRec, err error) {
@@ -189,18 +189,18 @@
name string
}
-func (__gen_c *clientStubSync) GetDeltas(In GenVector, ClientID DeviceID, opts ..._gen_ipc.ClientCallOpt) (reply SyncGetDeltasStream, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetDeltas", []interface{}{In, ClientID}, opts...); err != nil {
+func (__gen_c *clientStubSync) GetDeltas(ctx _gen_ipc.Context, In GenVector, ClientID DeviceID, opts ..._gen_ipc.CallOpt) (reply SyncGetDeltasStream, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetDeltas", []interface{}{In, ClientID}, opts...); err != nil {
return
}
reply = &implSyncGetDeltasStream{clientCall: call}
return
}
-func (__gen_c *clientStubSync) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubSync) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -209,9 +209,9 @@
return
}
-func (__gen_c *clientStubSync) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubSync) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -220,9 +220,9 @@
return
}
-func (__gen_c *clientStubSync) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubSync) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
diff --git a/runtimes/google/vsync/vsyncd.go b/runtimes/google/vsync/vsyncd.go
index 2e6d639..a70de6e 100644
--- a/runtimes/google/vsync/vsyncd.go
+++ b/runtimes/google/vsync/vsyncd.go
@@ -158,7 +158,7 @@
}
// GetDeltas responds to the incoming request from a client by sending missing generations to the client.
-func (s *syncd) GetDeltas(_ ipc.Context, In GenVector, ClientID DeviceID, Stream SyncServiceGetDeltasStream) (GenVector, error) {
+func (s *syncd) GetDeltas(_ ipc.ServerContext, In GenVector, ClientID DeviceID, Stream SyncServiceGetDeltasStream) (GenVector, error) {
vlog.VI(1).Infof("GetDeltas:: Received vector %v from client %s", In, ClientID)
if err := s.updateDeviceInfo(ClientID, In); err != nil {
diff --git a/runtimes/google/vsync/watcher.go b/runtimes/google/vsync/watcher.go
index e081d7f..e44105c 100644
--- a/runtimes/google/vsync/watcher.go
+++ b/runtimes/google/vsync/watcher.go
@@ -14,6 +14,7 @@
"veyron2"
"veyron2/ipc"
"veyron2/query"
+ "veyron2/rt"
"veyron2/services/watch"
"veyron2/storage"
"veyron2/vlog"
@@ -101,7 +102,7 @@
req.ResumeMarker = resmark
}
- stream, err := w.syncd.store.Watch(req, veyron2.CallTimeout(ipc.NoTimeout))
+ stream, err := w.syncd.store.Watch(rt.R().TODOContext(), req, veyron2.CallTimeout(ipc.NoTimeout))
if err == nil {
return stream
}
diff --git a/runtimes/google/vsync/watcher_test.go b/runtimes/google/vsync/watcher_test.go
index 30ea172..73b5af7 100644
--- a/runtimes/google/vsync/watcher_test.go
+++ b/runtimes/google/vsync/watcher_test.go
@@ -13,6 +13,7 @@
"veyron/services/store/raw"
"veyron2/ipc"
+ "veyron2/rt"
"veyron2/services/watch"
"veyron2/storage"
)
@@ -38,19 +39,19 @@
type fakeVStore struct {
}
-func (*fakeVStore) GetMethodTags(_ string, _ ...ipc.ClientCallOpt) ([]interface{}, error) {
+func (*fakeVStore) GetMethodTags(_ ipc.Context, _ string, _ ...ipc.CallOpt) ([]interface{}, error) {
panic("not implemented")
}
-func (*fakeVStore) UnresolveStep(_ ...ipc.ClientCallOpt) ([]string, error) {
+func (*fakeVStore) UnresolveStep(_ ipc.Context, _ ...ipc.CallOpt) ([]string, error) {
panic("not implemented")
}
-func (*fakeVStore) Signature(_ ...ipc.ClientCallOpt) (ipc.ServiceSignature, error) {
+func (*fakeVStore) Signature(_ ipc.Context, _ ...ipc.CallOpt) (ipc.ServiceSignature, error) {
panic("not implemented")
}
-func (v *fakeVStore) Watch(req watch.Request, _ ...ipc.ClientCallOpt) (watch.WatcherWatchStream, error) {
+func (v *fakeVStore) Watch(_ ipc.Context, req watch.Request, _ ...ipc.CallOpt) (watch.WatcherWatchStream, error) {
// If "failWatch" is set, simulate a failed RPC call.
if info.failWatch {
info.failWatchCount++
@@ -64,7 +65,7 @@
return newFakeStream(), nil
}
-func (*fakeVStore) PutMutations(_ ...ipc.ClientCallOpt) (raw.StorePutMutationsStream, error) {
+func (*fakeVStore) PutMutations(_ ipc.Context, _ ...ipc.CallOpt) (raw.StorePutMutationsStream, error) {
panic("not implemented")
}
@@ -287,6 +288,7 @@
// TestWatcherRPCError tests the watcher reacting to an error from the Watch() RPC.
// It verifies that the watcher retries the RPC after a delay.
func TestWatcherRPCError(t *testing.T) {
+ rt.Init()
dir := initTestDir(t)
defer os.RemoveAll(dir)
diff --git a/services/mgmt/application/application.vdl.go b/services/mgmt/application/application.vdl.go
index 1242569..3e54da9 100644
--- a/services/mgmt/application/application.vdl.go
+++ b/services/mgmt/application/application.vdl.go
@@ -44,7 +44,7 @@
// Put adds the given tuple of application version (specified
// through the veyron name suffix) and application envelope to all
// of the given application profiles.
- Put(Profiles []string, Envelope application.Envelope, opts ..._gen_ipc.ClientCallOpt) (err error)
+ Put(ctx _gen_ipc.Context, Profiles []string, Envelope application.Envelope, opts ..._gen_ipc.CallOpt) (err error)
// Remove removes the application envelope for the given profile
// name and application version (specified through the veyron name
// suffix). If no version is specified as part of the suffix, the
@@ -52,7 +52,7 @@
//
// TODO(jsimsa): Add support for using "*" to specify all profiles
// when Matt implements Globing (or Ken implements querying).
- Remove(Profile string, opts ..._gen_ipc.ClientCallOpt) (err error)
+ Remove(ctx _gen_ipc.Context, Profile string, opts ..._gen_ipc.CallOpt) (err error)
}
type Repository interface {
_gen_ipc.UniversalServiceMethods
@@ -80,7 +80,7 @@
// Put adds the given tuple of application version (specified
// through the veyron name suffix) and application envelope to all
// of the given application profiles.
- Put(context _gen_ipc.Context, Profiles []string, Envelope application.Envelope) (err error)
+ Put(context _gen_ipc.ServerContext, Profiles []string, Envelope application.Envelope) (err error)
// Remove removes the application envelope for the given profile
// name and application version (specified through the veyron name
// suffix). If no version is specified as part of the suffix, the
@@ -88,7 +88,7 @@
//
// TODO(jsimsa): Add support for using "*" to specify all profiles
// when Matt implements Globing (or Ken implements querying).
- Remove(context _gen_ipc.Context, Profile string) (err error)
+ Remove(context _gen_ipc.ServerContext, Profile string) (err error)
}
// BindRepository returns the client stub implementing the Repository
@@ -138,9 +138,9 @@
name string
}
-func (__gen_c *clientStubRepository) Put(Profiles []string, Envelope application.Envelope, opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Put", []interface{}{Profiles, Envelope}, opts...); err != nil {
+func (__gen_c *clientStubRepository) Put(ctx _gen_ipc.Context, Profiles []string, Envelope application.Envelope, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Put", []interface{}{Profiles, Envelope}, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -149,9 +149,9 @@
return
}
-func (__gen_c *clientStubRepository) Remove(Profile string, opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Remove", []interface{}{Profile}, opts...); err != nil {
+func (__gen_c *clientStubRepository) Remove(ctx _gen_ipc.Context, Profile string, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Remove", []interface{}{Profile}, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -160,9 +160,9 @@
return
}
-func (__gen_c *clientStubRepository) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubRepository) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -171,9 +171,9 @@
return
}
-func (__gen_c *clientStubRepository) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubRepository) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -182,9 +182,9 @@
return
}
-func (__gen_c *clientStubRepository) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubRepository) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
diff --git a/services/mgmt/application/impl/impl_test.go b/services/mgmt/application/impl/impl_test.go
index c80ddc7..4783058 100644
--- a/services/mgmt/application/impl/impl_test.go
+++ b/services/mgmt/application/impl/impl_test.go
@@ -16,6 +16,7 @@
// the Application interface.
func TestInterface(t *testing.T) {
runtime := rt.Init()
+ ctx := runtime.NewContext()
defer runtime.Shutdown()
// Setup and start the application manager server.
@@ -69,71 +70,71 @@
}
// Test Put(), adding a number of application envelopes.
- if err := stubV1.Put([]string{"base", "media"}, envelopeV1); err != nil {
+ if err := stubV1.Put(ctx, []string{"base", "media"}, envelopeV1); err != nil {
t.Fatalf("Put() failed: %v", err)
}
- if err := stubV2.Put([]string{"base"}, envelopeV2); err != nil {
+ if err := stubV2.Put(ctx, []string{"base"}, envelopeV2); err != nil {
t.Fatalf("Put() failed: %v", err)
}
- if err := stub.Put([]string{"base", "media"}, envelopeV1); err == nil || err.Error() != errInvalidSuffix.Error() {
+ if err := stub.Put(ctx, []string{"base", "media"}, envelopeV1); err == nil || err.Error() != errInvalidSuffix.Error() {
t.Fatalf("Unexpected error: expected %v, got %v", errInvalidSuffix, err)
}
// Test Match(), trying to retrieve both existing and non-existing
// application envelopes.
var output application.Envelope
- if output, err = stubV2.Match([]string{"base", "media"}); err != nil {
+ if output, err = stubV2.Match(ctx, []string{"base", "media"}); err != nil {
t.Fatalf("Match() failed: %v", err)
}
if !reflect.DeepEqual(envelopeV2, output) {
t.Fatalf("Incorrect output: expected %v, got %v", envelopeV2, output)
}
- if output, err = stubV1.Match([]string{"media"}); err != nil {
+ if output, err = stubV1.Match(ctx, []string{"media"}); err != nil {
t.Fatalf("Match() failed: %v", err)
}
if !reflect.DeepEqual(envelopeV1, output) {
t.Fatalf("Unexpected output: expected %v, got %v", envelopeV1, output)
}
- if _, err := stubV2.Match([]string{"media"}); err == nil || err.Error() != errNotFound.Error() {
+ if _, err := stubV2.Match(ctx, []string{"media"}); err == nil || err.Error() != errNotFound.Error() {
t.Fatalf("Unexpected error: expected %v, got %v", errNotFound, err)
}
- if _, err := stubV2.Match([]string{}); err == nil || err.Error() != errNotFound.Error() {
+ if _, err := stubV2.Match(ctx, []string{}); err == nil || err.Error() != errNotFound.Error() {
t.Fatalf("Unexpected error: expected %v, got %v", errNotFound, err)
}
- if _, err := stub.Match([]string{"media"}); err == nil || err.Error() != errInvalidSuffix.Error() {
+ if _, err := stub.Match(ctx, []string{"media"}); err == nil || err.Error() != errInvalidSuffix.Error() {
t.Fatalf("Unexpected error: expected %v, got %v", errInvalidSuffix, err)
}
// Test Remove(), trying to remove both existing and non-existing
// application envelopes.
- if err := stubV1.Remove("base"); err != nil {
+ if err := stubV1.Remove(ctx, "base"); err != nil {
t.Fatalf("Remove() failed: %v", err)
}
- if output, err = stubV1.Match([]string{"media"}); err != nil {
+ if output, err = stubV1.Match(ctx, []string{"media"}); err != nil {
t.Fatalf("Match() failed: %v", err)
}
- if err := stubV1.Remove("base"); err == nil || err.Error() != errNotFound.Error() {
+ if err := stubV1.Remove(ctx, "base"); err == nil || err.Error() != errNotFound.Error() {
t.Fatalf("Unexpected error: expected %v, got %v", errNotFound, err)
}
- if err := stub.Remove("base"); err != nil {
+ if err := stub.Remove(ctx, "base"); err != nil {
t.Fatalf("Remove() failed: %v", err)
}
- if err := stubV2.Remove("media"); err == nil || err.Error() != errNotFound.Error() {
+ if err := stubV2.Remove(ctx, "media"); err == nil || err.Error() != errNotFound.Error() {
t.Fatalf("Unexpected error: expected %v, got %v", errNotFound, err)
}
- if err := stubV1.Remove("media"); err != nil {
+ if err := stubV1.Remove(ctx, "media"); err != nil {
t.Fatalf("Remove() failed: %v", err)
}
// Finally, use Match() to test that Remove really removed the
// application envelopes.
- if _, err := stubV1.Match([]string{"base"}); err == nil || err.Error() != errNotFound.Error() {
+ if _, err := stubV1.Match(ctx, []string{"base"}); err == nil || err.Error() != errNotFound.Error() {
t.Fatalf("Unexpected error: expected %v, got %v", errNotFound, err)
}
- if _, err := stubV1.Match([]string{"media"}); err == nil || err.Error() != errNotFound.Error() {
+ if _, err := stubV1.Match(ctx, []string{"media"}); err == nil || err.Error() != errNotFound.Error() {
t.Fatalf("Unexpected error: expected %v, got %v", errNotFound, err)
}
- if _, err := stubV2.Match([]string{"base"}); err == nil || err.Error() != errNotFound.Error() {
+ if _, err := stubV2.Match(ctx, []string{"base"}); err == nil || err.Error() != errNotFound.Error() {
t.Fatalf("Unexpected error: expected %v, got %v", errNotFound, err)
}
diff --git a/services/mgmt/application/impl/invoker.go b/services/mgmt/application/impl/invoker.go
index 6273e54..4ec02e0 100644
--- a/services/mgmt/application/impl/invoker.go
+++ b/services/mgmt/application/impl/invoker.go
@@ -51,13 +51,13 @@
type dir struct{}
// makeParentNodes creates the parent nodes if they do not already exist.
-func makeParentNodes(store storage.Store, transaction storage.Transaction, path string) error {
+func makeParentNodes(context ipc.ServerContext, store storage.Store, transaction storage.Transaction, path string) error {
pathComponents := storage.ParsePath(path)
for i := 0; i < len(pathComponents); i++ {
name := pathComponents[:i].String()
object := store.Bind(name)
- if _, err := object.Get(transaction); err != nil {
- if _, err := object.Put(transaction, &dir{}); err != nil {
+ if _, err := object.Get(context, transaction); err != nil {
+ if _, err := object.Put(context, transaction, &dir{}); err != nil {
return errOperationFailed
}
}
@@ -65,7 +65,7 @@
return nil
}
-func (i *invoker) Match(context ipc.Context, profiles []string) (application.Envelope, error) {
+func (i *invoker) Match(context ipc.ServerContext, profiles []string) (application.Envelope, error) {
vlog.VI(0).Infof("%v.Match(%v)", i.suffix, profiles)
empty := application.Envelope{}
name, version, err := parse(i.suffix)
@@ -78,7 +78,7 @@
for _, profile := range profiles {
path := path.Join("/applications", name, profile, version)
object := i.store.Bind(path)
- entry, err := object.Get(nil)
+ entry, err := object.Get(context, nil)
if err != nil {
continue
}
@@ -91,7 +91,7 @@
return empty, errNotFound
}
-func (i *invoker) Put(context ipc.Context, profiles []string, envelope application.Envelope) error {
+func (i *invoker) Put(context ipc.ServerContext, profiles []string, envelope application.Envelope) error {
vlog.VI(0).Infof("%v.Put(%v, %v)", i.suffix, profiles, envelope)
name, version, err := parse(i.suffix)
if err != nil {
@@ -100,53 +100,53 @@
if version == "" {
return errInvalidSuffix
}
- transaction := primitives.NewTransaction()
+ transaction := primitives.NewTransaction(context)
var entry storage.Stat
for _, profile := range profiles {
path := path.Join("/applications", name, profile, version)
- if err := makeParentNodes(i.store, transaction, path); err != nil {
+ if err := makeParentNodes(context, i.store, transaction, path); err != nil {
return err
}
object := i.store.Bind(path)
if !entry.ID.IsValid() {
- if entry, err = object.Put(transaction, envelope); err != nil {
+ if entry, err = object.Put(context, transaction, envelope); err != nil {
return errOperationFailed
}
} else {
- if _, err := object.Put(transaction, entry.ID); err != nil {
+ if _, err := object.Put(context, transaction, entry.ID); err != nil {
return errOperationFailed
}
}
}
- if err := transaction.Commit(); err != nil {
+ if err := transaction.Commit(context); err != nil {
return errOperationFailed
}
return nil
}
-func (i *invoker) Remove(context ipc.Context, profile string) error {
+func (i *invoker) Remove(context ipc.ServerContext, profile string) error {
vlog.VI(0).Infof("%v.Remove(%v)", i.suffix, profile)
name, version, err := parse(i.suffix)
if err != nil {
return err
}
- transaction := primitives.NewTransaction()
+ transaction := primitives.NewTransaction(context)
path := path.Join("/applications", name, profile)
if version != "" {
path += "/" + version
}
object := i.store.Bind(path)
- found, err := object.Exists(transaction)
+ found, err := object.Exists(context, transaction)
if err != nil {
return errOperationFailed
}
if !found {
return errNotFound
}
- if err := object.Remove(transaction); err != nil {
+ if err := object.Remove(context, transaction); err != nil {
return errOperationFailed
}
- if err := transaction.Commit(); err != nil {
+ if err := transaction.Commit(context); err != nil {
return errOperationFailed
}
return nil
diff --git a/services/mgmt/content/impl/impl_test.go b/services/mgmt/content/impl/impl_test.go
index 45f3465..37792e1 100644
--- a/services/mgmt/content/impl/impl_test.go
+++ b/services/mgmt/content/impl/impl_test.go
@@ -25,7 +25,7 @@
// invokeUpload invokes the Upload RPC using the given client stub
// <stub> and streams the given content <content> to it.
func invokeUpload(t *testing.T, stub content.Content, content []byte) (string, error) {
- stream, err := stub.Upload()
+ stream, err := stub.Upload(rt.R().NewContext())
if err != nil {
return "", err
}
@@ -47,7 +47,7 @@
// invokeDownload invokes the Download RPC using the given client stub
// <stub> and streams content from to it.
func invokeDownload(t *testing.T, stub content.Content) ([]byte, error) {
- stream, err := stub.Download()
+ stream, err := stub.Download(rt.R().NewContext())
if err != nil {
return nil, err
}
@@ -62,7 +62,7 @@
// invokeDelete invokes the Delete RPC using the given client stub
// <stub>.
func invokeDelete(t *testing.T, stub content.Content) error {
- return stub.Delete()
+ return stub.Delete(rt.R().NewContext())
}
// testInterface tests the content manager interface using the given
diff --git a/services/mgmt/content/impl/invoker.go b/services/mgmt/content/impl/invoker.go
index 4638f7e..f39f644 100644
--- a/services/mgmt/content/impl/invoker.go
+++ b/services/mgmt/content/impl/invoker.go
@@ -88,7 +88,7 @@
return dir
}
-func (i *invoker) Delete(context ipc.Context) error {
+func (i *invoker) Delete(context ipc.ServerContext) error {
vlog.VI(0).Infof("%v.Delete()", i.suffix)
if !isValid(i.suffix) {
return errInvalidSuffix
@@ -116,7 +116,7 @@
return nil
}
-func (i *invoker) Download(context ipc.Context, stream content.ContentServiceDownloadStream) error {
+func (i *invoker) Download(context ipc.ServerContext, stream content.ContentServiceDownloadStream) error {
vlog.VI(0).Infof("%v.Download()", i.suffix)
if !isValid(i.suffix) {
return errInvalidSuffix
@@ -147,7 +147,7 @@
return nil
}
-func (i *invoker) Upload(context ipc.Context, stream content.ContentServiceUploadStream) (string, error) {
+func (i *invoker) Upload(context ipc.ServerContext, stream content.ContentServiceUploadStream) (string, error) {
vlog.VI(0).Infof("%v.Upload()", i.suffix)
if i.suffix != "" {
return "", errInvalidSuffix
diff --git a/services/mgmt/node/impl/impl_test.go b/services/mgmt/node/impl/impl_test.go
index 136b401..ddebcc2 100644
--- a/services/mgmt/node/impl/impl_test.go
+++ b/services/mgmt/node/impl/impl_test.go
@@ -33,7 +33,7 @@
envelope *application.Envelope
}
-func (i *arInvoker) Match(_ ipc.Context, _ []string) (application.Envelope, error) {
+func (i *arInvoker) Match(_ ipc.ServerContext, _ []string) (application.Envelope, error) {
vlog.VI(1).Infof("Match()")
return *i.envelope, nil
}
@@ -42,11 +42,11 @@
type cmInvoker struct{}
-func (i *cmInvoker) Delete(_ ipc.Context) error {
+func (i *cmInvoker) Delete(_ ipc.ServerContext) error {
return nil
}
-func (i *cmInvoker) Download(_ ipc.Context, stream content.ContentServiceDownloadStream) error {
+func (i *cmInvoker) Download(_ ipc.ServerContext, stream content.ContentServiceDownloadStream) error {
vlog.VI(1).Infof("Download()")
file, err := os.Open(os.Args[0])
if err != nil {
@@ -72,7 +72,7 @@
return nil
}
-func (i *cmInvoker) Upload(_ ipc.Context, _ content.ContentServiceUploadStream) (string, error) {
+func (i *cmInvoker) Upload(_ ipc.ServerContext, _ content.ContentServiceUploadStream) (string, error) {
return "", nil
}
@@ -99,7 +99,7 @@
if err != nil {
t.Fatalf("BindNode(%v) failed: %v", address, err)
}
- if err := nmClient.Update(); err != nil {
+ if err := nmClient.Update(rt.R().NewContext()); err != nil {
t.Fatalf("%v.Update() failed: %v", address, err)
}
}
diff --git a/services/mgmt/node/impl/invoker.go b/services/mgmt/node/impl/invoker.go
index a50c6ba..475307c 100644
--- a/services/mgmt/node/impl/invoker.go
+++ b/services/mgmt/node/impl/invoker.go
@@ -235,7 +235,7 @@
return result
}
-func (i *invoker) Describe(call ipc.Context) (node.Description, error) {
+func (i *invoker) Describe(call ipc.ServerContext) (node.Description, error) {
vlog.VI(0).Infof("%v.Describe()", i.suffix)
empty := node.Description{}
nodeProfile, err := i.computeNodeProfile()
@@ -250,7 +250,7 @@
return result, nil
}
-func (i *invoker) IsRunnable(call ipc.Context, binary build.BinaryDescription) (bool, error) {
+func (i *invoker) IsRunnable(call ipc.ServerContext, binary build.BinaryDescription) (bool, error) {
vlog.VI(0).Infof("%v.IsRunnable(%v)", i.suffix, binary)
nodeProfile, err := i.computeNodeProfile()
if err != nil {
@@ -268,7 +268,7 @@
return len(result.Profiles) > 0, nil
}
-func (i *invoker) Reset(call ipc.Context, deadline uint64) error {
+func (i *invoker) Reset(call ipc.ServerContext, deadline uint64) error {
vlog.VI(0).Infof("%v.Reset(%v)", i.suffix, deadline)
// TODO(jsimsa): Implement.
return nil
@@ -282,7 +282,7 @@
vlog.Errorf("BindContent(%q) failed: %v", binary, err)
return "", errOperationFailed
}
- stream, err := stub.Download()
+ stream, err := stub.Download(rt.R().NewContext())
if err != nil {
vlog.Errorf("Download() failed: %v", err)
return "", errOperationFailed
@@ -333,7 +333,7 @@
// TODO(jsimsa): Include logic that computes the set of supported
// profiles.
profiles := []string{"test"}
- envelope, err := stub.Match(profiles)
+ envelope, err := stub.Match(rt.R().NewContext(), profiles)
if err != nil {
vlog.Errorf("Match(%v) failed: %v", profiles, err)
return nil, errOperationFailed
@@ -374,25 +374,25 @@
return nil
}
-func (i *invoker) Install(call ipc.Context) (string, error) {
+func (i *invoker) Install(call ipc.ServerContext) (string, error) {
vlog.VI(0).Infof("%v.Install()", i.suffix)
// TODO(jsimsa): Implement.
return "", nil
}
-func (i *invoker) Start(call ipc.Context) ([]string, error) {
+func (i *invoker) Start(call ipc.ServerContext) ([]string, error) {
vlog.VI(0).Infof("%v.Start()", i.suffix)
// TODO(jsimsa): Implement.
return make([]string, 0), nil
}
-func (i *invoker) Uninstall(call ipc.Context) error {
+func (i *invoker) Uninstall(call ipc.ServerContext) error {
vlog.VI(0).Infof("%v.Uninstall()", i.suffix)
// TODO(jsimsa): Implement.
return nil
}
-func (i *invoker) Update(call ipc.Context) error {
+func (i *invoker) Update(call ipc.ServerContext) error {
vlog.VI(0).Infof("%v.Update()", i.suffix)
switch {
case i.suffix == "nm":
@@ -428,31 +428,31 @@
}
}
-func (i *invoker) Refresh(call ipc.Context) error {
+func (i *invoker) Refresh(call ipc.ServerContext) error {
vlog.VI(0).Infof("%v.Refresh()", i.suffix)
// TODO(jsimsa): Implement.
return nil
}
-func (i *invoker) Restart(call ipc.Context) error {
+func (i *invoker) Restart(call ipc.ServerContext) error {
vlog.VI(0).Infof("%v.Restart()", i.suffix)
// TODO(jsimsa): Implement.
return nil
}
-func (i *invoker) Resume(call ipc.Context) error {
+func (i *invoker) Resume(call ipc.ServerContext) error {
vlog.VI(0).Infof("%v.Resume()", i.suffix)
// TODO(jsimsa): Implement.
return nil
}
-func (i *invoker) Shutdown(call ipc.Context, deadline uint64) error {
+func (i *invoker) Shutdown(call ipc.ServerContext, deadline uint64) error {
vlog.VI(0).Infof("%v.Shutdown(%v)", i.suffix, deadline)
// TODO(jsimsa): Implement.
return nil
}
-func (i *invoker) Suspend(call ipc.Context) error {
+func (i *invoker) Suspend(call ipc.ServerContext) error {
vlog.VI(0).Infof("%v.Suspend()", i.suffix)
// TODO(jsimsa): Implement.
return nil
diff --git a/services/mgmt/profile/impl/impl_test.go b/services/mgmt/profile/impl/impl_test.go
index 2d27e81..9a92045 100644
--- a/services/mgmt/profile/impl/impl_test.go
+++ b/services/mgmt/profile/impl/impl_test.go
@@ -26,6 +26,8 @@
runtime := rt.Init()
defer runtime.Shutdown()
+ ctx := runtime.NewContext()
+
// Setup and start the profile manager server.
server, err := runtime.NewServer()
if err != nil {
@@ -62,12 +64,12 @@
}
// Put
- if err := stub.Put(spec); err != nil {
+ if err := stub.Put(ctx, spec); err != nil {
t.Fatalf("Put() failed: %v", err)
}
// Label
- label, err := stub.Label()
+ label, err := stub.Label(ctx)
if err != nil {
t.Fatalf("Label() failed: %v", err)
}
@@ -76,7 +78,7 @@
}
// Description
- description, err := stub.Description()
+ description, err := stub.Description(ctx)
if err != nil {
t.Fatalf("Description() failed: %v", err)
}
@@ -85,7 +87,7 @@
}
// Specification
- specification, err := stub.Specification()
+ specification, err := stub.Specification(ctx)
if err != nil {
t.Fatalf("Specification() failed: %v", err)
}
@@ -94,7 +96,7 @@
}
// Remove
- if err := stub.Remove(); err != nil {
+ if err := stub.Remove(ctx); err != nil {
t.Fatalf("Remove() failed: %v", err)
}
diff --git a/services/mgmt/profile/impl/invoker.go b/services/mgmt/profile/impl/invoker.go
index 0e77181..b3cc3d9 100644
--- a/services/mgmt/profile/impl/invoker.go
+++ b/services/mgmt/profile/impl/invoker.go
@@ -38,13 +38,13 @@
type dir struct{}
// makeParentNodes creates the parent nodes if they do not already exist.
-func makeParentNodes(store storage.Store, transaction storage.Transaction, path string) error {
+func makeParentNodes(context ipc.ServerContext, store storage.Store, transaction storage.Transaction, path string) error {
pathComponents := storage.ParsePath(path)
for i := 0; i < len(pathComponents); i++ {
name := pathComponents[:i].String()
object := store.Bind(name)
- if _, err := object.Get(transaction); err != nil {
- if _, err := object.Put(transaction, &dir{}); err != nil {
+ if _, err := object.Get(context, transaction); err != nil {
+ if _, err := object.Put(context, transaction, &dir{}); err != nil {
return errOperationFailed
}
}
@@ -52,39 +52,39 @@
return nil
}
-func (i *invoker) Put(context ipc.Context, profile profile.Specification) error {
+func (i *invoker) Put(context ipc.ServerContext, profile profile.Specification) error {
vlog.VI(0).Infof("%v.Put(%v)", i.suffix, profile)
- transaction := primitives.NewTransaction()
+ transaction := primitives.NewTransaction(context)
path := path.Join("/profiles", i.suffix)
- if err := makeParentNodes(i.store, transaction, path); err != nil {
+ if err := makeParentNodes(context, i.store, transaction, path); err != nil {
return err
}
object := i.store.Bind(path)
- if _, err := object.Put(transaction, profile); err != nil {
+ if _, err := object.Put(context, transaction, profile); err != nil {
return errOperationFailed
}
- if err := transaction.Commit(); err != nil {
+ if err := transaction.Commit(context); err != nil {
return errOperationFailed
}
return nil
}
-func (i *invoker) Remove(context ipc.Context) error {
+func (i *invoker) Remove(context ipc.ServerContext) error {
vlog.VI(0).Infof("%v.Remove(%v)", i.suffix)
- transaction := primitives.NewTransaction()
+ transaction := primitives.NewTransaction(context)
path := path.Join("/profiles", i.suffix)
object := i.store.Bind(path)
- found, err := object.Exists(transaction)
+ found, err := object.Exists(context, transaction)
if err != nil {
return errOperationFailed
}
if !found {
return errNotFound
}
- if err := object.Remove(transaction); err != nil {
+ if err := object.Remove(context, transaction); err != nil {
return errOperationFailed
}
- if err := transaction.Commit(); err != nil {
+ if err := transaction.Commit(context); err != nil {
return errOperationFailed
}
return nil
@@ -92,11 +92,11 @@
// PROFILE INTERACE IMPLEMENTATION
-func (i *invoker) lookup() (profile.Specification, error) {
+func (i *invoker) lookup(context ipc.ServerContext) (profile.Specification, error) {
empty := profile.Specification{}
path := path.Join("/profiles", i.suffix)
object := i.store.Bind(path)
- entry, err := object.Get(nil)
+ entry, err := object.Get(context, nil)
if err != nil {
return empty, errNotFound
}
@@ -107,25 +107,25 @@
return s, nil
}
-func (i *invoker) Label(context ipc.Context) (string, error) {
+func (i *invoker) Label(context ipc.ServerContext) (string, error) {
vlog.VI(0).Infof("%v.Label()", i.suffix)
- s, err := i.lookup()
+ s, err := i.lookup(context)
if err != nil {
return "", err
}
return s.Label, nil
}
-func (i *invoker) Description(context ipc.Context) (string, error) {
+func (i *invoker) Description(context ipc.ServerContext) (string, error) {
vlog.VI(0).Infof("%v.Description()", i.suffix)
- s, err := i.lookup()
+ s, err := i.lookup(context)
if err != nil {
return "", err
}
return s.Description, nil
}
-func (i *invoker) Specification(context ipc.Context) (profile.Specification, error) {
+func (i *invoker) Specification(context ipc.ServerContext) (profile.Specification, error) {
vlog.VI(0).Infof("%v.Specification()", i.suffix)
- return i.lookup()
+ return i.lookup(context)
}
diff --git a/services/mgmt/profile/profile.vdl.go b/services/mgmt/profile/profile.vdl.go
index 543e908..f5914a3 100644
--- a/services/mgmt/profile/profile.vdl.go
+++ b/services/mgmt/profile/profile.vdl.go
@@ -67,13 +67,13 @@
profile.Profile_ExcludingUniversal
// Specification returns the profile specification for the profile
// identified through the veyron name suffix.
- Specification(opts ..._gen_ipc.ClientCallOpt) (reply Specification, err error)
+ Specification(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply Specification, err error)
// Put sets the profile specification for the profile identified
// through the veyron name suffix.
- Put(Specification Specification, opts ..._gen_ipc.ClientCallOpt) (err error)
+ Put(ctx _gen_ipc.Context, Specification Specification, opts ..._gen_ipc.CallOpt) (err error)
// Remove removes the profile specification for the profile
// identified through the veyron name suffix.
- Remove(opts ..._gen_ipc.ClientCallOpt) (err error)
+ Remove(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error)
}
type Profile interface {
_gen_ipc.UniversalServiceMethods
@@ -90,13 +90,13 @@
profile.ProfileService
// Specification returns the profile specification for the profile
// identified through the veyron name suffix.
- Specification(context _gen_ipc.Context) (reply Specification, err error)
+ Specification(context _gen_ipc.ServerContext) (reply Specification, err error)
// Put sets the profile specification for the profile identified
// through the veyron name suffix.
- Put(context _gen_ipc.Context, Specification Specification) (err error)
+ Put(context _gen_ipc.ServerContext, Specification Specification) (err error)
// Remove removes the profile specification for the profile
// identified through the veyron name suffix.
- Remove(context _gen_ipc.Context) (err error)
+ Remove(context _gen_ipc.ServerContext) (err error)
}
// BindProfile returns the client stub implementing the Profile
@@ -146,9 +146,9 @@
name string
}
-func (__gen_c *clientStubProfile) Specification(opts ..._gen_ipc.ClientCallOpt) (reply Specification, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Specification", nil, opts...); err != nil {
+func (__gen_c *clientStubProfile) Specification(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply Specification, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Specification", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -157,9 +157,9 @@
return
}
-func (__gen_c *clientStubProfile) Put(Specification Specification, opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Put", []interface{}{Specification}, opts...); err != nil {
+func (__gen_c *clientStubProfile) Put(ctx _gen_ipc.Context, Specification Specification, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Put", []interface{}{Specification}, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -168,9 +168,9 @@
return
}
-func (__gen_c *clientStubProfile) Remove(opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Remove", nil, opts...); err != nil {
+func (__gen_c *clientStubProfile) Remove(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Remove", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -179,9 +179,9 @@
return
}
-func (__gen_c *clientStubProfile) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubProfile) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -190,9 +190,9 @@
return
}
-func (__gen_c *clientStubProfile) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubProfile) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -201,9 +201,9 @@
return
}
-func (__gen_c *clientStubProfile) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubProfile) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
diff --git a/services/mgmt/root/impl/root.go b/services/mgmt/root/impl/root.go
index bfd6e71..7c6cb62 100644
--- a/services/mgmt/root/impl/root.go
+++ b/services/mgmt/root/impl/root.go
@@ -28,7 +28,7 @@
cmd.Run()
}
-func (i *invoker) Reset(call ipc.Context, deadline uint64) error {
+func (i *invoker) Reset(call ipc.ServerContext, deadline uint64) error {
vlog.VI(0).Infof("Reset(%v).", deadline)
switch runtime.GOOS {
case "linux":
diff --git a/services/mgmt/root/root.vdl.go b/services/mgmt/root/root.vdl.go
index 99c9c2a..6fb23f5 100644
--- a/services/mgmt/root/root.vdl.go
+++ b/services/mgmt/root/root.vdl.go
@@ -23,7 +23,7 @@
type Root_ExcludingUniversal interface {
// Reset waits for the given deadline (in milliseconds) and then
// restars the host node machine.
- Reset(Deadline uint64, opts ..._gen_ipc.ClientCallOpt) (err error)
+ Reset(ctx _gen_ipc.Context, Deadline uint64, opts ..._gen_ipc.CallOpt) (err error)
}
type Root interface {
_gen_ipc.UniversalServiceMethods
@@ -35,7 +35,7 @@
// Reset waits for the given deadline (in milliseconds) and then
// restars the host node machine.
- Reset(context _gen_ipc.Context, Deadline uint64) (err error)
+ Reset(context _gen_ipc.ServerContext, Deadline uint64) (err error)
}
// BindRoot returns the client stub implementing the Root
@@ -81,9 +81,9 @@
name string
}
-func (__gen_c *clientStubRoot) Reset(Deadline uint64, opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Reset", []interface{}{Deadline}, opts...); err != nil {
+func (__gen_c *clientStubRoot) Reset(ctx _gen_ipc.Context, Deadline uint64, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Reset", []interface{}{Deadline}, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -92,9 +92,9 @@
return
}
-func (__gen_c *clientStubRoot) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubRoot) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -103,9 +103,9 @@
return
}
-func (__gen_c *clientStubRoot) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubRoot) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -114,9 +114,9 @@
return
}
-func (__gen_c *clientStubRoot) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubRoot) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
diff --git a/services/mounttable/lib/collection_test.vdl.go b/services/mounttable/lib/collection_test.vdl.go
index a3d516c..cd99693 100644
--- a/services/mounttable/lib/collection_test.vdl.go
+++ b/services/mounttable/lib/collection_test.vdl.go
@@ -21,10 +21,10 @@
// an entry exists, if Overwrite is true, then the binding is replaced,
// otherwise the call fails with an error. The Val must be no larger than
// MaxSize bytes.
- Export(Val string, Overwrite bool, opts ..._gen_ipc.ClientCallOpt) (err error)
+ Export(ctx _gen_ipc.Context, Val string, Overwrite bool, opts ..._gen_ipc.CallOpt) (err error)
// Lookup retrieves the value associated with a name. Returns an error if
// there is no such binding.
- Lookup(opts ..._gen_ipc.ClientCallOpt) (reply []byte, err error)
+ Lookup(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []byte, err error)
}
type Collection interface {
_gen_ipc.UniversalServiceMethods
@@ -38,10 +38,10 @@
// an entry exists, if Overwrite is true, then the binding is replaced,
// otherwise the call fails with an error. The Val must be no larger than
// MaxSize bytes.
- Export(context _gen_ipc.Context, Val string, Overwrite bool) (err error)
+ Export(context _gen_ipc.ServerContext, Val string, Overwrite bool) (err error)
// Lookup retrieves the value associated with a name. Returns an error if
// there is no such binding.
- Lookup(context _gen_ipc.Context) (reply []byte, err error)
+ Lookup(context _gen_ipc.ServerContext) (reply []byte, err error)
}
// BindCollection returns the client stub implementing the Collection
@@ -87,9 +87,9 @@
name string
}
-func (__gen_c *clientStubCollection) Export(Val string, Overwrite bool, opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Export", []interface{}{Val, Overwrite}, opts...); err != nil {
+func (__gen_c *clientStubCollection) Export(ctx _gen_ipc.Context, Val string, Overwrite bool, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Export", []interface{}{Val, Overwrite}, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -98,9 +98,9 @@
return
}
-func (__gen_c *clientStubCollection) Lookup(opts ..._gen_ipc.ClientCallOpt) (reply []byte, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Lookup", nil, opts...); err != nil {
+func (__gen_c *clientStubCollection) Lookup(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []byte, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Lookup", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -109,9 +109,9 @@
return
}
-func (__gen_c *clientStubCollection) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubCollection) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -120,9 +120,9 @@
return
}
-func (__gen_c *clientStubCollection) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubCollection) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -131,9 +131,9 @@
return
}
-func (__gen_c *clientStubCollection) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubCollection) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
diff --git a/services/mounttable/lib/mounttable.go b/services/mounttable/lib/mounttable.go
index e0528ed..fe0cecf 100644
--- a/services/mounttable/lib/mounttable.go
+++ b/services/mounttable/lib/mounttable.go
@@ -204,7 +204,7 @@
// ResolveStep returns the next server in a resolution, the name remaining below that server,
// and whether or not that server is another mount table.
-func (ms *mountContext) ResolveStep(context ipc.Context) (servers []mounttable.MountedServer, suffix string, err error) {
+func (ms *mountContext) ResolveStep(context ipc.ServerContext) (servers []mounttable.MountedServer, suffix string, err error) {
vlog.VI(2).Infof("ResolveStep %q", ms.name)
mt := ms.mt
// TODO(caprita): we need to grab a write lock because walk may
@@ -224,7 +224,7 @@
}
// Mount a server onto the name in the receiver.
-func (ms *mountContext) Mount(context ipc.Context, server string, ttlsecs uint32) error {
+func (ms *mountContext) Mount(context ipc.ServerContext, server string, ttlsecs uint32) error {
mt := ms.mt
if ttlsecs == 0 {
ttlsecs = 10 * 365 * 24 * 60 * 60 // a really long time
@@ -290,7 +290,7 @@
// Unmount removes servers from the name in the receiver. If server is specified, only that
// server is removed.
-func (ms *mountContext) Unmount(context ipc.Context, server string) error {
+func (ms *mountContext) Unmount(context ipc.ServerContext, server string) error {
mt := ms.mt
mt.Lock()
defer mt.Unlock()
@@ -315,7 +315,7 @@
name string
}
-func (mt *mountTable) globStep(n *node, name string, pattern *glob.Glob, context ipc.Context, reply mounttable.GlobableServiceGlobStream) {
+func (mt *mountTable) globStep(n *node, name string, pattern *glob.Glob, context ipc.ServerContext, reply mounttable.GlobableServiceGlobStream) {
vlog.VI(2).Infof("globStep(%s, %s)", name, pattern)
if mt.acls != nil {
@@ -363,7 +363,7 @@
// Glob finds matches in the namespace. If we reach a mount point before matching the
// whole pattern, return that mount point.
// pattern is a glob pattern as defined by the veyron/lib/glob package.
-func (ms *mountContext) Glob(context ipc.Context, pattern string, reply mounttable.GlobableServiceGlobStream) error {
+func (ms *mountContext) Glob(context ipc.ServerContext, pattern string, reply mounttable.GlobableServiceGlobStream) error {
vlog.VI(2).Infof("mt.Glob %v", ms.elems)
g, err := glob.Parse(pattern)
diff --git a/services/mounttable/lib/mounttable_test.go b/services/mounttable/lib/mounttable_test.go
index a8e7d86..d9e2bc2 100644
--- a/services/mounttable/lib/mounttable_test.go
+++ b/services/mounttable/lib/mounttable_test.go
@@ -76,7 +76,7 @@
if err != nil {
return nil, err
}
- ss, suffix, err := objectPtr.ResolveStep()
+ ss, suffix, err := objectPtr.ResolveStep(rt.R().NewContext())
if err != nil {
return nil, err
}
@@ -106,7 +106,7 @@
if err != nil {
boom(t, "Failed to BindMountTable: %s", err)
}
- if err := mtpt.Mount(service, uint32(ttlSecs)); err != nil {
+ if err := mtpt.Mount(rt.R().NewContext(), service, uint32(ttlSecs)); err != nil {
if shouldSucceed {
boom(t, "Failed to Mount %s onto %s: %s", service, name, err)
}
@@ -120,7 +120,7 @@
if err != nil {
boom(t, "Failed to BindMountTable: %s", err)
}
- if err := mtpt.Unmount(service); err != nil {
+ if err := mtpt.Unmount(rt.R().NewContext(), service); err != nil {
if shouldSucceed {
boom(t, "Failed to Unmount %s onto %s: %s", service, name, err)
}
@@ -134,7 +134,7 @@
if err != nil {
boom(t, "Failed to BindCollection: %s", err)
}
- if err := objectPtr.Export(contents, true); err != nil {
+ if err := objectPtr.Export(rt.R().NewContext(), contents, true); err != nil {
boom(t, "Failed to Export %s to %s: %s", name, contents, err)
}
}
@@ -144,7 +144,7 @@
if err != nil {
boom(t, "Failed to BindCollection: %s", err)
}
- contents, err := objectPtr.Lookup()
+ contents, err := objectPtr.Lookup(rt.R().NewContext())
if err != nil {
if shouldSucceed {
boom(t, "Failed to Lookup %s: %s", name, err)
@@ -250,7 +250,7 @@
if err != nil {
boom(t, "Failed to BindMountTable: %s", err)
}
- stream, err := mtpt.Glob(pattern)
+ stream, err := mtpt.Glob(rt.R().NewContext(), pattern)
if err != nil {
boom(t, "Failed call to %s.Glob(%s): %s", name, pattern, err)
}
diff --git a/services/mounttable/lib/neighborhood.go b/services/mounttable/lib/neighborhood.go
index 6356335..4165ac3 100644
--- a/services/mounttable/lib/neighborhood.go
+++ b/services/mounttable/lib/neighborhood.go
@@ -171,7 +171,7 @@
}
// ResolveStep implements ResolveStep
-func (ns *neighborhoodService) ResolveStep(_ ipc.Context) (servers []mounttable.MountedServer, suffix string, err error) {
+func (ns *neighborhoodService) ResolveStep(_ ipc.ServerContext) (servers []mounttable.MountedServer, suffix string, err error) {
nh := ns.nh
vlog.VI(2).Infof("ResolveStep %v\n", ns.elems)
if len(ns.elems) == 0 {
@@ -188,17 +188,17 @@
}
// Mount not implemented.
-func (*neighborhoodService) Mount(_ ipc.Context, server string, ttlsecs uint32) error {
+func (*neighborhoodService) Mount(_ ipc.ServerContext, server string, ttlsecs uint32) error {
return errors.New("this server does not implement Mount")
}
// Unmount not implemented.
-func (*neighborhoodService) Unmount(_ ipc.Context, _ string) error {
+func (*neighborhoodService) Unmount(_ ipc.ServerContext, _ string) error {
return errors.New("this server does not implement Unmount")
}
// Glob implements Glob
-func (ns *neighborhoodService) Glob(_ ipc.Context, pattern string, reply mounttable.GlobableServiceGlobStream) error {
+func (ns *neighborhoodService) Glob(_ ipc.ServerContext, pattern string, reply mounttable.GlobableServiceGlobStream) error {
g, err := glob.Parse(pattern)
if err != nil {
return err
diff --git a/services/mounttable/lib/neighborhood_test.go b/services/mounttable/lib/neighborhood_test.go
index 732fe3b..5528fb3 100644
--- a/services/mounttable/lib/neighborhood_test.go
+++ b/services/mounttable/lib/neighborhood_test.go
@@ -78,7 +78,7 @@
if err != nil {
boom(t, "BindMountTable: %s", err)
}
- servers, suffix, err := objectPtr.ResolveStep()
+ servers, suffix, err := objectPtr.ResolveStep(r.NewContext())
if err != nil {
boom(t, "resolveStep: %s", err)
}
diff --git a/services/store/memstore/blackbox/many_to_many/many_to_many_test.go b/services/store/memstore/blackbox/many_to_many/many_to_many_test.go
index 06d8615..7b62ff4 100644
--- a/services/store/memstore/blackbox/many_to_many/many_to_many_test.go
+++ b/services/store/memstore/blackbox/many_to_many/many_to_many_test.go
@@ -6,6 +6,7 @@
"veyron/services/store/memstore"
"veyron/services/store/memstore/blackbox"
+ "veyron/services/store/service"
"veyron2/security"
"veyron2/storage"
@@ -88,7 +89,7 @@
return &Role{Position: pos, Player: playerID, Team: teamID}
}
-func getPerson(t *testing.T, st *memstore.Store, tr storage.Transaction, path string) (storage.ID, *Person) {
+func getPerson(t *testing.T, st *memstore.Store, tr service.Transaction, path string) (storage.ID, *Person) {
_, file, line, _ := runtime.Caller(1)
e := blackbox.Get(t, st, tr, path)
v := e.Value
@@ -99,7 +100,7 @@
return e.Stat.ID, p
}
-func getPlayer(t *testing.T, st *memstore.Store, tr storage.Transaction, path string) (storage.ID, *Player) {
+func getPlayer(t *testing.T, st *memstore.Store, tr service.Transaction, path string) (storage.ID, *Player) {
_, file, line, _ := runtime.Caller(1)
e := blackbox.Get(t, st, tr, path)
v := e.Value
@@ -110,7 +111,7 @@
return e.Stat.ID, p
}
-func getTeam(t *testing.T, st *memstore.Store, tr storage.Transaction, path string) (storage.ID, *Team) {
+func getTeam(t *testing.T, st *memstore.Store, tr service.Transaction, path string) (storage.ID, *Team) {
_, file, line, _ := runtime.Caller(1)
e := blackbox.Get(t, st, tr, path)
v := e.Value
@@ -121,7 +122,7 @@
return e.Stat.ID, p
}
-func getRole(t *testing.T, st *memstore.Store, tr storage.Transaction, path string) (storage.ID, *Role) {
+func getRole(t *testing.T, st *memstore.Store, tr service.Transaction, path string) (storage.ID, *Role) {
_, file, line, _ := runtime.Caller(1)
e := blackbox.Get(t, st, tr, path)
v := e.Value
@@ -220,7 +221,7 @@
return &DirectTeam{}
}
-func getDirectPlayer(t *testing.T, st *memstore.Store, tr storage.Transaction, path string) (storage.ID, *DirectPlayer) {
+func getDirectPlayer(t *testing.T, st *memstore.Store, tr service.Transaction, path string) (storage.ID, *DirectPlayer) {
_, file, line, _ := runtime.Caller(1)
e := blackbox.Get(t, st, tr, path)
v := e.Value
@@ -231,7 +232,7 @@
return e.Stat.ID, p
}
-func getDirectTeam(t *testing.T, st *memstore.Store, tr storage.Transaction, path string) (storage.ID, *DirectTeam) {
+func getDirectTeam(t *testing.T, st *memstore.Store, tr service.Transaction, path string) (storage.ID, *DirectTeam) {
_, file, line, _ := runtime.Caller(1)
e := blackbox.Get(t, st, tr, path)
v := e.Value
diff --git a/services/store/memstore/blackbox/photoalbum_test.go b/services/store/memstore/blackbox/photoalbum_test.go
index 2b980b0..9890fe3 100644
--- a/services/store/memstore/blackbox/photoalbum_test.go
+++ b/services/store/memstore/blackbox/photoalbum_test.go
@@ -5,6 +5,7 @@
"testing"
"veyron/services/store/memstore"
+ "veyron/services/store/service"
"veyron2/storage"
"veyron2/vom"
@@ -64,7 +65,7 @@
return &Photo{Content: content, Comment: comment}
}
-func getPhoto(t *testing.T, st *memstore.Store, tr storage.Transaction, path string) *Photo {
+func getPhoto(t *testing.T, st *memstore.Store, tr service.Transaction, path string) *Photo {
_, file, line, _ := runtime.Caller(1)
v := Get(t, st, tr, path).Value
p, ok := v.(*Photo)
diff --git a/services/store/memstore/blackbox/team_player_test.go b/services/store/memstore/blackbox/team_player_test.go
index d6ac12e..fc9c3d0 100644
--- a/services/store/memstore/blackbox/team_player_test.go
+++ b/services/store/memstore/blackbox/team_player_test.go
@@ -6,6 +6,7 @@
"veyron/services/store/memstore"
"veyron/services/store/memstore/state"
+ "veyron/services/store/service"
"veyron2/storage"
"veyron2/vom"
@@ -40,7 +41,7 @@
return &Team{FullName: name}
}
-func getPlayer(t *testing.T, st *memstore.Store, tr storage.Transaction, path string) (storage.ID, *Player) {
+func getPlayer(t *testing.T, st *memstore.Store, tr service.Transaction, path string) (storage.ID, *Player) {
_, file, line, _ := runtime.Caller(1)
e := Get(t, st, tr, path)
p, ok := e.Value.(*Player)
@@ -50,7 +51,7 @@
return e.Stat.ID, p
}
-func getTeam(t *testing.T, st *memstore.Store, tr storage.Transaction, path string) (storage.ID, *Team) {
+func getTeam(t *testing.T, st *memstore.Store, tr service.Transaction, path string) (storage.ID, *Team) {
_, file, line, _ := runtime.Caller(1)
e := Get(t, st, tr, path)
p, ok := e.Value.(*Team)
diff --git a/services/store/memstore/blackbox/util.go b/services/store/memstore/blackbox/util.go
index 55d0748..cc2c921 100644
--- a/services/store/memstore/blackbox/util.go
+++ b/services/store/memstore/blackbox/util.go
@@ -24,7 +24,7 @@
var (
rootPublicID security.PublicID = security.FakePublicID("root")
- rootCtx ipc.Context = rootContext{}
+ rootCtx ipc.ServerContext = rootContext{}
nullMutation = raw.Mutation{}
)
@@ -82,7 +82,7 @@
return nil
}
-func Get(t *testing.T, st *memstore.Store, tr storage.Transaction, path string) *storage.Entry {
+func Get(t *testing.T, st *memstore.Store, tr service.Transaction, path string) *storage.Entry {
_, file, line, _ := runtime.Caller(1)
e, err := st.Bind(path).Get(rootPublicID, tr)
if err != nil {
@@ -91,7 +91,7 @@
return e
}
-func Put(t *testing.T, st *memstore.Store, tr storage.Transaction, path string, v interface{}) storage.ID {
+func Put(t *testing.T, st *memstore.Store, tr service.Transaction, path string, v interface{}) storage.ID {
_, file, line, _ := runtime.Caller(1)
stat, err := st.Bind(path).Put(rootPublicID, tr, v)
if err != nil {
@@ -107,14 +107,14 @@
return storage.ID{}
}
-func Remove(t *testing.T, st *memstore.Store, tr storage.Transaction, path string) {
+func Remove(t *testing.T, st *memstore.Store, tr service.Transaction, path string) {
_, file, line, _ := runtime.Caller(1)
if err := st.Bind(path).Remove(rootPublicID, tr); err != nil {
t.Fatalf("%s(%d): can't remove %s: %s", file, line, path, err)
}
}
-func Commit(t *testing.T, tr storage.Transaction) {
+func Commit(t *testing.T, tr service.Transaction) {
if err := tr.Commit(); err != nil {
t.Fatalf("Transaction aborted: %s", err)
}
@@ -223,7 +223,7 @@
close(s.done)
}
-func Watch(t *testing.T, w service.Watcher, ctx ipc.Context, req watch.Request) watch.WatcherWatchStream {
+func Watch(t *testing.T, w service.Watcher, ctx ipc.ServerContext, req watch.Request) watch.WatcherWatchStream {
c := make(chan watch.ChangeBatch)
done := make(chan bool)
go func() {
diff --git a/services/store/memstore/object.go b/services/store/memstore/object.go
index f16a0ab..a0ac078 100644
--- a/services/store/memstore/object.go
+++ b/services/store/memstore/object.go
@@ -34,7 +34,7 @@
}
// Exists returns true iff the object has a value in the current transaction.
-func (o *object) Exists(pid security.PublicID, trans storage.Transaction) (bool, error) {
+func (o *object) Exists(pid security.PublicID, trans service.Transaction) (bool, error) {
tr, _, err := o.store.getTransaction(trans)
if err != nil {
return false, err
@@ -45,7 +45,7 @@
}
// Get returns the value for an object.
-func (o *object) Get(pid security.PublicID, trans storage.Transaction) (*storage.Entry, error) {
+func (o *object) Get(pid security.PublicID, trans service.Transaction) (*storage.Entry, error) {
tr, _, err := o.store.getTransaction(trans)
if err != nil {
return nil, err
@@ -54,7 +54,7 @@
}
// Put updates the value for an object.
-func (o *object) Put(pid security.PublicID, trans storage.Transaction, v interface{}) (*storage.Stat, error) {
+func (o *object) Put(pid security.PublicID, trans service.Transaction, v interface{}) (*storage.Stat, error) {
tr, commit, err := o.store.getTransaction(trans)
if err != nil {
return nil, err
@@ -70,7 +70,7 @@
}
// Remove removes the value for an object.
-func (o *object) Remove(pid security.PublicID, trans storage.Transaction) error {
+func (o *object) Remove(pid security.PublicID, trans service.Transaction) error {
tr, commit, err := o.store.getTransaction(trans)
if err != nil {
return err
@@ -87,17 +87,17 @@
// SetAttr changes the attributes of the entry, such as permissions and
// replication groups. Attributes are associated with the value, not the
// path.
-func (o *object) SetAttr(pid security.PublicID, tr storage.Transaction, attrs ...storage.Attr) error {
+func (o *object) SetAttr(pid security.PublicID, tr service.Transaction, attrs ...storage.Attr) error {
panic("not implemented")
}
// Stat returns entry info.
-func (o *object) Stat(pid security.PublicID, tr storage.Transaction) (*storage.Stat, error) {
+func (o *object) Stat(pid security.PublicID, tr service.Transaction) (*storage.Stat, error) {
panic("not implemented")
}
// Query returns entries matching the given query.
-func (o *object) Query(pid security.PublicID, trans storage.Transaction, q query.Query) (service.QueryStream, error) {
+func (o *object) Query(pid security.PublicID, trans service.Transaction, q query.Query) (service.QueryStream, error) {
tr, _, err := o.store.getTransaction(trans)
if err != nil {
return nil, err
@@ -107,7 +107,7 @@
}
// Glob returns the sequence of names that match the given pattern.
-func (o *object) Glob(pid security.PublicID, trans storage.Transaction, pattern string) (service.GlobStream, error) {
+func (o *object) Glob(pid security.PublicID, trans service.Transaction, pattern string) (service.GlobStream, error) {
tr, _, err := o.store.getTransaction(trans)
if err != nil {
return nil, err
diff --git a/services/store/memstore/store.go b/services/store/memstore/store.go
index 324271f..a4397b0 100644
--- a/services/store/memstore/store.go
+++ b/services/store/memstore/store.go
@@ -150,7 +150,7 @@
// PutMutations atomically commits a stream of Mutations when the stream is
// closed. Mutations are not committed if the request is cancelled before the
// stream has been closed.
-func (st *Store) PutMutations(ctx ipc.Context, stream raw.StoreServicePutMutationsStream) error {
+func (st *Store) PutMutations(ctx ipc.ServerContext, stream raw.StoreServicePutMutationsStream) error {
tr := st.newNilTransaction()
for {
mu, err := stream.Recv()
diff --git a/services/store/memstore/transaction.go b/services/store/memstore/transaction.go
index 0ae3595..5328457 100644
--- a/services/store/memstore/transaction.go
+++ b/services/store/memstore/transaction.go
@@ -5,8 +5,7 @@
"sync"
"veyron/services/store/memstore/state"
-
- "veyron2/storage"
+ "veyron/services/store/service"
)
// Transaction is the type of transactions. Each transaction has a snapshot of
@@ -35,12 +34,12 @@
return &Transaction{store: st, snapshot: st.State.MutableSnapshot()}
}
-// getTransaction returns the *Transaction value for the storage.Transaction.
+// getTransaction returns the *Transaction value for the service.Transaction.
// Returns bool commit==true iff the transaction argument is nil, which means
// that the transaction lifetime is the duration of the operation (so the
// transaction should be committed immediately after the operation that uses it
// is performed).
-func (st *Store) getTransaction(tr storage.Transaction) (*Transaction, bool, error) {
+func (st *Store) getTransaction(tr service.Transaction) (*Transaction, bool, error) {
if tr == nil {
return st.newNilTransaction(), true, nil
}
@@ -53,7 +52,7 @@
}
// GetTransactionSnapshot returns a read-only snapshot from the transaction.
-func (st *Store) GetTransactionSnapshot(tr storage.Transaction) (state.Snapshot, error) {
+func (st *Store) GetTransactionSnapshot(tr service.Transaction) (state.Snapshot, error) {
t, _, err := st.getTransaction(tr)
if err != nil {
return nil, err
diff --git a/services/store/memstore/util_test.go b/services/store/memstore/util_test.go
index 45b492e..261356e 100644
--- a/services/store/memstore/util_test.go
+++ b/services/store/memstore/util_test.go
@@ -8,13 +8,14 @@
"time"
"veyron/services/store/raw"
+ "veyron/services/store/service"
"veyron2/ipc"
"veyron2/security"
"veyron2/storage"
)
-// cancellableContext implements ipc.Context.
+// cancellableContext implements ipc.ServerContext.
type cancellableContext struct {
cancelled chan struct{}
}
@@ -101,7 +102,7 @@
// clientStream implements raw.StorePutMutationsStream
type clientStream struct {
- ctx ipc.Context
+ ctx ipc.ServerContext
closed bool
mus chan<- raw.Mutation
err <-chan error
@@ -156,7 +157,7 @@
}
}
-func mkdir(t *testing.T, st *Store, tr storage.Transaction, path string) (storage.ID, interface{}) {
+func mkdir(t *testing.T, st *Store, tr service.Transaction, path string) (storage.ID, interface{}) {
_, file, line, _ := runtime.Caller(1)
dir := &Dir{}
stat, err := st.Bind(path).Put(rootPublicID, tr, dir)
@@ -166,7 +167,7 @@
return stat.ID, dir
}
-func get(t *testing.T, st *Store, tr storage.Transaction, path string) interface{} {
+func get(t *testing.T, st *Store, tr service.Transaction, path string) interface{} {
_, file, line, _ := runtime.Caller(1)
e, err := st.Bind(path).Get(rootPublicID, tr)
if err != nil {
@@ -175,7 +176,7 @@
return e.Value
}
-func put(t *testing.T, st *Store, tr storage.Transaction, path string, v interface{}) storage.ID {
+func put(t *testing.T, st *Store, tr service.Transaction, path string, v interface{}) storage.ID {
_, file, line, _ := runtime.Caller(1)
stat, err := st.Bind(path).Put(rootPublicID, tr, v)
if err != nil {
@@ -190,35 +191,35 @@
return storage.ID{}
}
-func remove(t *testing.T, st *Store, tr storage.Transaction, path string) {
+func remove(t *testing.T, st *Store, tr service.Transaction, path string) {
if err := st.Bind(path).Remove(rootPublicID, tr); err != nil {
_, file, line, _ := runtime.Caller(1)
t.Errorf("%s(%d): can't remove %s: %s", file, line, path, err)
}
}
-func commit(t *testing.T, tr storage.Transaction) {
+func commit(t *testing.T, tr service.Transaction) {
if err := tr.Commit(); err != nil {
_, file, line, _ := runtime.Caller(1)
t.Fatalf("%s(%d): Transaction aborted: %s", file, line, err)
}
}
-func expectExists(t *testing.T, st *Store, tr storage.Transaction, path string) {
+func expectExists(t *testing.T, st *Store, tr service.Transaction, path string) {
_, file, line, _ := runtime.Caller(1)
if ok, _ := st.Bind(path).Exists(rootPublicID, tr); !ok {
t.Errorf("%s(%d): does not exist: %s", file, line, path)
}
}
-func expectNotExists(t *testing.T, st *Store, tr storage.Transaction, path string) {
+func expectNotExists(t *testing.T, st *Store, tr service.Transaction, path string) {
if e, err := st.Bind(path).Get(rootPublicID, tr); err == nil {
_, file, line, _ := runtime.Caller(1)
t.Errorf("%s(%d): should not exist: %s: got %+v", file, line, path, e.Value)
}
}
-func expectValue(t *testing.T, st *Store, tr storage.Transaction, path string, v interface{}) {
+func expectValue(t *testing.T, st *Store, tr service.Transaction, path string, v interface{}) {
_, file, line, _ := runtime.Caller(1)
e, err := st.Bind(path).Get(rootPublicID, tr)
if err != nil {
diff --git a/services/store/memstore/watch/test_util.go b/services/store/memstore/watch/test_util.go
index 9a543bc..5f10875 100644
--- a/services/store/memstore/watch/test_util.go
+++ b/services/store/memstore/watch/test_util.go
@@ -21,7 +21,7 @@
var (
rootPublicID security.PublicID = security.FakePublicID("root")
- rootCtx ipc.Context = &rootContext{}
+ rootCtx ipc.ServerContext = &rootContext{}
)
type rootContext struct{}
@@ -105,7 +105,7 @@
return ctx.cancelled
}
-func get(t *testing.T, st *memstore.Store, tr storage.Transaction, path string) interface{} {
+func get(t *testing.T, st *memstore.Store, tr service.Transaction, path string) interface{} {
_, file, line, _ := runtime.Caller(1)
e, err := st.Bind(path).Get(rootPublicID, tr)
if err != nil {
@@ -114,7 +114,7 @@
return e.Value
}
-func put(t *testing.T, st *memstore.Store, tr storage.Transaction, path string, v interface{}) storage.ID {
+func put(t *testing.T, st *memstore.Store, tr service.Transaction, path string, v interface{}) storage.ID {
_, file, line, _ := runtime.Caller(1)
stat, err := st.Bind(path).Put(rootPublicID, tr, v)
if err != nil {
@@ -129,14 +129,14 @@
return storage.ID{}
}
-func remove(t *testing.T, st *memstore.Store, tr storage.Transaction, path string) {
+func remove(t *testing.T, st *memstore.Store, tr service.Transaction, path string) {
if err := st.Bind(path).Remove(rootPublicID, tr); err != nil {
_, file, line, _ := runtime.Caller(1)
t.Fatalf("%s(%d): can't remove %s: %s", file, line, path, err)
}
}
-func commit(t *testing.T, tr storage.Transaction) {
+func commit(t *testing.T, tr service.Transaction) {
if err := tr.Commit(); err != nil {
_, file, line, _ := runtime.Caller(1)
t.Fatalf("%s(%d): Transaction aborted: %s", file, line, err)
@@ -222,7 +222,7 @@
// doWatch executes a watch request and returns a new watchResult.
// Change events may be received on the channel "changes".
// Once "changes" is closed, any error that occurred is stored to "err".
-func doWatch(w service.Watcher, ctx ipc.Context, req watch.Request) *watchResult {
+func doWatch(w service.Watcher, ctx ipc.ServerContext, req watch.Request) *watchResult {
wr := &watchResult{changes: make(chan watch.Change)}
go func() {
defer close(wr.changes)
diff --git a/services/store/memstore/watch/watcher.go b/services/store/memstore/watch/watcher.go
index 0d53857..ed76358 100644
--- a/services/store/memstore/watch/watcher.go
+++ b/services/store/memstore/watch/watcher.go
@@ -43,7 +43,7 @@
// sending changes to the specified watch stream. If the call is cancelled or
// otherwise closed early, Watch will terminate and return an error.
// Watch implements the service.Watcher interface.
-func (w *watcher) Watch(ctx ipc.Context, req watch.Request, stream watch.WatcherServiceWatchStream) error {
+func (w *watcher) Watch(ctx ipc.ServerContext, req watch.Request, stream watch.WatcherServiceWatchStream) error {
processor, err := w.findProcessor(ctx.RemoteID(), req)
if err != nil {
return err
diff --git a/services/store/raw/service.vdl.go b/services/store/raw/service.vdl.go
index 6f22c54..a031a4d 100644
--- a/services/store/raw/service.vdl.go
+++ b/services/store/raw/service.vdl.go
@@ -63,7 +63,7 @@
// PutMutations atomically commits a stream of Mutations when the stream is
// closed. Mutations are not committed if the request is cancelled before
// the stream has been closed.
- PutMutations(opts ..._gen_ipc.ClientCallOpt) (reply StorePutMutationsStream, err error)
+ PutMutations(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply StorePutMutationsStream, err error)
}
type Store interface {
_gen_ipc.UniversalServiceMethods
@@ -79,7 +79,7 @@
// PutMutations atomically commits a stream of Mutations when the stream is
// closed. Mutations are not committed if the request is cancelled before
// the stream has been closed.
- PutMutations(context _gen_ipc.Context, stream StoreServicePutMutationsStream) (err error)
+ PutMutations(context _gen_ipc.ServerContext, stream StoreServicePutMutationsStream) (err error)
}
// StorePutMutationsStream is the interface for streaming responses of the method
@@ -106,7 +106,7 @@
// Implementation of the StorePutMutationsStream interface that is not exported.
type implStorePutMutationsStream struct {
- clientCall _gen_ipc.ClientCall
+ clientCall _gen_ipc.Call
}
func (c *implStorePutMutationsStream) Send(item Mutation) error {
@@ -194,18 +194,18 @@
name string
}
-func (__gen_c *clientStubStore) PutMutations(opts ..._gen_ipc.ClientCallOpt) (reply StorePutMutationsStream, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "PutMutations", nil, opts...); err != nil {
+func (__gen_c *clientStubStore) PutMutations(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply StorePutMutationsStream, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "PutMutations", nil, opts...); err != nil {
return
}
reply = &implStorePutMutationsStream{clientCall: call}
return
}
-func (__gen_c *clientStubStore) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubStore) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -214,9 +214,9 @@
return
}
-func (__gen_c *clientStubStore) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubStore) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -225,9 +225,9 @@
return
}
-func (__gen_c *clientStubStore) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubStore) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
diff --git a/services/store/server/object.go b/services/store/server/object.go
index 741954b..377a57f 100644
--- a/services/store/server/object.go
+++ b/services/store/server/object.go
@@ -86,7 +86,7 @@
}
// Exists returns true iff the Entry has a value.
-func (o *object) Exists(ctx ipc.Context, tid store.TransactionID) (bool, error) {
+func (o *object) Exists(ctx ipc.ServerContext, tid store.TransactionID) (bool, error) {
t, ok := o.server.findTransaction(tid)
if !ok {
return false, errTransactionDoesNotExist
@@ -97,7 +97,7 @@
// Get returns the value for the Object. The value returned is from the
// most recent mutation of the entry in the Transaction, or from the
// Transaction's snapshot if there is no mutation.
-func (o *object) Get(ctx ipc.Context, tid store.TransactionID) (store.Entry, error) {
+func (o *object) Get(ctx ipc.ServerContext, tid store.TransactionID) (store.Entry, error) {
t, ok := o.server.findTransaction(tid)
if !ok {
return nullEntry, errTransactionDoesNotExist
@@ -110,7 +110,7 @@
}
// Put modifies the value of the Object.
-func (o *object) Put(ctx ipc.Context, tid store.TransactionID, val vdl.Any) (store.Stat, error) {
+func (o *object) Put(ctx ipc.ServerContext, tid store.TransactionID, val vdl.Any) (store.Stat, error) {
t, ok := o.server.findTransaction(tid)
if !ok {
return nullStat, errTransactionDoesNotExist
@@ -123,7 +123,7 @@
}
// Remove removes the Object.
-func (o *object) Remove(ctx ipc.Context, tid store.TransactionID) error {
+func (o *object) Remove(ctx ipc.ServerContext, tid store.TransactionID) error {
t, ok := o.server.findTransaction(tid)
if !ok {
return errTransactionDoesNotExist
@@ -134,7 +134,7 @@
// SetAttr changes the attributes of the entry, such as permissions and
// replication groups. Attributes are associated with the value, not the
// path.
-func (o *object) SetAttr(ctx ipc.Context, tid store.TransactionID, attrs []vdl.Any) error {
+func (o *object) SetAttr(ctx ipc.ServerContext, tid store.TransactionID, attrs []vdl.Any) error {
t, ok := o.server.findTransaction(tid)
if !ok {
return errTransactionDoesNotExist
@@ -147,7 +147,7 @@
}
// Stat returns entry info.
-func (o *object) Stat(ctx ipc.Context, tid store.TransactionID) (store.Stat, error) {
+func (o *object) Stat(ctx ipc.ServerContext, tid store.TransactionID) (store.Stat, error) {
t, ok := o.server.findTransaction(tid)
if !ok {
return nullStat, errTransactionDoesNotExist
@@ -160,7 +160,7 @@
}
// Query returns a sequence of objects that match the given query.
-func (o *object) Query(ctx ipc.Context, tid store.TransactionID, q query.Query, stream store.ObjectServiceQueryStream) error {
+func (o *object) Query(ctx ipc.ServerContext, tid store.TransactionID, q query.Query, stream store.ObjectServiceQueryStream) error {
t, ok := o.server.findTransaction(tid)
if !ok {
return errTransactionDoesNotExist
@@ -189,12 +189,12 @@
}
// Glob streams a series of names that match the given pattern.
-func (o *object) Glob(ctx ipc.Context, pattern string, stream mounttable.GlobableServiceGlobStream) error {
+func (o *object) Glob(ctx ipc.ServerContext, pattern string, stream mounttable.GlobableServiceGlobStream) error {
return o.GlobT(ctx, nullTransactionID, pattern, &globStreamAdapter{stream})
}
// Glob streams a series of names that match the given pattern.
-func (o *object) GlobT(ctx ipc.Context, tid store.TransactionID, pattern string, stream store.ObjectServiceGlobTStream) error {
+func (o *object) GlobT(ctx ipc.ServerContext, tid store.TransactionID, pattern string, stream store.ObjectServiceGlobTStream) error {
t, ok := o.server.findTransaction(tid)
if !ok {
return errTransactionDoesNotExist
@@ -215,6 +215,6 @@
}
// Watch returns a stream of changes.
-func (o *object) Watch(ctx ipc.Context, req watch.Request, stream watch.WatcherServiceWatchStream) error {
+func (o *object) Watch(ctx ipc.ServerContext, req watch.Request, stream watch.WatcherServiceWatchStream) error {
panic("not implemented")
}
diff --git a/services/store/server/server.go b/services/store/server/server.go
index 3a02f25..504d560 100644
--- a/services/store/server/server.go
+++ b/services/store/server/server.go
@@ -15,7 +15,6 @@
"veyron2/security"
"veyron2/services/store"
"veyron2/services/watch"
- "veyron2/storage"
"veyron2/vdl"
)
@@ -59,7 +58,7 @@
}
type transaction struct {
- trans storage.Transaction
+ trans service.Transaction
expires time.Time
}
@@ -112,13 +111,13 @@
}
// findTransaction returns the transaction for the TransactionID.
-func (s *Server) findTransaction(id store.TransactionID) (storage.Transaction, bool) {
+func (s *Server) findTransaction(id store.TransactionID) (service.Transaction, bool) {
s.mutex.RLock()
defer s.mutex.RUnlock()
return s.findTransactionLocked(id)
}
-func (s *Server) findTransactionLocked(id store.TransactionID) (storage.Transaction, bool) {
+func (s *Server) findTransactionLocked(id store.TransactionID) (service.Transaction, bool) {
if id == nullTransactionID {
return nil, true
}
@@ -152,7 +151,7 @@
}
// CreateTransaction creates a transaction.
-func (s *Server) CreateTransaction(_ ipc.Context, id store.TransactionID, opts []vdl.Any) error {
+func (s *Server) CreateTransaction(_ ipc.ServerContext, id store.TransactionID, opts []vdl.Any) error {
s.mutex.Lock()
defer s.mutex.Unlock()
@@ -171,7 +170,7 @@
// Commit commits the changes in the transaction to the store. The
// operation is atomic, so all mutations are performed, or none. Returns an
// error if the transaction aborted.
-func (s *Server) Commit(_ ipc.Context, id store.TransactionID) error {
+func (s *Server) Commit(_ ipc.ServerContext, id store.TransactionID) error {
s.mutex.Lock()
defer s.mutex.Unlock()
@@ -185,7 +184,7 @@
}
// Abort discards a transaction.
-func (s *Server) Abort(_ ipc.Context, id store.TransactionID) error {
+func (s *Server) Abort(_ ipc.ServerContext, id store.TransactionID) error {
s.mutex.Lock()
defer s.mutex.Unlock()
@@ -199,20 +198,20 @@
}
// Watch returns a stream of changes.
-func (s *Server) Watch(ctx ipc.Context, req watch.Request, stream watch.WatcherServiceWatchStream) error {
+func (s *Server) Watch(ctx ipc.ServerContext, req watch.Request, stream watch.WatcherServiceWatchStream) error {
return s.watcher.Watch(ctx, req, stream)
}
// PutMutations atomically commits a stream of Mutations when the stream is
// closed. Mutations are not committed if the request is cancelled before the
// stream has been closed.
-func (s *Server) PutMutations(ctx ipc.Context, stream raw.StoreServicePutMutationsStream) error {
+func (s *Server) PutMutations(ctx ipc.ServerContext, stream raw.StoreServicePutMutationsStream) error {
return s.store.PutMutations(ctx, stream)
}
// ReadConflicts returns the stream of conflicts to store values. A
// conflict occurs when there is a concurrent modification to a value.
-func (s *Server) ReadConflicts(_ ipc.Context, stream store.StoreServiceReadConflictsStream) error {
+func (s *Server) ReadConflicts(_ ipc.ServerContext, stream store.StoreServiceReadConflictsStream) error {
panic("not implemented")
}
diff --git a/services/store/server/server_test.go b/services/store/server/server_test.go
index 921dcdc..5e56f73 100644
--- a/services/store/server/server_test.go
+++ b/services/store/server/server_test.go
@@ -25,7 +25,7 @@
nextTransactionID store.TransactionID = 1
- rootCtx ipc.Context = &rootContext{}
+ rootCtx ipc.ServerContext = &rootContext{}
)
type rootContext struct{}
@@ -137,7 +137,7 @@
// doWatch executes a watch request and returns a new watchResult.
// Change events may be received on the channel "changes".
// Once "changes" is closed, any error that occurred is stored to "err".
-func doWatch(s *Server, ctx ipc.Context, req watch.Request) *watchResult {
+func doWatch(s *Server, ctx ipc.ServerContext, req watch.Request) *watchResult {
wr := &watchResult{changes: make(chan watch.Change)}
go func() {
defer close(wr.changes)
diff --git a/services/store/service/service.go b/services/store/service/service.go
index a37a37b..fa23b05 100644
--- a/services/store/service/service.go
+++ b/services/store/service/service.go
@@ -11,39 +11,57 @@
"veyron2/storage"
)
+// Transaction is like storage.Transaction, but doesn't include extra client-side
+// parameters.
+type Transaction interface {
+ // Commit commits the changes (the Set and Delete operations) in the
+ // transaction to the store. The operation is atomic, so all Set/Delete
+ // operations are performed, or none. Returns an error if the transaction
+ // aborted.
+ //
+ // The Transaction should be discarded once Commit is called. It can no
+ // longer be used.
+ Commit() error
+
+ // Abort discards a transaction. This is an optimization; transactions
+ // eventually time out and get discarded. However, live transactions
+ // consume resources, so it is good practice to clean up.
+ Abort() error
+}
+
// Object is like storage.Object, but it include extra server-side parameters.
// In perticular, each method takes the identity of the client.
type Object interface {
// Exists returns true iff the Entry has a value.
- Exists(clientID security.PublicID, t storage.Transaction) (bool, error)
+ Exists(clientID security.PublicID, t Transaction) (bool, error)
// Get returns the value for the Object. The value returned is from the
- // most recent mutation of the entry in the storage.Transaction, or from the
- // storage.Transaction's snapshot if there is no mutation.
- Get(clientID security.PublicID, t storage.Transaction) (*storage.Entry, error)
+ // most recent mutation of the entry in the Transaction, or from the
+ // Transaction's snapshot if there is no mutation.
+ Get(clientID security.PublicID, t Transaction) (*storage.Entry, error)
// Put adds or modifies the Object. If there is no current value, the
// object is created with default attributes. It is legal to update a
// subfield of a value. Returns the updated *Stat of the store value. If
// putting a subfield, the *Stat is for the enclosing store value.
- Put(clientID security.PublicID, t storage.Transaction, v interface{}) (*storage.Stat, error)
+ Put(clientID security.PublicID, t Transaction, v interface{}) (*storage.Stat, error)
// Remove removes the Object.
- Remove(clientID security.PublicID, t storage.Transaction) error
+ Remove(clientID security.PublicID, t Transaction) error
// SetAttr changes the attributes of the entry, such as permissions and
// replication groups. Attributes are associated with the value, not the
// path.
- SetAttr(clientID security.PublicID, t storage.Transaction, attrs ...storage.Attr) error
+ SetAttr(clientID security.PublicID, t Transaction, attrs ...storage.Attr) error
// Stat returns entry info.
- Stat(clientID security.PublicID, t storage.Transaction) (*storage.Stat, error)
+ Stat(clientID security.PublicID, t Transaction) (*storage.Stat, error)
// Query returns entries matching the given query.
- Query(clientID security.PublicID, t storage.Transaction, q query.Query) (QueryStream, error)
+ Query(clientID security.PublicID, t Transaction, q query.Query) (QueryStream, error)
// Glob returns the sequence of names that match the given pattern.
- Glob(clientID security.PublicID, t storage.Transaction, pattern string) (GlobStream, error)
+ Glob(clientID security.PublicID, t Transaction, pattern string) (GlobStream, error)
}
// Store is the server-side interface to the storage system. It is expected to
@@ -56,7 +74,7 @@
// PutMutations atomically commits a stream of Mutations when the stream is
// closed. Mutations are not committed if the request is cancelled before
// the stream has been closed.
- PutMutations(ctx ipc.Context, stream raw.StoreServicePutMutationsStream) error
+ PutMutations(ctx ipc.ServerContext, stream raw.StoreServicePutMutationsStream) error
// SetConflictResolver specifies a function to perform conflict resolution.
// The <ty> represents the IDL name for the type.
@@ -113,7 +131,7 @@
// Watcher is the interface for watching store updates that match a query.
type Watcher interface {
// Watch returns a stream of changes that match a query.
- Watch(ctx ipc.Context, req watch.Request, stream watch.WatcherServiceWatchStream) error
+ Watch(ctx ipc.ServerContext, req watch.Request, stream watch.WatcherServiceWatchStream) error
// Close closes the Watcher, blocking until all Watch invocations complete.
Close() error
diff --git a/services/wspr/wsprd/lib/signature_manager.go b/services/wspr/wsprd/lib/signature_manager.go
index 934cd4c..034e743 100644
--- a/services/wspr/wsprd/lib/signature_manager.go
+++ b/services/wspr/wsprd/lib/signature_manager.go
@@ -40,7 +40,7 @@
// signature uses the given client to fetch the signature for the given service name.
// It locks until it fetches the service signature from the remote server, if not a cache hit.
-func (sm *signatureManager) signature(name string, client ipc.Client) (*ipc.ServiceSignature, error) {
+func (sm *signatureManager) signature(ctx ipc.Context, name string, client ipc.Client) (*ipc.ServiceSignature, error) {
sm.Lock()
defer sm.Unlock()
@@ -50,7 +50,7 @@
}
// cache expired or not found, fetch it from the remote server
- signatureCall, err := client.StartCall(name, signatureMethodName, []interface{}{})
+ signatureCall, err := client.StartCall(ctx, name, signatureMethodName, []interface{}{})
if err != nil {
return nil, err
}
diff --git a/services/wspr/wsprd/lib/signature_manager_test.go b/services/wspr/wsprd/lib/signature_manager_test.go
index db9a5a4..0271fbd 100644
--- a/services/wspr/wsprd/lib/signature_manager_test.go
+++ b/services/wspr/wsprd/lib/signature_manager_test.go
@@ -6,6 +6,7 @@
mocks_ipc "veyron/runtimes/google/testing/mocks/ipc"
"veyron2/ipc"
+ "veyron2/rt"
"veyron2/vdl"
"veyron2/wiretype"
)
@@ -75,7 +76,7 @@
func TestFetching(t *testing.T) {
sm := newSignatureManager()
- got, err := sm.signature(name, client())
+ got, err := sm.signature(rt.R().NewContext(), name, client())
if err != nil {
t.Errorf(`Did not expect an error but got %v`, err)
return
@@ -86,7 +87,7 @@
func TestThatCachedAfterFetching(t *testing.T) {
sm := newSignatureManager()
- sig, _ := sm.signature(name, client())
+ sig, _ := sm.signature(rt.R().NewContext(), name, client())
cache, ok := sm.cache[name]
if !ok {
t.Errorf(`Signature manager did not cache the results`)
@@ -100,8 +101,8 @@
sm := newSignatureManager()
// call twice
- sm.signature(name, client)
- sm.signature(name, client)
+ sm.signature(rt.R().NewContext(), name, client)
+ sm.signature(rt.R().NewContext(), name, client)
// expect number of calls to Signature method of client to still be 1 since cache
// should have been used despite the second call
@@ -113,14 +114,14 @@
func TestThatLastAccessedGetUpdated(t *testing.T) {
client := client()
sm := newSignatureManager()
- sm.signature(name, client)
+ sm.signature(rt.R().NewContext(), name, client)
// make last accessed be in the past to account for the fact that
// two consecutive calls to time.Now() can return identical values.
sm.cache[name].lastAccessed = sm.cache[name].lastAccessed.Add(-ttl / 2)
prevAccess := sm.cache[name].lastAccessed
// access again
- sm.signature(name, client)
+ sm.signature(rt.R().NewContext(), name, client)
newAccess := sm.cache[name].lastAccessed
if !newAccess.After(prevAccess) {
@@ -131,13 +132,13 @@
func TestThatTTLExpires(t *testing.T) {
client := client()
sm := newSignatureManager()
- sm.signature(name, client)
+ sm.signature(rt.R().NewContext(), name, client)
// make last accessed go over the ttl
sm.cache[name].lastAccessed = sm.cache[name].lastAccessed.Add(-2 * ttl)
// make a second call
- sm.signature(name, client)
+ sm.signature(rt.R().NewContext(), name, client)
// expect number of calls to Signature method of client to be 2 since cache should have expired
if client.TimesCalled(signatureMethodName) != 2 {
diff --git a/services/wspr/wsprd/lib/stream.go b/services/wspr/wsprd/lib/stream.go
index f31ca6e..062115b 100644
--- a/services/wspr/wsprd/lib/stream.go
+++ b/services/wspr/wsprd/lib/stream.go
@@ -62,7 +62,7 @@
}
// If the stream is on the client side, then also close the stream.
- if call, ok := stream.(ipc.ClientCall); ok {
+ if call, ok := stream.(ipc.Call); ok {
call.CloseSend()
}
}
diff --git a/services/wspr/wsprd/lib/wspr.go b/services/wspr/wsprd/lib/wspr.go
index 8c7b297..453ed97 100644
--- a/services/wspr/wsprd/lib/wspr.go
+++ b/services/wspr/wsprd/lib/wspr.go
@@ -254,7 +254,7 @@
}
// finishCall waits for the call to finish and write out the response to w.
-func finishCall(w clientWriter, clientCall ipc.ClientCall, msg *veyronRPC) {
+func finishCall(w clientWriter, clientCall ipc.Call, msg *veyronRPC) {
if msg.IsStreaming {
for {
var item interface{}
@@ -345,13 +345,13 @@
return client, nil
}
-func (ctx WSPR) startVeyronRequest(w clientWriter, msg *veyronRPC) (ipc.ClientCall, error) {
+func (ctx WSPR) startVeyronRequest(w clientWriter, msg *veyronRPC) (ipc.Call, error) {
// Issue request to the endpoint.
client, err := ctx.newClient(msg.PrivateId)
if err != nil {
return nil, err
}
- clientCall, err := client.StartCall(msg.Name, uppercaseFirstCharacter(msg.Method), msg.InArgs)
+ clientCall, err := client.StartCall(ctx.rt.TODOContext(), msg.Name, uppercaseFirstCharacter(msg.Method), msg.InArgs)
if err != nil {
return nil, fmt.Errorf("error starting call: %v", err)
@@ -463,7 +463,7 @@
wsp.Lock()
defer wsp.Unlock()
for _, stream := range wsp.outstandingStreams {
- if call, ok := stream.(ipc.ClientCall); ok {
+ if call, ok := stream.(ipc.Call); ok {
call.Cancel()
}
}
@@ -942,7 +942,8 @@
}
// Fetch and adapt signature from the SignatureManager
- sig, err := wsp.signatureManager.signature(name, client)
+ ctx := wsp.ctx.rt.TODOContext()
+ sig, err := wsp.signatureManager.signature(ctx, name, client)
if err != nil {
return nil, verror.Internalf("error getting service signature for %s: %v", name, err)
}
diff --git a/services/wspr/wsprd/lib/wspr_test.go b/services/wspr/wsprd/lib/wspr_test.go
index 26ffc7b..db2620d 100644
--- a/services/wspr/wsprd/lib/wspr_test.go
+++ b/services/wspr/wsprd/lib/wspr_test.go
@@ -500,7 +500,7 @@
t.Errorf("unable to create client: %v", err)
}
- call, err := client.StartCall("/"+msg+"/adder", test.method, test.inArgs)
+ call, err := client.StartCall(wspr.rt.NewContext(), "/"+msg+"/adder", test.method, test.inArgs)
if err != nil {
t.Errorf("failed to start call: %v", err)
}
diff --git a/tools/application/impl/impl.go b/tools/application/impl/impl.go
index 61c4a92..b6248b0 100644
--- a/tools/application/impl/impl.go
+++ b/tools/application/impl/impl.go
@@ -13,11 +13,12 @@
"veyron/lib/cmdline"
iapp "veyron/services/mgmt/application"
+ "veyron2/rt"
"veyron2/services/mgmt/application"
)
func getEnvelopeJSON(app iapp.Repository, profiles string) ([]byte, error) {
- env, err := app.Match(strings.Split(profiles, ","))
+ env, err := app.Match(rt.R().NewContext(), strings.Split(profiles, ","))
if err != nil {
env = application.Envelope{}
}
@@ -33,7 +34,7 @@
if err := json.Unmarshal(j, &env); err != nil {
return fmt.Errorf("json: %v", err)
}
- if err := app.Put(strings.Split(profiles, ","), env); err != nil {
+ if err := app.Put(rt.R().NewContext(), strings.Split(profiles, ","), env); err != nil {
return err
}
return nil
@@ -125,7 +126,7 @@
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
- if err = app.Remove(args[1]); err != nil {
+ if err = app.Remove(rt.R().NewContext(), args[1]); err != nil {
return err
}
fmt.Fprintln(cmd.Stdout(), "Application envelope removed successfully.")
diff --git a/tools/application/impl/impl_test.go b/tools/application/impl/impl_test.go
index 37df8e2..0029325 100644
--- a/tools/application/impl/impl_test.go
+++ b/tools/application/impl/impl_test.go
@@ -44,17 +44,17 @@
suffix string
}
-func (s *server) Match(_ ipc.Context, profiles []string) (application.Envelope, error) {
+func (s *server) Match(_ ipc.ServerContext, profiles []string) (application.Envelope, error) {
vlog.VI(2).Infof("%v.Match(%v) was called", s.suffix, profiles)
return envelope, nil
}
-func (s *server) Put(_ ipc.Context, profiles []string, env application.Envelope) error {
+func (s *server) Put(_ ipc.ServerContext, profiles []string, env application.Envelope) error {
vlog.VI(2).Infof("%v.Put(%v, %v) was called", s.suffix, profiles, env)
return nil
}
-func (s *server) Remove(_ ipc.Context, profile string) error {
+func (s *server) Remove(_ ipc.ServerContext, profile string) error {
vlog.VI(2).Infof("%v.Remove(%v) was called", s.suffix, profile)
return nil
}
diff --git a/tools/content/impl/impl.go b/tools/content/impl/impl.go
index 0b042b0..ef412d5 100644
--- a/tools/content/impl/impl.go
+++ b/tools/content/impl/impl.go
@@ -7,6 +7,7 @@
"veyron/lib/cmdline"
+ "veyron2/rt"
"veyron2/services/mgmt/content"
)
@@ -27,7 +28,7 @@
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
- if err = c.Delete(); err != nil {
+ if err = c.Delete(rt.R().NewContext()); err != nil {
return err
}
fmt.Fprintf(cmd.Stdout(), "Content deleted successfully\n")
@@ -65,7 +66,7 @@
return fmt.Errorf("bind error: %v", err)
}
- stream, err := c.Download()
+ stream, err := c.Download(rt.R().NewContext())
if err != nil {
return err
}
@@ -123,7 +124,7 @@
return fmt.Errorf("bind error: %v", err)
}
- stream, err := c.Upload()
+ stream, err := c.Upload(rt.R().NewContext())
if err != nil {
return err
}
diff --git a/tools/content/impl/impl_test.go b/tools/content/impl/impl_test.go
index e61e550..3bc79a8 100644
--- a/tools/content/impl/impl_test.go
+++ b/tools/content/impl/impl_test.go
@@ -24,7 +24,7 @@
suffix string
}
-func (s *server) Delete(ipc.Context) error {
+func (s *server) Delete(ipc.ServerContext) error {
vlog.VI(2).Infof("Delete() was called. suffix=%v", s.suffix)
if s.suffix != "exists" {
return fmt.Errorf("content doesn't exist: %v", s.suffix)
@@ -32,14 +32,14 @@
return nil
}
-func (s *server) Download(_ ipc.Context, stream content.ContentServiceDownloadStream) error {
+func (s *server) Download(_ ipc.ServerContext, stream content.ContentServiceDownloadStream) error {
vlog.VI(2).Infof("Download() was called. suffix=%v", s.suffix)
stream.Send([]byte("Hello"))
stream.Send([]byte("World"))
return nil
}
-func (s *server) Upload(_ ipc.Context, stream content.ContentServiceUploadStream) (string, error) {
+func (s *server) Upload(_ ipc.ServerContext, stream content.ContentServiceUploadStream) (string, error) {
vlog.VI(2).Infof("Upload() was called. suffix=%v", s.suffix)
for {
if _, err := stream.Recv(); err != nil {
diff --git a/tools/mounttable/impl/impl.go b/tools/mounttable/impl/impl.go
index d9f4886..bc250a8 100644
--- a/tools/mounttable/impl/impl.go
+++ b/tools/mounttable/impl/impl.go
@@ -44,7 +44,7 @@
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
- stream, err := c.Glob(args[1])
+ stream, err := c.Glob(rt.R().NewContext(), args[1])
if err != nil {
return err
}
@@ -95,7 +95,7 @@
if err != nil {
return fmt.Errorf("TTL parse error: %v", err)
}
- err = c.Mount(args[1], uint32(ttl.Seconds()))
+ err = c.Mount(rt.R().NewContext(), args[1], uint32(ttl.Seconds()))
if err != nil {
return err
}
@@ -124,7 +124,7 @@
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
- err = c.Unmount(args[1])
+ err = c.Unmount(rt.R().NewContext(), args[1])
if err != nil {
return err
}
@@ -152,7 +152,7 @@
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
- servers, suffix, err := c.ResolveStep()
+ servers, suffix, err := c.ResolveStep(rt.R().NewContext())
if err != nil {
return err
}
diff --git a/tools/mounttable/impl/impl_test.go b/tools/mounttable/impl/impl_test.go
index 51a37ce..4af1d5f 100644
--- a/tools/mounttable/impl/impl_test.go
+++ b/tools/mounttable/impl/impl_test.go
@@ -20,24 +20,24 @@
suffix string
}
-func (s *server) Glob(_ ipc.Context, pattern string, stream mounttable.GlobableServiceGlobStream) error {
+func (s *server) Glob(_ ipc.ServerContext, pattern string, stream mounttable.GlobableServiceGlobStream) error {
vlog.VI(2).Infof("Glob() was called. suffix=%v pattern=%q", s.suffix, pattern)
stream.Send(mounttable.MountEntry{"name1", []mounttable.MountedServer{{"server1", 123}}})
stream.Send(mounttable.MountEntry{"name2", []mounttable.MountedServer{{"server2", 456}, {"server3", 789}}})
return nil
}
-func (s *server) Mount(_ ipc.Context, server string, ttl uint32) error {
+func (s *server) Mount(_ ipc.ServerContext, server string, ttl uint32) error {
vlog.VI(2).Infof("Mount() was called. suffix=%v server=%q ttl=%d", s.suffix, server, ttl)
return nil
}
-func (s *server) Unmount(_ ipc.Context, server string) error {
+func (s *server) Unmount(_ ipc.ServerContext, server string) error {
vlog.VI(2).Infof("Unmount() was called. suffix=%v server=%q", s.suffix, server)
return nil
}
-func (s *server) ResolveStep(ipc.Context) (servers []mounttable.MountedServer, suffix string, err error) {
+func (s *server) ResolveStep(ipc.ServerContext) (servers []mounttable.MountedServer, suffix string, err error) {
vlog.VI(2).Infof("ResolveStep() was called. suffix=%v", s.suffix)
servers = []mounttable.MountedServer{{"server1", 123}}
suffix = s.suffix
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)
diff --git a/tools/proximity/impl/impl.go b/tools/proximity/impl/impl.go
index cc2130b..a7e6ed6 100644
--- a/tools/proximity/impl/impl.go
+++ b/tools/proximity/impl/impl.go
@@ -5,6 +5,7 @@
"veyron/lib/cmdline"
+ "veyron2/rt"
"veyron2/services/proximity"
)
@@ -28,7 +29,7 @@
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
- if err = p.RegisterName(args[1]); err != nil {
+ if err = p.RegisterName(rt.R().TODOContext(), args[1]); err != nil {
return err
}
fmt.Fprintf(cmd.Stdout(), "Name registered successfully\n")
@@ -55,7 +56,7 @@
if err != nil {
return fmt.Errorf("bind error: %v", err)
}
- if err = p.UnregisterName(args[1]); err != nil {
+ if err = p.UnregisterName(rt.R().TODOContext(), args[1]); err != nil {
return err
}
fmt.Fprintf(cmd.Stdout(), "Name unregistered successfully\n")
@@ -81,7 +82,7 @@
return fmt.Errorf("bind error: %v", err)
}
- devices, err := p.NearbyDevices()
+ devices, err := p.NearbyDevices(rt.R().TODOContext())
if err != nil {
return err
}
diff --git a/tools/proximity/impl/impl_test.go b/tools/proximity/impl/impl_test.go
index afeaded..d22fbb3 100644
--- a/tools/proximity/impl/impl_test.go
+++ b/tools/proximity/impl/impl_test.go
@@ -19,17 +19,17 @@
type server struct {
}
-func (s *server) RegisterName(_ ipc.Context, name string) error {
+func (s *server) RegisterName(_ ipc.ServerContext, name string) error {
vlog.VI(2).Infof("RegisterName(%q) was called", name)
return nil
}
-func (s *server) UnregisterName(_ ipc.Context, name string) error {
+func (s *server) UnregisterName(_ ipc.ServerContext, name string) error {
vlog.VI(2).Infof("UnregisterName(%q) was called", name)
return nil
}
-func (s *server) NearbyDevices(_ ipc.Context) ([]proximity.Device, error) {
+func (s *server) NearbyDevices(_ ipc.ServerContext) ([]proximity.Device, error) {
vlog.VI(2).Info("NearbyDevices() was called")
devices := []proximity.Device{
{MAC: "xx:xx:xx:xx:xx:xx", Names: []string{"name1", "name2"}, Distance: "1m"},
diff --git a/tools/vrpc/impl/impl.go b/tools/vrpc/impl/impl.go
index 2547d20..8ace3da 100644
--- a/tools/vrpc/impl/impl.go
+++ b/tools/vrpc/impl/impl.go
@@ -59,7 +59,8 @@
}
defer client.Close()
- signature, err := getSignature(cmd, args[0], client)
+ ctx := runtime.NewContext()
+ signature, err := getSignature(ctx, cmd, args[0], client)
if err != nil {
return err
}
@@ -97,7 +98,8 @@
}
defer client.Close()
- signature, err := getSignature(cmd, server, client)
+ ctx := runtime.NewContext()
+ signature, err := getSignature(ctx, cmd, server, client)
if err != nil {
return fmt.Errorf("invoke: failed to get signature for %v: %v", server, err)
}
@@ -143,7 +145,7 @@
}
// Initiate the method invocation.
- call, err := client.StartCall(server, method, inputs)
+ call, err := client.StartCall(ctx, server, method, inputs)
if err != nil {
return fmt.Errorf("client.StartCall(%s, %q, %v) failed with %v", server, method, inputs, err)
}
@@ -207,8 +209,8 @@
return client, nil
}
-func getSignature(cmd *cmdline.Command, server string, client ipc.Client) (ipc.ServiceSignature, error) {
- call, err := client.StartCall(server, "Signature", nil)
+func getSignature(ctx ipc.Context, cmd *cmdline.Command, server string, client ipc.Client) (ipc.ServiceSignature, error) {
+ call, err := client.StartCall(ctx, server, "Signature", nil)
if err != nil {
return ipc.ServiceSignature{}, fmt.Errorf("client.StartCall(%s, Signature, nil) failed with %v", server, err)
}
diff --git a/tools/vrpc/impl/impl_test.go b/tools/vrpc/impl/impl_test.go
index fdfda7e..f2dcea8 100644
--- a/tools/vrpc/impl/impl_test.go
+++ b/tools/vrpc/impl/impl_test.go
@@ -21,102 +21,102 @@
// TypeTester interface implementation
-func (*server) Bool(call ipc.Context, i1 bool) (bool, error) {
+func (*server) Bool(call ipc.ServerContext, i1 bool) (bool, error) {
vlog.VI(2).Info("Bool(%v) was called.", i1)
return i1, nil
}
-func (*server) Float32(call ipc.Context, i1 float32) (float32, error) {
+func (*server) Float32(call ipc.ServerContext, i1 float32) (float32, error) {
vlog.VI(2).Info("Float32(%u) was called.", i1)
return i1, nil
}
-func (*server) Float64(call ipc.Context, i1 float64) (float64, error) {
+func (*server) Float64(call ipc.ServerContext, i1 float64) (float64, error) {
vlog.VI(2).Info("Float64(%u) was called.", i1)
return i1, nil
}
-func (*server) Int32(call ipc.Context, i1 int32) (int32, error) {
+func (*server) Int32(call ipc.ServerContext, i1 int32) (int32, error) {
vlog.VI(2).Info("Int32(%v) was called.", i1)
return i1, nil
}
-func (*server) Int64(call ipc.Context, i1 int64) (int64, error) {
+func (*server) Int64(call ipc.ServerContext, i1 int64) (int64, error) {
vlog.VI(2).Info("Int64(%v) was called.", i1)
return i1, nil
}
-func (*server) String(call ipc.Context, i1 string) (string, error) {
+func (*server) String(call ipc.ServerContext, i1 string) (string, error) {
vlog.VI(2).Info("String(%v) was called.", i1)
return i1, nil
}
-func (*server) Byte(call ipc.Context, i1 byte) (byte, error) {
+func (*server) Byte(call ipc.ServerContext, i1 byte) (byte, error) {
vlog.VI(2).Info("Byte(%v) was called.", i1)
return i1, nil
}
-func (*server) UInt32(call ipc.Context, i1 uint32) (uint32, error) {
+func (*server) UInt32(call ipc.ServerContext, i1 uint32) (uint32, error) {
vlog.VI(2).Info("UInt32(%u) was called.", i1)
return i1, nil
}
-func (*server) UInt64(call ipc.Context, i1 uint64) (uint64, error) {
+func (*server) UInt64(call ipc.ServerContext, i1 uint64) (uint64, error) {
vlog.VI(2).Info("UInt64(%u) was called.", i1)
return i1, nil
}
-func (*server) InputArray(call ipc.Context, i1 [2]uint8) error {
+func (*server) InputArray(call ipc.ServerContext, i1 [2]uint8) error {
vlog.VI(2).Info("CInputArray(%v) was called.", i1)
return nil
}
-func (*server) OutputArray(call ipc.Context) ([2]uint8, error) {
+func (*server) OutputArray(call ipc.ServerContext) ([2]uint8, error) {
vlog.VI(2).Info("COutputArray() was called.")
return [2]uint8{1, 2}, nil
}
-func (*server) InputMap(call ipc.Context, i1 map[uint8]uint8) error {
+func (*server) InputMap(call ipc.ServerContext, i1 map[uint8]uint8) error {
vlog.VI(2).Info("CInputMap(%v) was called.", i1)
return nil
}
-func (*server) OutputMap(call ipc.Context) (map[uint8]uint8, error) {
+func (*server) OutputMap(call ipc.ServerContext) (map[uint8]uint8, error) {
vlog.VI(2).Info("COutputMap() was called.")
return map[uint8]uint8{1: 2}, nil
}
-func (*server) InputSlice(call ipc.Context, i1 []uint8) error {
+func (*server) InputSlice(call ipc.ServerContext, i1 []uint8) error {
vlog.VI(2).Info("CInputSlice(%v) was called.", i1)
return nil
}
-func (*server) OutputSlice(call ipc.Context) ([]uint8, error) {
+func (*server) OutputSlice(call ipc.ServerContext) ([]uint8, error) {
vlog.VI(2).Info("COutputSlice() was called.")
return []uint8{1, 2}, nil
}
-func (*server) InputStruct(call ipc.Context, i1 test_base.Struct) error {
+func (*server) InputStruct(call ipc.ServerContext, i1 test_base.Struct) error {
vlog.VI(2).Info("CInputStruct(%v) was called.", i1)
return nil
}
-func (*server) OutputStruct(call ipc.Context) (test_base.Struct, error) {
+func (*server) OutputStruct(call ipc.ServerContext) (test_base.Struct, error) {
vlog.VI(2).Info("COutputStruct() was called.")
return test_base.Struct{X: 1, Y: 2}, nil
}
-func (*server) NoArguments(call ipc.Context) error {
+func (*server) NoArguments(call ipc.ServerContext) error {
vlog.VI(2).Info("NoArguments() was called.")
return nil
}
-func (*server) MultipleArguments(call ipc.Context, i1, i2 int32) (int32, int32, error) {
+func (*server) MultipleArguments(call ipc.ServerContext, i1, i2 int32) (int32, int32, error) {
vlog.VI(2).Info("MultipleArguments(%v,%v) was called.", i1, i2)
return i1, i2, nil
}
-func (*server) StreamingOutput(call ipc.Context, nStream int32, item bool, reply test_base.TypeTesterServiceStreamingOutputStream) error {
+func (*server) StreamingOutput(call ipc.ServerContext, nStream int32, item bool, reply test_base.TypeTesterServiceStreamingOutputStream) error {
vlog.VI(2).Info("StreamingOutput(%v,%v) was called.", nStream, item)
for i := int32(0); i < nStream; i++ {
reply.Send(item)
diff --git a/tools/vrpc/test_base/test_base.vdl.go b/tools/vrpc/test_base/test_base.vdl.go
index b3fcdc5..8334c68 100644
--- a/tools/vrpc/test_base/test_base.vdl.go
+++ b/tools/vrpc/test_base/test_base.vdl.go
@@ -23,29 +23,29 @@
// to enable embedding without method collisions. Not to be used directly by clients.
type TypeTester_ExcludingUniversal interface {
// Methods to test support for generic types.
- Bool(I1 bool, opts ..._gen_ipc.ClientCallOpt) (reply bool, err error)
- Float32(I1 float32, opts ..._gen_ipc.ClientCallOpt) (reply float32, err error)
- Float64(I1 float64, opts ..._gen_ipc.ClientCallOpt) (reply float64, err error)
- Int32(I1 int32, opts ..._gen_ipc.ClientCallOpt) (reply int32, err error)
- Int64(I1 int64, opts ..._gen_ipc.ClientCallOpt) (reply int64, err error)
- String(I1 string, opts ..._gen_ipc.ClientCallOpt) (reply string, err error)
- Byte(I1 byte, opts ..._gen_ipc.ClientCallOpt) (reply byte, err error)
- UInt32(I1 uint32, opts ..._gen_ipc.ClientCallOpt) (reply uint32, err error)
- UInt64(I1 uint64, opts ..._gen_ipc.ClientCallOpt) (reply uint64, err error)
+ Bool(ctx _gen_ipc.Context, I1 bool, opts ..._gen_ipc.CallOpt) (reply bool, err error)
+ Float32(ctx _gen_ipc.Context, I1 float32, opts ..._gen_ipc.CallOpt) (reply float32, err error)
+ Float64(ctx _gen_ipc.Context, I1 float64, opts ..._gen_ipc.CallOpt) (reply float64, err error)
+ Int32(ctx _gen_ipc.Context, I1 int32, opts ..._gen_ipc.CallOpt) (reply int32, err error)
+ Int64(ctx _gen_ipc.Context, I1 int64, opts ..._gen_ipc.CallOpt) (reply int64, err error)
+ String(ctx _gen_ipc.Context, I1 string, opts ..._gen_ipc.CallOpt) (reply string, err error)
+ Byte(ctx _gen_ipc.Context, I1 byte, opts ..._gen_ipc.CallOpt) (reply byte, err error)
+ UInt32(ctx _gen_ipc.Context, I1 uint32, opts ..._gen_ipc.CallOpt) (reply uint32, err error)
+ UInt64(ctx _gen_ipc.Context, I1 uint64, opts ..._gen_ipc.CallOpt) (reply uint64, err error)
// Methods to test support for composite types.
- InputArray(I1 [2]byte, opts ..._gen_ipc.ClientCallOpt) (err error)
- InputMap(I1 map[byte]byte, opts ..._gen_ipc.ClientCallOpt) (err error)
- InputSlice(I1 []byte, opts ..._gen_ipc.ClientCallOpt) (err error)
- InputStruct(I1 Struct, opts ..._gen_ipc.ClientCallOpt) (err error)
- OutputArray(opts ..._gen_ipc.ClientCallOpt) (reply [2]byte, err error)
- OutputMap(opts ..._gen_ipc.ClientCallOpt) (reply map[byte]byte, err error)
- OutputSlice(opts ..._gen_ipc.ClientCallOpt) (reply []byte, err error)
- OutputStruct(opts ..._gen_ipc.ClientCallOpt) (reply Struct, err error)
+ InputArray(ctx _gen_ipc.Context, I1 [2]byte, opts ..._gen_ipc.CallOpt) (err error)
+ InputMap(ctx _gen_ipc.Context, I1 map[byte]byte, opts ..._gen_ipc.CallOpt) (err error)
+ InputSlice(ctx _gen_ipc.Context, I1 []byte, opts ..._gen_ipc.CallOpt) (err error)
+ InputStruct(ctx _gen_ipc.Context, I1 Struct, opts ..._gen_ipc.CallOpt) (err error)
+ OutputArray(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply [2]byte, err error)
+ OutputMap(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply map[byte]byte, err error)
+ OutputSlice(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []byte, err error)
+ OutputStruct(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply Struct, err error)
// Methods to test support for different number of arguments.
- NoArguments(opts ..._gen_ipc.ClientCallOpt) (err error)
- MultipleArguments(I1 int32, I2 int32, opts ..._gen_ipc.ClientCallOpt) (O1 int32, O2 int32, err error)
+ NoArguments(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error)
+ MultipleArguments(ctx _gen_ipc.Context, I1 int32, I2 int32, opts ..._gen_ipc.CallOpt) (O1 int32, O2 int32, err error)
// Methods to test support for streaming.
- StreamingOutput(NumStreamItems int32, StreamItem bool, opts ..._gen_ipc.ClientCallOpt) (reply TypeTesterStreamingOutputStream, err error)
+ StreamingOutput(ctx _gen_ipc.Context, NumStreamItems int32, StreamItem bool, opts ..._gen_ipc.CallOpt) (reply TypeTesterStreamingOutputStream, err error)
}
type TypeTester interface {
_gen_ipc.UniversalServiceMethods
@@ -56,29 +56,29 @@
type TypeTesterService interface {
// Methods to test support for generic types.
- Bool(context _gen_ipc.Context, I1 bool) (reply bool, err error)
- Float32(context _gen_ipc.Context, I1 float32) (reply float32, err error)
- Float64(context _gen_ipc.Context, I1 float64) (reply float64, err error)
- Int32(context _gen_ipc.Context, I1 int32) (reply int32, err error)
- Int64(context _gen_ipc.Context, I1 int64) (reply int64, err error)
- String(context _gen_ipc.Context, I1 string) (reply string, err error)
- Byte(context _gen_ipc.Context, I1 byte) (reply byte, err error)
- UInt32(context _gen_ipc.Context, I1 uint32) (reply uint32, err error)
- UInt64(context _gen_ipc.Context, I1 uint64) (reply uint64, err error)
+ Bool(context _gen_ipc.ServerContext, I1 bool) (reply bool, err error)
+ Float32(context _gen_ipc.ServerContext, I1 float32) (reply float32, err error)
+ Float64(context _gen_ipc.ServerContext, I1 float64) (reply float64, err error)
+ Int32(context _gen_ipc.ServerContext, I1 int32) (reply int32, err error)
+ Int64(context _gen_ipc.ServerContext, I1 int64) (reply int64, err error)
+ String(context _gen_ipc.ServerContext, I1 string) (reply string, err error)
+ Byte(context _gen_ipc.ServerContext, I1 byte) (reply byte, err error)
+ UInt32(context _gen_ipc.ServerContext, I1 uint32) (reply uint32, err error)
+ UInt64(context _gen_ipc.ServerContext, I1 uint64) (reply uint64, err error)
// Methods to test support for composite types.
- InputArray(context _gen_ipc.Context, I1 [2]byte) (err error)
- InputMap(context _gen_ipc.Context, I1 map[byte]byte) (err error)
- InputSlice(context _gen_ipc.Context, I1 []byte) (err error)
- InputStruct(context _gen_ipc.Context, I1 Struct) (err error)
- OutputArray(context _gen_ipc.Context) (reply [2]byte, err error)
- OutputMap(context _gen_ipc.Context) (reply map[byte]byte, err error)
- OutputSlice(context _gen_ipc.Context) (reply []byte, err error)
- OutputStruct(context _gen_ipc.Context) (reply Struct, err error)
+ InputArray(context _gen_ipc.ServerContext, I1 [2]byte) (err error)
+ InputMap(context _gen_ipc.ServerContext, I1 map[byte]byte) (err error)
+ InputSlice(context _gen_ipc.ServerContext, I1 []byte) (err error)
+ InputStruct(context _gen_ipc.ServerContext, I1 Struct) (err error)
+ OutputArray(context _gen_ipc.ServerContext) (reply [2]byte, err error)
+ OutputMap(context _gen_ipc.ServerContext) (reply map[byte]byte, err error)
+ OutputSlice(context _gen_ipc.ServerContext) (reply []byte, err error)
+ OutputStruct(context _gen_ipc.ServerContext) (reply Struct, err error)
// Methods to test support for different number of arguments.
- NoArguments(context _gen_ipc.Context) (err error)
- MultipleArguments(context _gen_ipc.Context, I1 int32, I2 int32) (O1 int32, O2 int32, err error)
+ NoArguments(context _gen_ipc.ServerContext) (err error)
+ MultipleArguments(context _gen_ipc.ServerContext, I1 int32, I2 int32) (O1 int32, O2 int32, err error)
// Methods to test support for streaming.
- StreamingOutput(context _gen_ipc.Context, NumStreamItems int32, StreamItem bool, stream TypeTesterServiceStreamingOutputStream) (err error)
+ StreamingOutput(context _gen_ipc.ServerContext, NumStreamItems int32, StreamItem bool, stream TypeTesterServiceStreamingOutputStream) (err error)
}
// TypeTesterStreamingOutputStream is the interface for streaming responses of the method
@@ -99,7 +99,7 @@
// Implementation of the TypeTesterStreamingOutputStream interface that is not exported.
type implTypeTesterStreamingOutputStream struct {
- clientCall _gen_ipc.ClientCall
+ clientCall _gen_ipc.Call
}
func (c *implTypeTesterStreamingOutputStream) Recv() (item bool, err error) {
@@ -178,9 +178,9 @@
name string
}
-func (__gen_c *clientStubTypeTester) Bool(I1 bool, opts ..._gen_ipc.ClientCallOpt) (reply bool, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Bool", []interface{}{I1}, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) Bool(ctx _gen_ipc.Context, I1 bool, opts ..._gen_ipc.CallOpt) (reply bool, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Bool", []interface{}{I1}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -189,9 +189,9 @@
return
}
-func (__gen_c *clientStubTypeTester) Float32(I1 float32, opts ..._gen_ipc.ClientCallOpt) (reply float32, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Float32", []interface{}{I1}, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) Float32(ctx _gen_ipc.Context, I1 float32, opts ..._gen_ipc.CallOpt) (reply float32, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Float32", []interface{}{I1}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -200,9 +200,9 @@
return
}
-func (__gen_c *clientStubTypeTester) Float64(I1 float64, opts ..._gen_ipc.ClientCallOpt) (reply float64, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Float64", []interface{}{I1}, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) Float64(ctx _gen_ipc.Context, I1 float64, opts ..._gen_ipc.CallOpt) (reply float64, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Float64", []interface{}{I1}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -211,9 +211,9 @@
return
}
-func (__gen_c *clientStubTypeTester) Int32(I1 int32, opts ..._gen_ipc.ClientCallOpt) (reply int32, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Int32", []interface{}{I1}, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) Int32(ctx _gen_ipc.Context, I1 int32, opts ..._gen_ipc.CallOpt) (reply int32, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Int32", []interface{}{I1}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -222,9 +222,9 @@
return
}
-func (__gen_c *clientStubTypeTester) Int64(I1 int64, opts ..._gen_ipc.ClientCallOpt) (reply int64, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Int64", []interface{}{I1}, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) Int64(ctx _gen_ipc.Context, I1 int64, opts ..._gen_ipc.CallOpt) (reply int64, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Int64", []interface{}{I1}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -233,9 +233,9 @@
return
}
-func (__gen_c *clientStubTypeTester) String(I1 string, opts ..._gen_ipc.ClientCallOpt) (reply string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "String", []interface{}{I1}, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) String(ctx _gen_ipc.Context, I1 string, opts ..._gen_ipc.CallOpt) (reply string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "String", []interface{}{I1}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -244,9 +244,9 @@
return
}
-func (__gen_c *clientStubTypeTester) Byte(I1 byte, opts ..._gen_ipc.ClientCallOpt) (reply byte, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Byte", []interface{}{I1}, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) Byte(ctx _gen_ipc.Context, I1 byte, opts ..._gen_ipc.CallOpt) (reply byte, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Byte", []interface{}{I1}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -255,9 +255,9 @@
return
}
-func (__gen_c *clientStubTypeTester) UInt32(I1 uint32, opts ..._gen_ipc.ClientCallOpt) (reply uint32, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UInt32", []interface{}{I1}, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) UInt32(ctx _gen_ipc.Context, I1 uint32, opts ..._gen_ipc.CallOpt) (reply uint32, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UInt32", []interface{}{I1}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -266,9 +266,9 @@
return
}
-func (__gen_c *clientStubTypeTester) UInt64(I1 uint64, opts ..._gen_ipc.ClientCallOpt) (reply uint64, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UInt64", []interface{}{I1}, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) UInt64(ctx _gen_ipc.Context, I1 uint64, opts ..._gen_ipc.CallOpt) (reply uint64, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UInt64", []interface{}{I1}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -277,9 +277,9 @@
return
}
-func (__gen_c *clientStubTypeTester) InputArray(I1 [2]byte, opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "InputArray", []interface{}{I1}, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) InputArray(ctx _gen_ipc.Context, I1 [2]byte, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "InputArray", []interface{}{I1}, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -288,9 +288,9 @@
return
}
-func (__gen_c *clientStubTypeTester) InputMap(I1 map[byte]byte, opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "InputMap", []interface{}{I1}, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) InputMap(ctx _gen_ipc.Context, I1 map[byte]byte, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "InputMap", []interface{}{I1}, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -299,9 +299,9 @@
return
}
-func (__gen_c *clientStubTypeTester) InputSlice(I1 []byte, opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "InputSlice", []interface{}{I1}, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) InputSlice(ctx _gen_ipc.Context, I1 []byte, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "InputSlice", []interface{}{I1}, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -310,9 +310,9 @@
return
}
-func (__gen_c *clientStubTypeTester) InputStruct(I1 Struct, opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "InputStruct", []interface{}{I1}, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) InputStruct(ctx _gen_ipc.Context, I1 Struct, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "InputStruct", []interface{}{I1}, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -321,9 +321,9 @@
return
}
-func (__gen_c *clientStubTypeTester) OutputArray(opts ..._gen_ipc.ClientCallOpt) (reply [2]byte, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "OutputArray", nil, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) OutputArray(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply [2]byte, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "OutputArray", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -332,9 +332,9 @@
return
}
-func (__gen_c *clientStubTypeTester) OutputMap(opts ..._gen_ipc.ClientCallOpt) (reply map[byte]byte, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "OutputMap", nil, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) OutputMap(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply map[byte]byte, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "OutputMap", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -343,9 +343,9 @@
return
}
-func (__gen_c *clientStubTypeTester) OutputSlice(opts ..._gen_ipc.ClientCallOpt) (reply []byte, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "OutputSlice", nil, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) OutputSlice(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []byte, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "OutputSlice", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -354,9 +354,9 @@
return
}
-func (__gen_c *clientStubTypeTester) OutputStruct(opts ..._gen_ipc.ClientCallOpt) (reply Struct, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "OutputStruct", nil, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) OutputStruct(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply Struct, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "OutputStruct", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -365,9 +365,9 @@
return
}
-func (__gen_c *clientStubTypeTester) NoArguments(opts ..._gen_ipc.ClientCallOpt) (err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "NoArguments", nil, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) NoArguments(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "NoArguments", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
@@ -376,9 +376,9 @@
return
}
-func (__gen_c *clientStubTypeTester) MultipleArguments(I1 int32, I2 int32, opts ..._gen_ipc.ClientCallOpt) (O1 int32, O2 int32, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "MultipleArguments", []interface{}{I1, I2}, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) MultipleArguments(ctx _gen_ipc.Context, I1 int32, I2 int32, opts ..._gen_ipc.CallOpt) (O1 int32, O2 int32, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "MultipleArguments", []interface{}{I1, I2}, opts...); err != nil {
return
}
if ierr := call.Finish(&O1, &O2, &err); ierr != nil {
@@ -387,18 +387,18 @@
return
}
-func (__gen_c *clientStubTypeTester) StreamingOutput(NumStreamItems int32, StreamItem bool, opts ..._gen_ipc.ClientCallOpt) (reply TypeTesterStreamingOutputStream, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "StreamingOutput", []interface{}{NumStreamItems, StreamItem}, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) StreamingOutput(ctx _gen_ipc.Context, NumStreamItems int32, StreamItem bool, opts ..._gen_ipc.CallOpt) (reply TypeTesterStreamingOutputStream, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "StreamingOutput", []interface{}{NumStreamItems, StreamItem}, opts...); err != nil {
return
}
reply = &implTypeTesterStreamingOutputStream{clientCall: call}
return
}
-func (__gen_c *clientStubTypeTester) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) UnresolveStep(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -407,9 +407,9 @@
return
}
-func (__gen_c *clientStubTypeTester) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) Signature(ctx _gen_ipc.Context, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
@@ -418,9 +418,9 @@
return
}
-func (__gen_c *clientStubTypeTester) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.ClientCall
- if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
+func (__gen_c *clientStubTypeTester) GetMethodTags(ctx _gen_ipc.Context, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
+ var call _gen_ipc.Call
+ if call, err = __gen_c.client.StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {