veyron/services/mgmt/device: Add local namespace
This change adds a local mounttable and neighborhood service to the
device manager. The applications receive the address of this mounttable
as default namespace root.
The local namespace looks like:
<root>/devmgr -> device manager server
<root>/global -> the global namespace
<root>/nh -> the local neighborhood
Each app gets the local namespace as namespace root, and the local
mounttable is the only thing that gets published directly in the global
namespace.
The global namespace looks like:
<root>/devices/<hostname>/devmgr -> <hostname>'s device manager
<root>/devices/<hostname>/global -> points back to <root>
<root>/devices/<hostname>/nh -> <hostname>'s local neighborhood
Change-Id: I2b816acd3e3513bd6f82e3b818a6b72cd4d15128
diff --git a/services/mgmt/device/impl/dispatcher.go b/services/mgmt/device/impl/dispatcher.go
index 7dc317e..a26933e 100644
--- a/services/mgmt/device/impl/dispatcher.go
+++ b/services/mgmt/device/impl/dispatcher.go
@@ -50,6 +50,8 @@
uat BlessingSystemAssociationStore
locks *acls.Locks
principal security.Principal
+ // Namespace
+ mtAddress string // The address of the local mounttable.
}
var _ ipc.Dispatcher = (*dispatcher)(nil)
@@ -73,7 +75,7 @@
)
// NewDispatcher is the device manager dispatcher factory.
-func NewDispatcher(principal security.Principal, config *config.State, testMode bool, restartHandler func()) (ipc.Dispatcher, error) {
+func NewDispatcher(principal security.Principal, config *config.State, mtAddress string, testMode bool, restartHandler func()) (ipc.Dispatcher, error) {
if err := config.Validate(); err != nil {
return nil, fmt.Errorf("invalid config %v: %v", config, err)
}
@@ -91,6 +93,7 @@
if err != nil {
return nil, fmt.Errorf("cannot create persistent store for identity to system account associations: %v", err)
}
+
d := &dispatcher{
internal: &internalState{
callback: newCallbackState(config.Name),
@@ -102,6 +105,7 @@
uat: uat,
locks: acls.NewLocks(),
principal: principal,
+ mtAddress: mtAddress,
}
tam, err := flag.TaggedACLMapFromFlag()
@@ -275,6 +279,7 @@
uat: d.uat,
locks: d.locks,
securityAgent: d.internal.securityAgent,
+ mtAddress: d.mtAddress,
})
appSpecificAuthorizer, err := newAppSpecificAuthorizer(auth, d.config, components[1:])
if err != nil {