veyron2/vdl: New API for generated Go interfaces.
The main change is for generated streaming methods on the server side. Here's
how they used to look:
Count(ctx ipc.ServerContext, start int32, stream ArithServiceCountStream) error
Here's the new way:
Count(ctx ArithCountContext, start int32) error
Instead of passing in a context and stream separately, we're now
passing them together. This keeps the client and server
interfaces more uniform, which helps simplify the generator
logic, and may be useful for the new Signature implementation.
There's also lots of renaming. In the new scheme, if the user
creates a VDL interface Arith, all generated funcs and interfaces
start with Arith. This means we'll support unexported VDL
interfaces "for free", and also improves generated godoc by
grouping things together.
Here's a renaming cheatsheet; given a VDL interface Foo with one
streaming and one non-streaming method:
type Foo interface {
XXX()
YYY() stream<a, b>
}
type Foo_ExcludingUniversal -> FooClientMethods
type Foo -> FooClientStub
func BindFoo() -> FooClient()
type FooService -> FooServerMethods
type ServerStubFoo -> FooServerStub
func NewServerFoo() -> FooServer()
type FooYYYCall -> FooYYYCall
-> FooYYYClientStream
type FooServiceYYYStream -> FooYYYServerStream
-> FooYYYContext
Change-Id: I48e9dd2ab676da50f9c989368ed849e2d0e95256
diff --git a/tools/associate/doc.go b/tools/associate/doc.go
index 5be1076..6133bbe 100644
--- a/tools/associate/doc.go
+++ b/tools/associate/doc.go
@@ -27,7 +27,7 @@
Associate List
-Lists all account associations
+Lists all account associations
Usage:
associate list <nodemanager>.
diff --git a/tools/associate/impl.go b/tools/associate/impl.go
index a60f649..b8f580b 100644
--- a/tools/associate/impl.go
+++ b/tools/associate/impl.go
@@ -27,11 +27,7 @@
ctx, cancel := rt.R().NewContext().WithTimeout(time.Minute)
defer cancel()
- nodeStub, err := node.BindNode(args[0])
- if err != nil {
- return fmt.Errorf("BindNode(%s) failed: %v", args[0], err)
- }
- assocs, err := nodeStub.ListAssociations(ctx)
+ assocs, err := node.NodeClient(args[0]).ListAssociations(ctx)
if err != nil {
return fmt.Errorf("ListAssociations failed: %v", err)
}
@@ -60,11 +56,7 @@
}
ctx, cancel := rt.R().NewContext().WithTimeout(time.Minute)
defer cancel()
- nodeStub, err := node.BindNode(args[0])
- if err != nil {
- return fmt.Errorf("BindNode(%s) failed: %v", args[0], err)
- }
- return nodeStub.AssociateAccount(ctx, args[2:], args[1])
+ return node.NodeClient(args[0]).AssociateAccount(ctx, args[2:], args[1])
}
var cmdRemove = &cmdline.Command{
@@ -84,12 +76,7 @@
}
ctx, cancel := rt.R().NewContext().WithTimeout(time.Minute)
defer cancel()
- nodeStub, err := node.BindNode(args[0])
- if err != nil {
- return fmt.Errorf("BindNode(%s) failed: %v", args[0], err)
- }
-
- return nodeStub.AssociateAccount(ctx, args[1:], "")
+ return node.NodeClient(args[0]).AssociateAccount(ctx, args[1:], "")
}
func root() *cmdline.Command {
diff --git a/tools/associate/impl_test.go b/tools/associate/impl_test.go
index 54850d0..dbb2ecc 100644
--- a/tools/associate/impl_test.go
+++ b/tools/associate/impl_test.go
@@ -78,7 +78,7 @@
func (i *mockNodeInvoker) GetACL(ipc.ServerContext) (security.ACL, string, error) {
return security.ACL{}, "", nil
}
-func (i *mockNodeInvoker) Glob(ctx ipc.ServerContext, pattern string, stream mounttable.GlobbableServiceGlobStream) error {
+func (i *mockNodeInvoker) Glob(ctx mounttable.GlobbableGlobContext, pattern string) error {
return nil
}
@@ -92,7 +92,7 @@
}
func (d *dispatcher) Lookup(suffix, method string) (interface{}, security.Authorizer, error) {
- invoker := ipc.ReflectInvoker(node.NewServerNode(&mockNodeInvoker{tape: d.tape, t: d.t}))
+ invoker := ipc.ReflectInvoker(node.NodeServer(&mockNodeInvoker{tape: d.tape, t: d.t}))
return invoker, nil, nil
}