// Mount is used to expose a logical backend at a given prefix, using a unique salt, // and the barrier view for that path. func (r *Router) Mount(backend logical.Backend, prefix, salt string, view *BarrierView) error { r.l.Lock() defer r.l.Unlock() // Check if this is a nested mount if existing, _, ok := r.root.LongestPrefix(prefix); ok && existing != "" { return fmt.Errorf("cannot mount under existing mount '%s'", existing) } // Build the paths paths := backend.SpecialPaths() if paths == nil { paths = new(logical.Paths) } // Create a mount entry me := &mountEntry{ tainted: false, backend: backend, view: view, rootPaths: pathsToRadix(paths.Root), loginPaths: pathsToRadix(paths.Unauthenticated), } r.root.Insert(prefix, me) return nil }