veyron/services/mgmt,veyron2/watch: removing superfluous store
dependencies and moving the watch types that depend on query into the
roadmap store repository

Change-Id: Ief6756b847f804f2f5d1ddfe7b22711a9b8c721a
diff --git a/services/mgmt/application/applicationd/main.go b/services/mgmt/application/applicationd/main.go
index 425eb92..ed7c519 100644
--- a/services/mgmt/application/applicationd/main.go
+++ b/services/mgmt/application/applicationd/main.go
@@ -5,8 +5,8 @@
 
 	"veyron/lib/signals"
 	vflag "veyron/security/flag"
-
 	"veyron/services/mgmt/application/impl"
+
 	"veyron2/rt"
 	"veyron2/vlog"
 )
@@ -17,14 +17,14 @@
 	protocol = flag.String("protocol", "tcp", "protocol to listen on")
 	address  = flag.String("address", ":0", "address to listen on")
 
-	name      = flag.String("name", "", "name to mount the application repository as")
-	storeName = flag.String("store", "", "object name of the application repository store")
+	name  = flag.String("name", "", "name to mount the application repository as")
+	store = flag.String("store", "", "local directory to store application envelopes in")
 )
 
 func main() {
 	flag.Parse()
-	if *storeName == "" {
-		vlog.Fatalf("Specify a store using --store=<name>")
+	if *store == "" {
+		vlog.Fatalf("Specify a directory for storing application envelopes using --store=<name>")
 	}
 	runtime := rt.Init()
 	defer runtime.Cleanup()
@@ -34,10 +34,11 @@
 	}
 	defer server.Stop()
 
-	dispatcher, err := impl.NewDispatcher(*storeName, vflag.NewAuthorizerOrDie())
+	dispatcher, err := impl.NewDispatcher(*store, vflag.NewAuthorizerOrDie())
 	if err != nil {
 		vlog.Fatalf("NewDispatcher() failed: %v", err)
 	}
+
 	endpoint, err := server.Listen(*protocol, *address)
 	if err != nil {
 		vlog.Fatalf("Listen(%v, %v) failed: %v", *protocol, *address, err)
diff --git a/services/mgmt/application/applicationd/test.sh b/services/mgmt/application/applicationd/test.sh
index e73fcd6..3f7206a 100755
--- a/services/mgmt/application/applicationd/test.sh
+++ b/services/mgmt/application/applicationd/test.sh
@@ -11,7 +11,6 @@
 build() {
   local -r GO="${REPO_ROOT}/scripts/build/go"
   "${GO}" build veyron/services/mgmt/application/applicationd || shell_test::fail "line ${LINENO}: failed to build 'applicationd'"
-  "${GO}" build veyron.io/store/veyron/services/store/stored || shell_test::fail "line ${LINENO}: failed to build 'stored'"
   "${GO}" build veyron/tools/application || shell_test::fail "line ${LINENO}: failed to build 'application'"
 }
 
@@ -21,14 +20,10 @@
 
   shell_test::setup_server_test
 
-  # Start the store daemon.
-  local -r DB_DIR=$(shell::tmp_dir)
-  local -r STORE="application-test-store"
-  shell_test::start_server ./stored --name="${STORE}" --address=127.0.0.1:0 --db="${DB_DIR}"
-
   # Start the application repository daemon.
   local -r REPO="applicationd-test-repo"
-  shell_test::start_server ./applicationd --name="${REPO}" --address=127.0.0.1:0 --store="${STORE}" -logtostderr
+  local -r STORE=$(shell::tmp_dir)
+  shell_test::start_server ./applicationd --name="${REPO}" --store="${STORE}" --address=127.0.0.1:0 -logtostderr
 
   # Create an application envelope.
   local -r APPLICATION="${REPO}/test-application/v1"
diff --git a/services/mgmt/application/impl/impl_test.go b/services/mgmt/application/impl/impl_test.go
index eb228eb..9f1adcd 100644
--- a/services/mgmt/application/impl/impl_test.go
+++ b/services/mgmt/application/impl/impl_test.go
@@ -1,10 +1,10 @@
 package impl
 
 import (
+	"io/ioutil"
 	"reflect"
 	"testing"
 
-	"veyron.io/store/veyron/services/store/testutil"
 	"veyron/services/mgmt/repository"
 
 	"veyron2/naming"
@@ -26,15 +26,15 @@
 	}
 	defer server.Stop()
 
-	// Setup and start a store server.
-	store, cleanup := testutil.NewStore(t, server, runtime.Identity().PublicID())
-	defer cleanup()
-
 	server, err = runtime.NewServer()
 	if err != nil {
 		t.Fatalf("NewServer() failed: %v", err)
 	}
-
+	dir, prefix := "", ""
+	store, err := ioutil.TempDir(dir, prefix)
+	if err != nil {
+		t.Fatalf("TempDir(%q, %q) failed: %v", dir, prefix, err)
+	}
 	dispatcher, err := NewDispatcher(store, nil)
 	if err != nil {
 		t.Fatalf("NewDispatcher() failed: %v", err)
diff --git a/services/mgmt/application/impl/invoker.go b/services/mgmt/application/impl/invoker.go
index b79b136..f3f1ec6 100644
--- a/services/mgmt/application/impl/invoker.go
+++ b/services/mgmt/application/impl/invoker.go
@@ -4,7 +4,6 @@
 	"errors"
 	"strings"
 
-	_ "veyron.io/store/veyron/services/store/typeregistryhack"
 	"veyron/services/mgmt/lib/fs"
 	"veyron2/ipc"
 	"veyron2/naming"
@@ -18,7 +17,6 @@
 	// metadata.
 	// All Invokers share a single dispatcher's Memstore.
 	store *fs.Memstore
-
 	// storeRoot is a name in the Store under which all data will be stored.
 	storeRoot string
 	// suffix is the suffix of the current invocation that is assumed to
diff --git a/services/mgmt/profile/impl/impl_test.go b/services/mgmt/profile/impl/impl_test.go
index 44e17e4..0343d7a 100644
--- a/services/mgmt/profile/impl/impl_test.go
+++ b/services/mgmt/profile/impl/impl_test.go
@@ -1,10 +1,10 @@
 package impl
 
 import (
+	"io/ioutil"
 	"reflect"
 	"testing"
 
-	"veyron.io/store/veyron/services/store/testutil"
 	"veyron/services/mgmt/profile"
 	"veyron/services/mgmt/repository"
 
@@ -40,17 +40,17 @@
 	}
 	defer server.Stop()
 
-	// Setup and start a store server.
-	mountPoint, cleanup := testutil.NewStore(t, server, runtime.Identity().PublicID())
-	defer cleanup()
-
 	// Setup and start the profile server.
 	server, err = runtime.NewServer()
 	if err != nil {
 		t.Fatalf("NewServer() failed: %v", err)
 	}
-
-	dispatcher, err := NewDispatcher(mountPoint, nil)
+	dir, prefix := "", ""
+	store, err := ioutil.TempDir(dir, prefix)
+	if err != nil {
+		t.Fatalf("TempDir(%q, %q) failed: %v", dir, prefix, err)
+	}
+	dispatcher, err := NewDispatcher(store, nil)
 	if err != nil {
 		t.Fatalf("NewDispatcher() failed: %v", err)
 	}
diff --git a/services/mgmt/profile/impl/invoker.go b/services/mgmt/profile/impl/invoker.go
index cf79341..2beeb43 100644
--- a/services/mgmt/profile/impl/invoker.go
+++ b/services/mgmt/profile/impl/invoker.go
@@ -5,7 +5,6 @@
 
 	"veyron/services/mgmt/lib/fs"
 	"veyron/services/mgmt/profile"
-	//	_ "veyron.io/store/veyron/services/store/typeregistryhack"
 
 	"veyron2/ipc"
 	"veyron2/naming"
diff --git a/services/mgmt/profile/profiled/main.go b/services/mgmt/profile/profiled/main.go
index 93321d2..7b36c36 100644
--- a/services/mgmt/profile/profiled/main.go
+++ b/services/mgmt/profile/profiled/main.go
@@ -17,14 +17,14 @@
 	protocol = flag.String("protocol", "tcp", "protocol to listen on")
 	address  = flag.String("address", ":0", "address to listen on")
 
-	name      = flag.String("name", "", "name to mount the profile repository as")
-	storeName = flag.String("store", "", "object name of the profile repository store")
+	name  = flag.String("name", "", "name to mount the profile repository as")
+	store = flag.String("store", "", "local directory to store profiles in")
 )
 
 func main() {
 	flag.Parse()
-	if *storeName == "" {
-		vlog.Fatalf("Specify a store using --store=<name>")
+	if *store == "" {
+		vlog.Fatalf("Specify a directory for storing profiles using --store=<name>")
 	}
 	runtime := rt.Init()
 	defer runtime.Cleanup()
@@ -33,7 +33,8 @@
 		vlog.Fatalf("NewServer() failed: %v", err)
 	}
 	defer server.Stop()
-	dispatcher, err := impl.NewDispatcher(*storeName, vflag.NewAuthorizerOrDie())
+
+	dispatcher, err := impl.NewDispatcher(*store, vflag.NewAuthorizerOrDie())
 	if err != nil {
 		vlog.Fatalf("NewDispatcher() failed: %v", err)
 	}
diff --git a/services/mgmt/profile/profiled/test.sh b/services/mgmt/profile/profiled/test.sh
index 31fd7e5..d7a2af5 100755
--- a/services/mgmt/profile/profiled/test.sh
+++ b/services/mgmt/profile/profiled/test.sh
@@ -12,7 +12,6 @@
 build() {
   local -r GO="${REPO_ROOT}/scripts/build/go"
   "${GO}" build veyron/services/mgmt/profile/profiled || shell_test::fail "line ${LINENO}: failed to build 'profiled'"
-  "${GO}" build veyron.io/store/veyron/services/store/stored || shell_test::fail "line ${LINENO}: failed to build 'stored'"
   "${GO}" build veyron/tools/profile || shell_test::fail "line ${LINENO}: failed to build 'profile'"
 }
 
@@ -22,13 +21,9 @@
 
   shell_test::setup_server_test
 
-  # Start the store daemon.
-  local -r DB_DIR=$(shell::tmp_dir)
-  local -r STORE="profile-test-store"
-  shell_test::start_server ./stored --name="${STORE}" --address=127.0.0.1:0 --db="${DB_DIR}"
-
   # Start the profile repository daemon.
   local -r REPO="profiled-test-repo"
+  local -r STORE=$(shell:tmp_dir)
   shell_test::start_server ./profiled --name="${REPO}" --address=127.0.0.1:0 --store="${STORE}"
 
   # Create a profile.
diff --git a/services/wsprd/lib/remove_this.go b/services/wsprd/lib/remove_this.go
index cd02607..677497c 100644
--- a/services/wsprd/lib/remove_this.go
+++ b/services/wsprd/lib/remove_this.go
@@ -2,6 +2,7 @@
 
 import (
 	"veyron.io/store/veyron2/services/store"
+	roadmap_watchtypes "veyron.io/store/veyron2/services/watch/types"
 	"veyron.io/store/veyron2/storage"
 	rps "veyron/examples/rockpaperscissors"
 	mttypes "veyron2/services/mounttable/types"
@@ -16,8 +17,8 @@
 	vom.Register(store.NestedResult(0))
 	vom.Register(store.QueryResult{})
 	vom.Register(watchtypes.GlobRequest{})
-	vom.Register(watchtypes.QueryRequest{})
 	vom.Register(watchtypes.Change{})
+	vom.Register(roadmap_watchtypes.QueryRequest{})
 	vom.Register(rps.GameOptions{})
 	vom.Register(rps.GameID{})
 	vom.Register(rps.PlayResult{})