veyron2: remove unresolve method.
Change-Id: Ife884f23f257ba2e41e9c92f10a3203199af7eca
diff --git a/runtimes/google/naming/namespace/all_test.go b/runtimes/google/naming/namespace/all_test.go
index f86af6a..e4b322f 100644
--- a/runtimes/google/naming/namespace/all_test.go
+++ b/runtimes/google/naming/namespace/all_test.go
@@ -164,14 +164,6 @@
doResolveTest(t, "Resolve", ns.Resolve, r.NewContext(), name, want, pattern)
}
-func testUnresolve(t *testing.T, r veyron2.Runtime, ns naming.Namespace, name string, want ...string) {
- servers, err := ns.Unresolve(r.NewContext(), name)
- if err != nil {
- boom(t, "Failed to Resolve %q: %s", name, err)
- }
- compare(t, "Unresolve", name, servers, want)
-}
-
type serverEntry struct {
mountPoint string
server ipc.Server
@@ -580,26 +572,6 @@
doGlob(t, r, ns, "c1/...", 1000)
}
-func TestUnresolve(t *testing.T) {
- // TODO(cnicolaou): move unresolve tests into this test, right now,
- // that's annoying because the stub compiler has some blocking bugs and the
- // Unresolve functionality is partially implemented in the stubs.
- t.Skip()
-
- sr, r, cleanup := createRuntimes(t)
- defer cleanup()
-
- root, mts, jokes, stopper := createNamespace(t, sr)
- runNestedMountTables(t, sr, mts)
- defer stopper()
- ns := r.Namespace()
- ns.SetRoots(root.name)
-
- vlog.Infof("Glob: %v", doGlob(t, r, ns, "*", 0))
- testResolve(t, r, ns, "joke1", jokes["joke1"].name)
- testUnresolve(t, r, ns, "joke1", "")
-}
-
// TestGoroutineLeaks tests for leaking goroutines - we have many:-(
func TestGoroutineLeaks(t *testing.T) {
t.Skip()
diff --git a/runtimes/google/naming/namespace/resolve.go b/runtimes/google/naming/namespace/resolve.go
index 1cd6005..4deb9c2 100644
--- a/runtimes/google/naming/namespace/resolve.go
+++ b/runtimes/google/naming/namespace/resolve.go
@@ -189,67 +189,6 @@
return naming.ToStringSlice(e), nil
}
-func finishUnresolve(call ipc.Call) ([]string, error) {
- var newNames []string
- var unresolveErr error
- if err := call.Finish(&newNames, &unresolveErr); err != nil {
- return nil, err
- }
- return newNames, unresolveErr
-}
-
-// TODO(caprita): UnresolveStep no longer exists.
-func unresolveAgainstServer(ctx *context.T, client ipc.Client, names []string) ([]string, error) {
- finalErr := errors.New("no servers to unresolve")
- for _, name := range names {
- callCtx, _ := ctx.WithTimeout(callTimeout)
- call, err := client.StartCall(callCtx, name, "UnresolveStep", nil, options.NoResolve(true))
- if err != nil {
- finalErr = err
- vlog.VI(2).Infof("StartCall %q.UnresolveStep() failed: %s", name, err)
- continue
-
- }
- newNames, err := finishUnresolve(call)
- if err == nil {
- return newNames, nil
- }
- finalErr = err
- vlog.VI(2).Infof("Finish %s failed: %v", name, err)
- }
- return nil, finalErr
-}
-
-// TODO(caprita): Unresolve currently picks the first responsive server as it
-// goes up the ancestry line. This means that, if a service has several
-// ancestors (each with potentially more than one replica), the first responsive
-// replica of the first responsive ancestor is preferred. In particular,
-// other branches are ignored. We need to figure out a desired policy for
-// selecting the right branch (or should we return a representative of all
-// branches?).
-
-// Unesolve implements veyron2/naming.Namespace.
-func (ns *namespace) Unresolve(ctx *context.T, name string) ([]string, error) {
- defer vlog.LogCall()()
- vlog.VI(2).Infof("Unresolve %s", name)
- names, err := ns.Resolve(ctx, name)
- if err != nil {
- return nil, err
- }
- client := veyron2.RuntimeFromContext(ctx).Client()
- for remaining := ns.maxResolveDepth; remaining > 0; remaining-- {
- vlog.VI(2).Infof("Unresolve loop %s", names)
- curr := names
- if names, err = unresolveAgainstServer(ctx, client, names); err != nil {
- return nil, err
- }
- if len(names) == 0 {
- return curr, nil
- }
- }
- return nil, verror.Make(naming.ErrResolutionDepthExceeded, ctx)
-}
-
// FlushCache flushes the most specific entry found for name. It returns true if anything was
// actually flushed.
func (ns *namespace) FlushCacheEntry(name string) bool {
diff --git a/runtimes/google/testing/mocks/naming/namespace.go b/runtimes/google/testing/mocks/naming/namespace.go
index b019b8c..3a426ce 100644
--- a/runtimes/google/testing/mocks/naming/namespace.go
+++ b/runtimes/google/testing/mocks/naming/namespace.go
@@ -124,13 +124,6 @@
return nil, nil
}
-func (ns *namespace) Unresolve(ctx *context.T, name string) ([]string, error) {
- defer vlog.LogCall()()
- // TODO(mattr): Implement this method for tests that might need it.
- panic("Unresolve not implemented")
- return nil, nil
-}
-
func (ns *namespace) FlushCacheEntry(name string) bool {
defer vlog.LogCall()()
return false
diff --git a/tools/namespace/doc.go b/tools/namespace/doc.go
index 94e8424..7aee2a4 100644
--- a/tools/namespace/doc.go
+++ b/tools/namespace/doc.go
@@ -18,7 +18,6 @@
unmount Removes a server from the namespace
resolve Translates a object name to its object address(es)
resolvetomt Finds the address of the mounttable that holds an object name
- unresolve Returns the rooted object names for the given object name
help Display help for commands or topics
Run "namespace help [command]" for command usage.
@@ -102,15 +101,6 @@
<name> is the name to resolve.
-Namespace Unresolve
-
-Returns the rooted object names for the given object name.
-
-Usage:
- namespace unresolve <name>
-
-<name> is the object name to unresolve.
-
Namespace Help
Help with no args displays the usage of the parent command.
diff --git a/tools/namespace/impl.go b/tools/namespace/impl.go
index ea408bd..d030bf2 100644
--- a/tools/namespace/impl.go
+++ b/tools/namespace/impl.go
@@ -170,34 +170,6 @@
return nil
}
-var cmdUnresolve = &cmdline.Command{
- Run: runUnresolve,
- Name: "unresolve",
- Short: "Returns the rooted object names for the given object name",
- Long: "Returns the rooted object names for the given object name.",
- ArgsName: "<name>",
- ArgsLong: "<name> is the object name to unresolve.",
-}
-
-func runUnresolve(cmd *cmdline.Command, args []string) error {
- if expected, got := 1, len(args); expected != got {
- return cmd.UsageErrorf("unresolve: incorrect number of arguments, expected %d, got %d", expected, got)
- }
- name := args[0]
- ns := runtime.Namespace()
- ctx, cancel := runtime.NewContext().WithTimeout(time.Minute)
- defer cancel()
- servers, err := ns.Unresolve(ctx, name)
- if err != nil {
- vlog.Infof("ns.Unresolve(%q) failed: %v", name, err)
- return err
- }
- for _, s := range servers {
- fmt.Fprintln(cmd.Stdout(), s)
- }
- return nil
-}
-
func root() *cmdline.Command {
return &cmdline.Command{
Name: "namespace",
@@ -209,6 +181,6 @@
starting with NAMESPACE_ROOT, e.g. NAMESPACE_ROOT, NAMESPACE_ROOT_2,
NAMESPACE_ROOT_GOOGLE, etc. The command line options override the environment.
`,
- Children: []*cmdline.Command{cmdGlob, cmdMount, cmdUnmount, cmdResolve, cmdResolveToMT, cmdUnresolve},
+ Children: []*cmdline.Command{cmdGlob, cmdMount, cmdUnmount, cmdResolve, cmdResolveToMT},
}
}