blob: 8ba407493ea931058a83bbd61f269229390a1f73 [file] [log] [blame]
package impl
import (
"sync"
"veyron2/ipc"
"veyron2/security"
"veyron2/services/mgmt/content"
)
// dispatcher holds the state of the content manager dispatcher.
type dispatcher struct {
root string
depth int
fs sync.Mutex
auth security.Authorizer
}
// newDispatcher is the dispatcher factory.
func NewDispatcher(root string, depth int, authorizer security.Authorizer) *dispatcher {
return &dispatcher{root: root, auth: authorizer}
}
// DISPATCHER INTERFACE IMPLEMENTATION
func (d *dispatcher) Lookup(suffix string) (ipc.Invoker, security.Authorizer, error) {
invoker := ipc.ReflectInvoker(content.NewServerRepository(newInvoker(d.root, d.depth, &d.fs, suffix)))
return invoker, d.auth, nil
}