veyron2/naming: prevent annoying last-step RPC for name resolution.
The client MountTable code resolves names iteratively until it either
encounters a terminal name or an error. This CL changes the behaviour
of Publish to always publish an address that will be considered terminal
when resolved. So: ep, _ := s.Listen(...); s.Publish("foo/bar") will
result a Mount on foo/bar with an address of ep.String() + "//". This
ensures that when foo/bar is resolved in the MountTable and
ep.String() + "//" is returned then the client knows to stop resolving
and thus can avoid an extra RPC call that is doomed to fail. This
is the desired behaviour for all servers except MountTables. MountTables
must therefore be handled specially. MountTable servers (note, only
servers) must be started on ipc.Server that is passed the option
veryon2.ServesMountTables(true) which instructs the ipc.Server
implementation to not add the "//" suffix.
naming.MountTable now exposes a 'SetRoots' method to allow the
root MountTable servers for the in-process MountTable client to be
configured dynamically.
Whilst working on this CL I cam across lots of test and example code
that is hand-manipulating the name space rather than using Publish
which is likely to be error prone. We should clean this all up at
some point.
Change-Id: I1d7aa3841b616af0917ff1299ff5deffc85fb34d
12 files changed