nmespace: added ShallowResolve
MultiPart: 2/4
Change-Id: I33b157e1266279427bd3253e66d8922003bb0c1b
diff --git a/namespace/.api b/namespace/.api
index b352b83..3995408 100644
--- a/namespace/.api
+++ b/namespace/.api
@@ -1,4 +1,4 @@
-pkg namespace, type T interface { CacheCtl, Delete, FlushCacheEntry, GetPermissions, Glob, Mount, Resolve, ResolveToMountTable, Roots, SetPermissions, SetRoots, Unmount }
+pkg namespace, type T interface { CacheCtl, Delete, FlushCacheEntry, GetPermissions, Glob, Mount, Resolve, ResolveToMountTable, Roots, SetPermissions, SetRoots, ShallowResolve, Unmount }
pkg namespace, type T interface, CacheCtl(...naming.CacheCtl) []naming.CacheCtl
pkg namespace, type T interface, Delete(*context.T, string, bool, ...naming.NamespaceOpt) error
pkg namespace, type T interface, FlushCacheEntry(*context.T, string) bool
@@ -10,4 +10,5 @@
pkg namespace, type T interface, Roots() []string
pkg namespace, type T interface, SetPermissions(*context.T, string, access.Permissions, string, ...naming.NamespaceOpt) error
pkg namespace, type T interface, SetRoots(...string) error
+pkg namespace, type T interface, ShallowResolve(*context.T, string, ...naming.NamespaceOpt) (*naming.MountEntry, error)
pkg namespace, type T interface, Unmount(*context.T, string, string, ...naming.NamespaceOpt) error
diff --git a/namespace/model.go b/namespace/model.go
index 83cea38..1c19a9c 100644
--- a/namespace/model.go
+++ b/namespace/model.go
@@ -36,6 +36,13 @@
// directly responsible for the name.
ResolveToMountTable(ctx *context.T, name string, opts ...naming.NamespaceOpt) (entry *naming.MountEntry, err error)
+ // ShallowResolve resolves the object name into its mounted servers. It is the same
+ // as Resolve except when mounttables are stacked below the same mount point. For example,
+ // if service D is mounted onto /MTA/a/b and /MTA/a/b is mounted onto /MTB/x/y then
+ // Resolve(/MTB/x/y) will return a pointer to D while ShallowResolve(/MTB/x/y) will
+ // return a pointer to /MTA/a/b.
+ ShallowResolve(ctx *context.T, name string, opts ...naming.NamespaceOpt) (entry *naming.MountEntry, err error)
+
// FlushCacheEntry flushes resolution information cached for the name. If
// anything was flushed it returns true.
FlushCacheEntry(ctx *context.T, name string) bool