x/ref: Merge naming.{VDL,}{MountEntry,MountedServer,Glob}.
This fixes the following bug:
https://github.com/veyron/release-issues/issues/1074
MultiPart: 2/4
Change-Id: I60db2ed17d3978a6699e0e8556e4499b7e6258e8
diff --git a/services/mgmt/device/impl/proxy_invoker.go b/services/mgmt/device/impl/proxy_invoker.go
index 8f252a7..8399efa 100644
--- a/services/mgmt/device/impl/proxy_invoker.go
+++ b/services/mgmt/device/impl/proxy_invoker.go
@@ -215,7 +215,7 @@
type call struct {
ipc.ServerCall
- ch chan<- naming.VDLGlobReply
+ ch chan<- naming.GlobReply
}
func (c *call) Recv(v interface{}) error {
@@ -223,12 +223,12 @@
}
func (c *call) Send(v interface{}) error {
- c.ch <- v.(naming.VDLGlobReply)
+ c.ch <- v.(naming.GlobReply)
return nil
}
-func (p *proxyInvoker) Glob__(serverCall ipc.ServerCall, pattern string) (<-chan naming.VDLGlobReply, error) {
- ch := make(chan naming.VDLGlobReply)
+func (p *proxyInvoker) Glob__(serverCall ipc.ServerCall, pattern string) (<-chan naming.GlobReply, error) {
+ ch := make(chan naming.GlobReply)
go func() {
p.Invoke(ipc.GlobMethod, &call{serverCall, ch}, []interface{}{&pattern})
close(ch)
diff --git a/services/mgmt/stats/impl/stats.go b/services/mgmt/stats/impl/stats.go
index 32abd7c..779a88f 100644
--- a/services/mgmt/stats/impl/stats.go
+++ b/services/mgmt/stats/impl/stats.go
@@ -36,15 +36,15 @@
}
// Glob__ returns the name of all objects that match pattern.
-func (i *statsService) Glob__(call ipc.ServerCall, pattern string) (<-chan naming.VDLGlobReply, error) {
+func (i *statsService) Glob__(call ipc.ServerCall, pattern string) (<-chan naming.GlobReply, error) {
vlog.VI(1).Infof("%v.Glob__(%q)", i.suffix, pattern)
- ch := make(chan naming.VDLGlobReply)
+ ch := make(chan naming.GlobReply)
go func() {
defer close(ch)
it := libstats.Glob(i.suffix, pattern, time.Time{}, false)
for it.Advance() {
- ch <- naming.VDLGlobReplyEntry{naming.VDLMountEntry{Name: it.Value().Key}}
+ ch <- naming.GlobReplyEntry{naming.MountEntry{Name: it.Value().Key}}
}
if err := it.Err(); err != nil {
vlog.VI(1).Infof("libstats.Glob(%q, %q) failed: %v", i.suffix, pattern, err)
diff --git a/services/mounttable/lib/mounttable.go b/services/mounttable/lib/mounttable.go
index f1641a8..4c9554b 100644
--- a/services/mounttable/lib/mounttable.go
+++ b/services/mounttable/lib/mounttable.go
@@ -372,13 +372,13 @@
// 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) ResolveStepX(call ipc.ServerCall) (entry naming.VDLMountEntry, err error) {
+func (ms *mountContext) ResolveStepX(call ipc.ServerCall) (entry naming.MountEntry, err error) {
return ms.ResolveStep(call)
}
// ResolveStep returns the next server in a resolution in the form of a MountEntry. The name
// in the mount entry is the name relative to the server's root.
-func (ms *mountContext) ResolveStep(call ipc.ServerCall) (entry naming.VDLMountEntry, err error) {
+func (ms *mountContext) ResolveStep(call ipc.ServerCall) (entry naming.MountEntry, err error) {
vlog.VI(2).Infof("ResolveStep %q", ms.name)
mt := ms.mt
// Find the next mount point for the name.
@@ -400,7 +400,7 @@
defer n.Unlock()
entry.Servers = n.mount.servers.copyToSlice()
entry.Name = strings.Join(elems, "/")
- entry.MT = n.mount.mt
+ entry.ServesMountTable = n.mount.mt
return
}
@@ -579,7 +579,7 @@
}
// globStep is called with n and n.parent locked. Returns with both unlocked.
-func (mt *mountTable) globStep(n *node, name string, pattern *glob.Glob, call ipc.ServerCall, ch chan<- naming.VDLGlobReply) {
+func (mt *mountTable) globStep(n *node, name string, pattern *glob.Glob, call ipc.ServerCall, ch chan<- naming.GlobReply) {
vlog.VI(2).Infof("globStep(%s, %s)", name, pattern)
// If this is a mount point, we're done.
@@ -592,19 +592,19 @@
}
// Don't need the parent lock anymore.
n.parent.Unlock()
- me := naming.VDLMountEntry{
+ me := naming.MountEntry{
Name: name,
}
// Only fill in the mount info if we can resolve this name.
if err := n.satisfies(mt, call, resolveTags); err == nil {
me.Servers = m.servers.copyToSlice()
- me.MT = n.mount.mt
+ me.ServesMountTable = n.mount.mt
} else {
- me.Servers = []naming.VDLMountedServer{}
+ me.Servers = []naming.MountedServer{}
}
// Unlock while we are sending on the channel to avoid livelock.
n.Unlock()
- ch <- naming.VDLGlobReplyEntry{me}
+ ch <- naming.GlobReplyEntry{me}
return
}
@@ -662,7 +662,7 @@
}
// Unlock while we are sending on the channel to avoid livelock.
n.Unlock()
- ch <- naming.VDLGlobReplyEntry{naming.VDLMountEntry{Name: name}}
+ ch <- naming.GlobReplyEntry{naming.MountEntry{Name: name}}
}
// Glob finds matches in the namespace. If we reach a mount point before matching the
@@ -676,7 +676,7 @@
// a state that never existed in the mounttable. For example, if someone removes c/d and later
// adds a/b while a Glob is in progress, the Glob may return a set of nodes that includes both
// c/d and a/b.
-func (ms *mountContext) Glob__(call ipc.ServerCall, pattern string) (<-chan naming.VDLGlobReply, error) {
+func (ms *mountContext) Glob__(call ipc.ServerCall, pattern string) (<-chan naming.GlobReply, error) {
vlog.VI(2).Infof("mt.Glob %v", ms.elems)
g, err := glob.Parse(pattern)
@@ -685,7 +685,7 @@
}
mt := ms.mt
- ch := make(chan naming.VDLGlobReply)
+ ch := make(chan naming.GlobReply)
go func() {
defer close(ch)
// If there was an access error, just ignore the entry, i.e., make it invisible.
@@ -705,7 +705,7 @@
return ch, nil
}
-func (ms *mountContext) linkToLeaf(call ipc.ServerCall, ch chan<- naming.VDLGlobReply) {
+func (ms *mountContext) linkToLeaf(call ipc.ServerCall, ch chan<- naming.GlobReply) {
n, elems, err := ms.mt.findMountPoint(call, ms.elems)
if err != nil || n == nil {
return
@@ -716,7 +716,7 @@
servers[i].Server = naming.Join(s.Server, strings.Join(elems, "/"))
}
n.Unlock()
- ch <- naming.VDLGlobReplyEntry{naming.VDLMountEntry{Name: "", Servers: servers}}
+ ch <- naming.GlobReplyEntry{naming.MountEntry{Name: "", Servers: servers}}
}
func (ms *mountContext) SetPermissions(call ipc.ServerCall, tam access.Permissions, etag string) error {
diff --git a/services/mounttable/lib/mounttable_test.go b/services/mounttable/lib/mounttable_test.go
index af8af91..a158be2 100644
--- a/services/mounttable/lib/mounttable_test.go
+++ b/services/mounttable/lib/mounttable_test.go
@@ -141,7 +141,7 @@
}
}
-func mountentry2names(e *naming.VDLMountEntry) []string {
+func mountentry2names(e *naming.MountEntry) []string {
names := make([]string, len(e.Servers))
for idx, s := range e.Servers {
names[idx] = naming.JoinAddressName(s.Server, e.Name)
@@ -153,14 +153,14 @@
return strs
}
-func resolve(ctx *context.T, name string) (*naming.VDLMountEntry, error) {
+func resolve(ctx *context.T, name string) (*naming.MountEntry, error) {
// Resolve the name one level.
client := v23.GetClient(ctx)
call, err := client.StartCall(ctx, name, "ResolveStep", nil, options.NoResolve{})
if err != nil {
return nil, err
}
- var entry naming.VDLMountEntry
+ var entry naming.MountEntry
if err := call.Finish(&entry); err != nil {
return nil, err
}
@@ -357,7 +357,7 @@
}
var reply []string
for {
- var gr naming.VDLGlobReply
+ var gr naming.GlobReply
err := call.Recv(&gr)
if err == io.EOF {
break
@@ -366,7 +366,7 @@
boom(t, "Glob.StartCall %s: %s", name, pattern, err)
}
switch v := gr.(type) {
- case naming.VDLGlobReplyEntry:
+ case naming.GlobReplyEntry:
if joinServer && len(v.Value.Servers) > 0 {
reply = append(reply, naming.JoinAddressName(v.Value.Servers[0].Server, v.Value.Name))
} else {
@@ -627,7 +627,7 @@
// that will ensure that the client call to the resolved name fails if
// the blessing patterns in the mount entry is not consistent with the
// blessings presented by the end server (once the namespace library
- // changes to respect VDLMountedServer.BlessingPatterns is in place).
+ // changes to respect MountedServer.BlessingPatterns is in place).
rootCtx, aliceCtx, bobCtx, shutdown := initTest()
defer shutdown()
diff --git a/services/mounttable/lib/neighborhood.go b/services/mounttable/lib/neighborhood.go
index 0307070..1093dd1 100644
--- a/services/mounttable/lib/neighborhood.go
+++ b/services/mounttable/lib/neighborhood.go
@@ -5,6 +5,7 @@
"net"
"strconv"
"strings"
+ "time"
"v.io/x/lib/netconfig"
"v.io/x/ref/lib/glob"
@@ -15,6 +16,7 @@
"v.io/v23/security"
"v.io/v23/services/mounttable"
"v.io/v23/services/security/access"
+ vdltime "v.io/v23/vdlroot/time"
"v.io/v23/verror"
"v.io/x/lib/vlog"
@@ -157,12 +159,13 @@
}
// neighbor returns the MountedServers for a particular neighbor.
-func (nh *neighborhood) neighbor(instance string) []naming.VDLMountedServer {
- var reply []naming.VDLMountedServer
+func (nh *neighborhood) neighbor(instance string) []naming.MountedServer {
+ now := time.Now()
+ var reply []naming.MountedServer
si := nh.mdns.ResolveInstance(instance, "veyron")
// Use a map to dedup any addresses seen
- addrMap := make(map[string]uint32)
+ addrMap := make(map[string]vdltime.Deadline)
// Look for any TXT records with addresses.
for _, rr := range si.TxtRRs {
@@ -171,11 +174,12 @@
continue
}
addr := s[len(addressPrefix):]
- addrMap[addr] = rr.Header().Ttl
+ ttl := time.Second * time.Duration(rr.Header().Ttl)
+ addrMap[addr] = vdltime.Deadline{now.Add(ttl)}
}
}
- for addr, ttl := range addrMap {
- reply = append(reply, naming.VDLMountedServer{addr, nil, ttl})
+ for addr, deadline := range addrMap {
+ reply = append(reply, naming.MountedServer{addr, nil, deadline})
}
if reply != nil {
@@ -191,15 +195,16 @@
for _, ip := range ips {
addr := net.JoinHostPort(ip.String(), strconv.Itoa(int(rr.Port)))
ep := naming.FormatEndpoint("tcp", addr)
- reply = append(reply, naming.VDLMountedServer{naming.JoinAddressName(ep, ""), nil, ttl})
+ deadline := vdltime.Deadline{now.Add(time.Second * time.Duration(ttl))}
+ reply = append(reply, naming.MountedServer{naming.JoinAddressName(ep, ""), nil, deadline})
}
}
return reply
}
// neighbors returns all neighbors and their MountedServer structs.
-func (nh *neighborhood) neighbors() map[string][]naming.VDLMountedServer {
- neighbors := make(map[string][]naming.VDLMountedServer, 0)
+func (nh *neighborhood) neighbors() map[string][]naming.MountedServer {
+ neighbors := make(map[string][]naming.MountedServer, 0)
members := nh.mdns.ServiceDiscovery("veyron")
for _, m := range members {
if neighbor := nh.neighbor(m.Name); neighbor != nil {
@@ -211,12 +216,12 @@
}
// ResolveStepX implements ResolveStepX
-func (ns *neighborhoodService) ResolveStepX(call ipc.ServerCall) (entry naming.VDLMountEntry, err error) {
+func (ns *neighborhoodService) ResolveStepX(call ipc.ServerCall) (entry naming.MountEntry, err error) {
return ns.ResolveStep(call)
}
// ResolveStep implements ResolveStep
-func (ns *neighborhoodService) ResolveStep(call ipc.ServerCall) (entry naming.VDLMountEntry, err error) {
+func (ns *neighborhoodService) ResolveStep(call ipc.ServerCall) (entry naming.MountEntry, err error) {
nh := ns.nh
vlog.VI(2).Infof("ResolveStep %v\n", ns.elems)
if len(ns.elems) == 0 {
@@ -232,7 +237,7 @@
entry.Name = ns.name
return
}
- entry.MT = true
+ entry.ServesMountTable = true
entry.Name = naming.Join(ns.elems[1:]...)
entry.Servers = neighbor
return
@@ -257,7 +262,7 @@
}
// Glob__ implements ipc.AllGlobber
-func (ns *neighborhoodService) Glob__(call ipc.ServerCall, pattern string) (<-chan naming.VDLGlobReply, error) {
+func (ns *neighborhoodService) Glob__(call ipc.ServerCall, pattern string) (<-chan naming.GlobReply, error) {
g, err := glob.Parse(pattern)
if err != nil {
return nil, err
@@ -268,14 +273,14 @@
switch len(ns.elems) {
case 0:
- ch := make(chan naming.VDLGlobReply)
+ ch := make(chan naming.GlobReply)
go func() {
defer close(ch)
for k, n := range nh.neighbors() {
if ok, _, _ := g.MatchInitialSegment(k); !ok {
continue
}
- ch <- naming.VDLGlobReplyEntry{naming.VDLMountEntry{Name: k, Servers: n, MT: true}}
+ ch <- naming.GlobReplyEntry{naming.MountEntry{Name: k, Servers: n, ServesMountTable: true}}
}
}()
return ch, nil
@@ -284,8 +289,8 @@
if neighbor == nil {
return nil, verror.New(naming.ErrNoSuchName, call.Context(), ns.elems[0])
}
- ch := make(chan naming.VDLGlobReply, 1)
- ch <- naming.VDLGlobReplyEntry{naming.VDLMountEntry{Name: "", Servers: neighbor, MT: true}}
+ ch := make(chan naming.GlobReply, 1)
+ ch <- naming.GlobReplyEntry{naming.MountEntry{Name: "", Servers: neighbor, ServesMountTable: true}}
close(ch)
return ch, nil
default:
diff --git a/services/mounttable/lib/neighborhood_test.go b/services/mounttable/lib/neighborhood_test.go
index 71802e2..80e8fe4 100644
--- a/services/mounttable/lib/neighborhood_test.go
+++ b/services/mounttable/lib/neighborhood_test.go
@@ -90,7 +90,7 @@
if cerr != nil {
boom(t, "ResolveStep.StartCall: %s", cerr)
}
- var entry naming.VDLMountEntry
+ var entry naming.MountEntry
if err := call.Finish(&entry); err != nil {
boom(t, "ResolveStep: %s", err)
}
diff --git a/services/mounttable/lib/serverlist.go b/services/mounttable/lib/serverlist.go
index 7da55d5..8ab16c4 100644
--- a/services/mounttable/lib/serverlist.go
+++ b/services/mounttable/lib/serverlist.go
@@ -7,6 +7,7 @@
"v.io/v23/naming"
"v.io/v23/security"
+ vdltime "v.io/v23/vdlroot/time"
)
type serverListClock interface {
@@ -117,15 +118,17 @@
}
// copyToSlice returns the contents of the list as a slice of MountedServer.
-func (sl *serverList) copyToSlice() []naming.VDLMountedServer {
+func (sl *serverList) copyToSlice() []naming.MountedServer {
sl.Lock()
defer sl.Unlock()
- var slice []naming.VDLMountedServer
- now := slc.now()
+ var slice []naming.MountedServer
for e := sl.l.Front(); e != nil; e = e.Next() {
s := e.Value.(*server)
- ttl := uint32(s.expires.Sub(now).Seconds())
- ms := naming.VDLMountedServer{Server: s.oa, BlessingPatterns: s.patterns, TTL: ttl}
+ ms := naming.MountedServer{
+ Server: s.oa,
+ BlessingPatterns: s.patterns,
+ Deadline: vdltime.Deadline{s.expires},
+ }
slice = append(slice, ms)
}
return slice
diff --git a/services/mounttable/lib/serverlist_test.go b/services/mounttable/lib/serverlist_test.go
index 77220b0..2815000 100644
--- a/services/mounttable/lib/serverlist_test.go
+++ b/services/mounttable/lib/serverlist_test.go
@@ -8,8 +8,11 @@
"v.io/v23/naming"
"v.io/v23/security"
+ vdltime "v.io/v23/vdlroot/time"
)
+var now = time.Now()
+
type fakeTime struct {
theTime time.Time
}
@@ -21,7 +24,7 @@
ft.theTime = ft.theTime.Add(d)
}
func NewFakeTimeClock() *fakeTime {
- return &fakeTime{theTime: time.Now()}
+ return &fakeTime{theTime: now}
}
func TestServerList(t *testing.T) {
@@ -57,11 +60,11 @@
}
// Test copyToSlice.
- if got, want := sl.copyToSlice(), []naming.VDLMountedServer{
+ if got, want := sl.copyToSlice(), []naming.MountedServer{
{
Server: "endpoint:dfgsfdg@@",
- TTL: 9,
BlessingPatterns: []string{"ep3"},
+ Deadline: vdltime.Deadline{now.Add(15 * time.Second)},
},
}; !reflect.DeepEqual(got, want) {
t.Errorf("Got %v, want %v", got, want)
diff --git a/services/mounttable/mounttabled/mounttabled_v23_test.go b/services/mounttable/mounttabled/mounttabled_v23_test.go
index ce596a2..acbf578 100644
--- a/services/mounttable/mounttabled/mounttabled_v23_test.go
+++ b/services/mounttable/mounttabled/mounttabled_v23_test.go
@@ -36,7 +36,7 @@
clientBin := binaryWithCredentials(i, "cmd", "v.io/x/ref/cmd/mounttable")
// Get the neighborhood endpoint from the mounttable.
- neighborhoodEndpoint := clientBin.Start("glob", name, "nh").ExpectSetEventuallyRE(`^nh (.*) \(TTL .*\)$`)[0][1]
+ neighborhoodEndpoint := clientBin.Start("glob", name, "nh").ExpectSetEventuallyRE(`^nh (.*) \(Deadline .*\)$`)[0][1]
if err := clientBin.Start("mount", "--blessing_pattern=...", name+"/myself", name, "5m").Wait(os.Stdout, os.Stderr); err != nil {
i.Fatalf("failed to mount the mounttable on itself: %v", err)
@@ -50,9 +50,9 @@
// specified for the mounttable.
glob := clientBin.Start("glob", name, "*")
matches := glob.ExpectSetEventuallyRE(
- `^google /www\.google\.com:80 \(TTL .*\)$`,
- `^myself (.*) \(TTL .*\)$`,
- `^nh `+regexp.QuoteMeta(neighborhoodEndpoint)+` \(TTL .*\)$`)
+ `^google /www\.google\.com:80 \(Deadline .*\)$`,
+ `^myself (.*) \(Deadline .*\)$`,
+ `^nh `+regexp.QuoteMeta(neighborhoodEndpoint)+` \(Deadline .*\)$`)
if matches[1][1] != name {
i.Fatalf("expected 'myself' entry to be %q, but was %q", name, matches[1][1])
}
@@ -60,7 +60,7 @@
// Test globbing on the neighborhood name. Its endpoint should be the
// endpoint of the mount table.
glob = clientBin.Start("glob", "/"+neighborhoodEndpoint, neighborhood)
- matches = glob.ExpectSetEventuallyRE("^" + regexp.QuoteMeta(neighborhood) + ` (.*) \(TTL .*\)$`)
+ matches = glob.ExpectSetEventuallyRE("^" + regexp.QuoteMeta(neighborhood) + ` (.*) \(Deadline .*\)$`)
if matches[0][1] != name {
i.Fatalf("expected endpoint of mount table for name %s", neighborhood)
}
diff --git a/services/wsprd/ipc/server/invoker.go b/services/wsprd/ipc/server/invoker.go
index 2f69c03..7c126f9 100644
--- a/services/wsprd/ipc/server/invoker.go
+++ b/services/wsprd/ipc/server/invoker.go
@@ -84,7 +84,7 @@
return &ipc.GlobState{AllGlobber: i}
}
-func (i *invoker) Glob__(call ipc.ServerCall, pattern string) (<-chan naming.VDLGlobReply, error) {
+func (i *invoker) Glob__(call ipc.ServerCall, pattern string) (<-chan naming.GlobReply, error) {
return i.globFunc(pattern, call)
}
diff --git a/services/wsprd/ipc/server/server.go b/services/wsprd/ipc/server/server.go
index fc57e90..6c29c95 100644
--- a/services/wsprd/ipc/server/server.go
+++ b/services/wsprd/ipc/server/server.go
@@ -201,12 +201,12 @@
}
type globStream struct {
- ch chan naming.VDLGlobReply
+ ch chan naming.GlobReply
ctx *context.T
}
func (g *globStream) Send(item interface{}) error {
- if v, ok := item.(naming.VDLGlobReply); ok {
+ if v, ok := item.(naming.GlobReply); ok {
g.ch <- v
return nil
}
@@ -224,16 +224,16 @@
// remoteGlobFunc is a type of function that can invoke a remote glob and
// communicate the result back via the channel returned
-type remoteGlobFunc func(pattern string, call ipc.ServerCall) (<-chan naming.VDLGlobReply, error)
+type remoteGlobFunc func(pattern string, call ipc.ServerCall) (<-chan naming.GlobReply, error)
func (s *Server) createRemoteGlobFunc(handle int32) remoteGlobFunc {
- return func(pattern string, call ipc.ServerCall) (<-chan naming.VDLGlobReply, error) {
+ return func(pattern string, call ipc.ServerCall) (<-chan naming.GlobReply, error) {
// Until the tests get fixed, we need to create a security context before creating the flow
// because creating the security context creates a flow and flow ids will be off.
// See https://github.com/veyron/release-issues/issues/1181
securityCall := s.convertSecurityCall(call, true)
- globChan := make(chan naming.VDLGlobReply, 1)
+ globChan := make(chan naming.GlobReply, 1)
flow := s.helper.CreateNewFlow(s, &globStream{
ch: globChan,
ctx: call.Context(),
@@ -248,7 +248,7 @@
timeout.Time = deadline
}
- errHandler := func(err error) (<-chan naming.VDLGlobReply, error) {
+ errHandler := func(err error) (<-chan naming.GlobReply, error) {
if ch := s.popServerRequest(flow.ID); ch != nil {
s.helper.CleanupFlow(flow.ID)
}
diff --git a/services/wsprd/namespace/namespace.vdl b/services/wsprd/namespace/namespace.vdl
index 2f5a25f..c5fa68a 100644
--- a/services/wsprd/namespace/namespace.vdl
+++ b/services/wsprd/namespace/namespace.vdl
@@ -13,7 +13,7 @@
type Namespace interface {
// Run a glob query and stream the results.
- Glob(pattern string) stream<_, naming.VDLGlobReply> error
+ Glob(pattern string) stream<_, naming.GlobReply> error
// Mount mounts a server under the given name.
Mount(name, server string, ttl time.Duration, replace bool) error
// Unmount removes an existing mount point.
diff --git a/services/wsprd/namespace/namespace.vdl.go b/services/wsprd/namespace/namespace.vdl.go
index 1c21a1c..1d931a5 100644
--- a/services/wsprd/namespace/namespace.vdl.go
+++ b/services/wsprd/namespace/namespace.vdl.go
@@ -198,7 +198,7 @@
Advance() bool
// Value returns the item that was staged by Advance. May panic if Advance
// returned false or was not called. Never blocks.
- Value() naming.VDLGlobReply
+ Value() naming.GlobReply
// Err returns any error encountered by Advance. Never blocks.
Err() error
}
@@ -222,13 +222,13 @@
type implNamespaceGlobClientCall struct {
ipc.ClientCall
- valRecv naming.VDLGlobReply
+ valRecv naming.GlobReply
errRecv error
}
func (c *implNamespaceGlobClientCall) RecvStream() interface {
Advance() bool
- Value() naming.VDLGlobReply
+ Value() naming.GlobReply
Err() error
} {
return implNamespaceGlobClientCallRecv{c}
@@ -242,7 +242,7 @@
c.c.errRecv = c.c.Recv(&c.c.valRecv)
return c.c.errRecv == nil
}
-func (c implNamespaceGlobClientCallRecv) Value() naming.VDLGlobReply {
+func (c implNamespaceGlobClientCallRecv) Value() naming.GlobReply {
return c.c.valRecv
}
func (c implNamespaceGlobClientCallRecv) Err() error {
@@ -525,7 +525,7 @@
// Send places the item onto the output stream. Returns errors encountered
// while sending. Blocks if there is no buffer space; will unblock when
// buffer space is available.
- Send(item naming.VDLGlobReply) error
+ Send(item naming.GlobReply) error
}
}
@@ -548,7 +548,7 @@
// SendStream returns the send side of the Namespace.Glob server stream.
func (s *NamespaceGlobServerCallStub) SendStream() interface {
- Send(item naming.VDLGlobReply) error
+ Send(item naming.GlobReply) error
} {
return implNamespaceGlobServerCallSend{s}
}
@@ -557,6 +557,6 @@
s *NamespaceGlobServerCallStub
}
-func (s implNamespaceGlobServerCallSend) Send(item naming.VDLGlobReply) error {
+func (s implNamespaceGlobServerCallSend) Send(item naming.GlobReply) error {
return s.s.Send(item)
}
diff --git a/services/wsprd/namespace/request_handler.go b/services/wsprd/namespace/request_handler.go
index 6d6ca60..6a2cea2 100644
--- a/services/wsprd/namespace/request_handler.go
+++ b/services/wsprd/namespace/request_handler.go
@@ -30,12 +30,12 @@
stream := call.SendStream()
for mp := range ch {
- var reply naming.VDLGlobReply
+ var reply naming.GlobReply
switch v := mp.(type) {
case *naming.GlobError:
- reply = naming.VDLGlobReplyError{*v}
+ reply = naming.GlobReplyError{*v}
case *naming.MountEntry:
- reply = naming.VDLGlobReplyEntry{convertToVDLEntry(*v)}
+ reply = naming.GlobReplyEntry{*v}
}
if err = stream.Send(reply); err != nil {
return err
@@ -105,19 +105,3 @@
func (s *Server) Delete(call ipc.ServerCall, name string, deleteSubtree bool) error {
return s.ns.Delete(call.Context(), name, deleteSubtree)
}
-
-func convertToVDLEntry(value naming.MountEntry) naming.VDLMountEntry {
- result := naming.VDLMountEntry{
- Name: value.Name,
- MT: value.ServesMountTable(),
- }
- for _, s := range value.Servers {
- result.Servers = append(result.Servers,
- naming.VDLMountedServer{
- Server: s.Server,
- TTL: uint32(s.Expires.Sub(time.Now())),
- BlessingPatterns: s.BlessingPatterns,
- })
- }
- return result
-}