core: Rename vom2 to vom.

Change-Id: I826c781cb60939d49cc13cca4a4d7a99d3c74730
MultiPart: 1/5
diff --git a/lib/exec/config.go b/lib/exec/config.go
index 71fffd5..0723ebe 100644
--- a/lib/exec/config.go
+++ b/lib/exec/config.go
@@ -4,7 +4,7 @@
 	"sync"
 
 	"v.io/core/veyron2/verror2"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 )
 
 // Config defines a simple key-value configuration.  Keys and values are
@@ -84,7 +84,7 @@
 
 func (c *cfg) Serialize() (string, error) {
 	c.RLock()
-	data, err := vom2.Encode(c.m)
+	data, err := vom.Encode(c.m)
 	c.RUnlock()
 	if err != nil {
 		return "", err
@@ -94,7 +94,7 @@
 
 func (c *cfg) MergeFrom(serialized string) error {
 	var newM map[string]string
-	if err := vom2.Decode([]byte(serialized), &newM); err != nil {
+	if err := vom.Decode([]byte(serialized), &newM); err != nil {
 		return err
 	}
 	c.Lock()
diff --git a/runtimes/google/ipc/client.go b/runtimes/google/ipc/client.go
index 2199a8d..7c59e5d 100644
--- a/runtimes/google/ipc/client.go
+++ b/runtimes/google/ipc/client.go
@@ -21,7 +21,7 @@
 	old_verror "v.io/core/veyron2/verror"
 	verror "v.io/core/veyron2/verror2"
 	"v.io/core/veyron2/vlog"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 	"v.io/core/veyron2/vtrace"
 
 	"v.io/core/veyron/runtimes/google/ipc/stream/vc"
@@ -673,12 +673,12 @@
 // flowClient implements the RPC client-side protocol for a single RPC, over a
 // flow that's already connected to the server.
 type flowClient struct {
-	ctx      *context.T    // context to annotate with call details
-	dec      *vom2.Decoder // to decode responses and results from the server
-	enc      *vom2.Encoder // to encode requests and args to the server
-	server   []string      // Blessings bound to the server that authorize it to receive the IPC request from the client.
-	flow     stream.Flow   // the underlying flow
-	response ipc.Response  // each decoded response message is kept here
+	ctx      *context.T   // context to annotate with call details
+	dec      *vom.Decoder // to decode responses and results from the server
+	enc      *vom.Encoder // to encode requests and args to the server
+	server   []string     // Blessings bound to the server that authorize it to receive the IPC request from the client.
+	flow     stream.Flow  // the underlying flow
+	response ipc.Response // each decoded response message is kept here
 
 	discharges []security.Discharge // discharges used for this request
 	dc         vc.DischargeClient   // client-global discharge-client
@@ -701,11 +701,11 @@
 		dc:     dc,
 	}
 	var err error
-	if fc.enc, err = vom2.NewBinaryEncoder(flow); err != nil {
+	if fc.enc, err = vom.NewBinaryEncoder(flow); err != nil {
 		berr := verror.Make(verror.BadProtocol, fc.ctx, verror.Make(errVomEncoder, fc.ctx, err))
 		return nil, fc.close(berr)
 	}
-	if fc.dec, err = vom2.NewDecoder(flow); err != nil {
+	if fc.dec, err = vom.NewDecoder(flow); err != nil {
 		berr := verror.Make(verror.BadProtocol, fc.ctx, verror.Make(errVomDecoder, fc.ctx, err))
 		return nil, fc.close(berr)
 	}
diff --git a/runtimes/google/ipc/server.go b/runtimes/google/ipc/server.go
index d6df99b..5a473d8 100644
--- a/runtimes/google/ipc/server.go
+++ b/runtimes/google/ipc/server.go
@@ -22,7 +22,7 @@
 	old_verror "v.io/core/veyron2/verror"
 	verror "v.io/core/veyron2/verror2"
 	"v.io/core/veyron2/vlog"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 	"v.io/core/veyron2/vtrace"
 
 	"v.io/core/veyron/lib/netstate"
@@ -799,8 +799,8 @@
 	*context.T
 	server *server        // ipc.Server that this flow server belongs to
 	disp   ipc.Dispatcher // ipc.Dispatcher that will serve RPCs on this flow
-	dec    *vom2.Decoder  // to decode requests and args from the client
-	enc    *vom2.Encoder  // to encode responses and results to the client
+	dec    *vom.Decoder   // to decode requests and args from the client
+	enc    *vom.Encoder   // to encode responses and results to the client
 	flow   stream.Flow    // underlying flow
 
 	// Fields filled in during the server invocation.
@@ -830,11 +830,11 @@
 		discharges: make(map[string]security.Discharge),
 	}
 	var err error
-	if fs.dec, err = vom2.NewDecoder(flow); err != nil {
+	if fs.dec, err = vom.NewDecoder(flow); err != nil {
 		flow.Close()
 		return nil, err
 	}
-	if fs.enc, err = vom2.NewBinaryEncoder(flow); err != nil {
+	if fs.enc, err = vom.NewBinaryEncoder(flow); err != nil {
 		flow.Close()
 		return nil, err
 	}
diff --git a/runtimes/google/ipc/stream/manager/listener.go b/runtimes/google/ipc/stream/manager/listener.go
index b6ed7ad..632a428 100644
--- a/runtimes/google/ipc/stream/manager/listener.go
+++ b/runtimes/google/ipc/stream/manager/listener.go
@@ -17,7 +17,7 @@
 	"v.io/core/veyron2/naming"
 	"v.io/core/veyron2/verror"
 	"v.io/core/veyron2/vlog"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 )
 
 var errListenerIsClosed = errors.New("Listener has been Closed")
@@ -188,7 +188,7 @@
 	}
 	var request proxy.Request
 	var response proxy.Response
-	enc, err := vom2.NewBinaryEncoder(flow)
+	enc, err := vom.NewBinaryEncoder(flow)
 	if err != nil {
 		flow.Close()
 		vf.StopAccepting()
@@ -199,7 +199,7 @@
 		vf.StopAccepting()
 		return nil, nil, fmt.Errorf("failed to encode request to proxy: %v", err)
 	}
-	dec, err := vom2.NewDecoder(flow)
+	dec, err := vom.NewDecoder(flow)
 	if err != nil {
 		flow.Close()
 		vf.StopAccepting()
diff --git a/runtimes/google/ipc/stream/proxy/proxy.go b/runtimes/google/ipc/stream/proxy/proxy.go
index 9ca6b5c..a498b4b 100644
--- a/runtimes/google/ipc/stream/proxy/proxy.go
+++ b/runtimes/google/ipc/stream/proxy/proxy.go
@@ -11,7 +11,7 @@
 	"v.io/core/veyron2/security"
 	"v.io/core/veyron2/verror"
 	"v.io/core/veyron2/vlog"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 
 	"v.io/core/veyron/runtimes/google/ipc/stream/crypto"
 	"v.io/core/veyron/runtimes/google/ipc/stream/id"
@@ -398,7 +398,7 @@
 	server.Process.InitVCI(server.VC.VCI())
 	var request Request
 	var response Response
-	dec, err := vom2.NewDecoder(conn)
+	dec, err := vom.NewDecoder(conn)
 	if err != nil {
 		response.Error = verror.BadProtocolf("proxy: failed to create Decoder: %v", err)
 	} else if err := dec.Decode(&request); err != nil {
@@ -415,7 +415,7 @@
 			response.Endpoint = ep.String()
 		}
 	}
-	enc, err := vom2.NewBinaryEncoder(conn)
+	enc, err := vom.NewBinaryEncoder(conn)
 	if err != nil {
 		proxyLog().Infof("Failed to create Encoder for server %v: %v", server, err)
 		server.Close(err)
diff --git a/runtimes/google/ipc/stream/vc/auth.go b/runtimes/google/ipc/stream/vc/auth.go
index 7cfbeee..2073d10 100644
--- a/runtimes/google/ipc/stream/vc/auth.go
+++ b/runtimes/google/ipc/stream/vc/auth.go
@@ -12,7 +12,7 @@
 	"v.io/core/veyron2/context"
 	"v.io/core/veyron2/ipc/version"
 	"v.io/core/veyron2/security"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 )
 
 var (
@@ -94,7 +94,7 @@
 		return err
 	}
 	var buf bytes.Buffer
-	enc, err := vom2.NewBinaryEncoder(&buf)
+	enc, err := vom.NewBinaryEncoder(&buf)
 	if err != nil {
 		return err
 	}
@@ -114,7 +114,7 @@
 		return err
 	}
 	defer msg.Release()
-	enc, err = vom2.NewBinaryEncoder(w)
+	enc, err = vom.NewBinaryEncoder(w)
 	if err != nil {
 		return err
 	}
@@ -123,7 +123,7 @@
 
 func readBlessings(r io.Reader, tag []byte, crypter crypto.Crypter, v version.IPCVersion) (blessings security.Blessings, discharges map[string]security.Discharge, err error) {
 	var msg []byte
-	dec, err := vom2.NewDecoder(r)
+	dec, err := vom.NewDecoder(r)
 	if err != nil {
 		return nil, nil, fmt.Errorf("failed to create new decoder: %v", err)
 	}
@@ -135,7 +135,7 @@
 		return
 	}
 	defer buf.Release()
-	dec, err = vom2.NewDecoder(bytes.NewReader(buf.Contents))
+	dec, err = vom.NewDecoder(bytes.NewReader(buf.Contents))
 	if err != nil {
 		return nil, nil, fmt.Errorf("failed to create new decoder: %v", err)
 	}
diff --git a/runtimes/google/testing/mocks/ipc/simple_client.go b/runtimes/google/testing/mocks/ipc/simple_client.go
index d90ccd7..e9ce243 100644
--- a/runtimes/google/testing/mocks/ipc/simple_client.go
+++ b/runtimes/google/testing/mocks/ipc/simple_client.go
@@ -10,7 +10,7 @@
 	"v.io/core/veyron2/security"
 	"v.io/core/veyron2/vdl/valconv"
 	"v.io/core/veyron2/vlog"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 )
 
 // NewSimpleClient creates a new mocked ipc client where the given map of method name
@@ -56,12 +56,12 @@
 	// This must be done via vom encode and decode rather than a direct deep copy because (among other reasons)
 	// reflect-based deep copy on vdl.Type objects will fail because of their private fields. This is not a problem with vom
 	// as it manually creates the type objects. It is also more realistic to use the same mechanism as the ultimate calls.
-	vomBytes, err := vom2.Encode(results)
+	vomBytes, err := vom.Encode(results)
 	if err != nil {
 		panic(fmt.Sprintf("Error copying value with vom (failed on encode): %v", err))
 	}
 	var copiedResults []interface{}
-	if err := vom2.Decode(vomBytes, &copiedResults); err != nil {
+	if err := vom.Decode(vomBytes, &copiedResults); err != nil {
 		panic(fmt.Sprintf("Error copying value with vom (failed on decode): %v", err))
 	}
 
diff --git a/security/serialization/signing_writer.go b/security/serialization/signing_writer.go
index a13aec8..0eeeee0 100644
--- a/security/serialization/signing_writer.go
+++ b/security/serialization/signing_writer.go
@@ -9,7 +9,7 @@
 	"io"
 
 	"v.io/core/veyron2/security"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 )
 
 const defaultChunkSizeBytes = 1 << 20
@@ -23,7 +23,7 @@
 	chunkSizeBytes int64
 	curChunk       bytes.Buffer
 	signatureHash  hash.Hash
-	sigEnc         *vom2.Encoder
+	sigEnc         *vom.Encoder
 }
 
 func (w *signingWriter) Write(p []byte) (int, error) {
@@ -88,7 +88,7 @@
 	if (data == nil) || (signature == nil) || (s == nil) {
 		return nil, fmt.Errorf("data:%v signature:%v signer:%v cannot be nil", data, signature, s)
 	}
-	enc, err := vom2.NewBinaryEncoder(signature)
+	enc, err := vom.NewBinaryEncoder(signature)
 	if err != nil {
 		return nil, fmt.Errorf("failed to create new encoder: %v", err)
 	}
diff --git a/security/serialization/verifying_reader.go b/security/serialization/verifying_reader.go
index 5da2ab2..0ec5853 100644
--- a/security/serialization/verifying_reader.go
+++ b/security/serialization/verifying_reader.go
@@ -9,7 +9,7 @@
 	"io"
 
 	"v.io/core/veyron2/security"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 )
 
 // verifyingReader implements io.Reader.
@@ -77,7 +77,7 @@
 
 func (r *verifyingReader) verifySignature(signature io.Reader, key security.PublicKey) error {
 	signatureHash := sha256.New()
-	dec, err := vom2.NewDecoder(signature)
+	dec, err := vom.NewDecoder(signature)
 	if err != nil {
 		return fmt.Errorf("failed to create new decoder: %v", err)
 	}
diff --git a/security/storage.go b/security/storage.go
index c37945f..7afc1f2 100644
--- a/security/storage.go
+++ b/security/storage.go
@@ -6,7 +6,7 @@
 
 	"v.io/core/veyron/security/serialization"
 	"v.io/core/veyron2/security"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 )
 
 func encodeAndStore(obj interface{}, data, signature io.WriteCloser, signer serialization.Signer) error {
@@ -17,7 +17,7 @@
 	if err != nil {
 		return err
 	}
-	enc, err := vom2.NewBinaryEncoder(swc)
+	enc, err := vom.NewBinaryEncoder(swc)
 	if err != nil {
 		swc.Close()
 		return err
@@ -39,7 +39,7 @@
 	if err != nil {
 		return err
 	}
-	dec, err := vom2.NewDecoder(vr)
+	dec, err := vom.NewDecoder(vr)
 	if err != nil {
 		return err
 	}
diff --git a/security/util.go b/security/util.go
index 40e37b6..75e5757 100644
--- a/security/util.go
+++ b/security/util.go
@@ -12,7 +12,7 @@
 	"io/ioutil"
 
 	"v.io/core/veyron2/security"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 )
 
 const ecPrivateKeyPEMType = "EC PRIVATE KEY"
@@ -99,7 +99,7 @@
 	var tpCaveats []security.ThirdPartyCaveat
 	for _, c := range caveats {
 		var t security.ThirdPartyCaveat
-		if err := vom2.Decode(c.ValidatorVOM, &t); err != nil {
+		if err := vom.Decode(c.ValidatorVOM, &t); err != nil {
 			continue
 		}
 		tpCaveats = append(tpCaveats, t)
diff --git a/services/identity/auditor/blessing_auditor.go b/services/identity/auditor/blessing_auditor.go
index 4463772..071ca25 100644
--- a/services/identity/auditor/blessing_auditor.go
+++ b/services/identity/auditor/blessing_auditor.go
@@ -9,7 +9,7 @@
 	vsecurity "v.io/core/veyron/security"
 	"v.io/core/veyron/security/audit"
 	"v.io/core/veyron2/security"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 )
 
 // BlessingLogReader provides the Read method to read audit logs.
@@ -93,10 +93,10 @@
 		return d, fmt.Errorf("failed to extract result blessing")
 	}
 	var err error
-	if d.blessings, err = vom2.Encode(security.MarshalBlessings(blessings)); err != nil {
+	if d.blessings, err = vom.Encode(security.MarshalBlessings(blessings)); err != nil {
 		return d, err
 	}
-	if d.caveats, err = vom2.Encode(caveats); err != nil {
+	if d.caveats, err = vom.Encode(caveats); err != nil {
 		return d, err
 	}
 	return d, nil
@@ -112,13 +112,13 @@
 	}
 	var wireBlessings security.WireBlessings
 	var err error
-	if err = vom2.Decode(dbentry.blessings, &wireBlessings); err != nil {
+	if err = vom.Decode(dbentry.blessings, &wireBlessings); err != nil {
 		return BlessingEntry{DecodeError: fmt.Errorf("failed to decode blessings: %s", err)}
 	}
 	if b.Blessings, err = security.NewBlessings(wireBlessings); err != nil {
 		return BlessingEntry{DecodeError: fmt.Errorf("failed to construct blessings: %s", err)}
 	}
-	if err = vom2.Decode(dbentry.caveats, &b.Caveats); err != nil {
+	if err = vom.Decode(dbentry.caveats, &b.Caveats); err != nil {
 		return BlessingEntry{DecodeError: fmt.Errorf("failed to decode caveats: %s", err)}
 	}
 	b.RevocationCaveatID = revocationCaveatID(b.Caveats)
diff --git a/services/identity/blesser/macaroon.go b/services/identity/blesser/macaroon.go
index 259aafe..e7a85be 100644
--- a/services/identity/blesser/macaroon.go
+++ b/services/identity/blesser/macaroon.go
@@ -10,7 +10,7 @@
 
 	"v.io/core/veyron2/ipc"
 	"v.io/core/veyron2/security"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 )
 
 type macaroonBlesser struct {
@@ -30,7 +30,7 @@
 		return empty, err
 	}
 	var m oauth.BlessingMacaroon
-	if err := vom2.Decode(inputs, &m); err != nil {
+	if err := vom.Decode(inputs, &m); err != nil {
 		return empty, err
 	}
 	if time.Now().After(m.Creation.Add(time.Minute * 5)) {
diff --git a/services/identity/blesser/macaroon_test.go b/services/identity/blesser/macaroon_test.go
index 9fa1923..910aa66 100644
--- a/services/identity/blesser/macaroon_test.go
+++ b/services/identity/blesser/macaroon_test.go
@@ -10,7 +10,7 @@
 	"v.io/core/veyron/services/identity/util"
 
 	"v.io/core/veyron2/security"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 )
 
 func TestMacaroonBlesser(t *testing.T) {
@@ -67,7 +67,7 @@
 }
 
 func newMacaroon(t *testing.T, key []byte, m oauth.BlessingMacaroon) string {
-	encMac, err := vom2.Encode(m)
+	encMac, err := vom.Encode(m)
 	if err != nil {
 		t.Fatal(err)
 	}
diff --git a/services/identity/oauth/handler.go b/services/identity/oauth/handler.go
index b8170f5..e341a93 100644
--- a/services/identity/oauth/handler.go
+++ b/services/identity/oauth/handler.go
@@ -36,7 +36,7 @@
 	"v.io/core/veyron/services/identity/util"
 	"v.io/core/veyron2/security"
 	"v.io/core/veyron2/vlog"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 )
 
 const (
@@ -368,7 +368,7 @@
 		Caveats:  caveats,
 		Name:     name,
 	}
-	macBytes, err := vom2.Encode(m)
+	macBytes, err := vom.Encode(m)
 	if err != nil {
 		util.HTTPServerError(w, fmt.Errorf("failed to encode BlessingsMacaroon: %v", err))
 		return
diff --git a/services/identity/revocation/revocation_test.go b/services/identity/revocation/revocation_test.go
index 49b37d9..0283459 100644
--- a/services/identity/revocation/revocation_test.go
+++ b/services/identity/revocation/revocation_test.go
@@ -11,7 +11,7 @@
 	"v.io/core/veyron2/context"
 	"v.io/core/veyron2/rt"
 	"v.io/core/veyron2/security"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 )
 
 func revokerSetup(t *testing.T, ctx *context.T) (dischargerKey security.PublicKey, dischargerEndpoint string, revoker RevocationManager, closeFunc func()) {
@@ -53,7 +53,7 @@
 		t.Fatalf("failed to create revocation caveat: %s", err)
 	}
 	var cav security.ThirdPartyCaveat
-	if err := vom2.Decode(caveat.ValidatorVOM, &cav); err != nil {
+	if err := vom.Decode(caveat.ValidatorVOM, &cav); err != nil {
 		t.Fatalf("failed to create decode tp caveat: %s", err)
 	}
 
diff --git a/services/identity/util/csrf.go b/services/identity/util/csrf.go
index 8ed71e4..1b7c49a 100644
--- a/services/identity/util/csrf.go
+++ b/services/identity/util/csrf.go
@@ -10,7 +10,7 @@
 	"time"
 
 	"v.io/core/veyron2/vlog"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 )
 
 const (
@@ -48,7 +48,7 @@
 	}
 	var encData []byte
 	if data != nil {
-		if encData, err = vom2.Encode(data); err != nil {
+		if encData, err = vom.Encode(data); err != nil {
 			return "", err
 		}
 	}
@@ -73,7 +73,7 @@
 		return err
 	}
 	if decoded != nil {
-		if err := vom2.Decode(encodedInput, decoded); err != nil {
+		if err := vom.Decode(encodedInput, decoded); err != nil {
 			return fmt.Errorf("invalid token data: %v", err)
 		}
 	}
diff --git a/services/mgmt/application/impl/acl_test.go b/services/mgmt/application/impl/acl_test.go
index 1f682a0..40d432b 100644
--- a/services/mgmt/application/impl/acl_test.go
+++ b/services/mgmt/application/impl/acl_test.go
@@ -37,7 +37,7 @@
 var globalCancel context.CancelFunc
 
 func init() {
-	// TODO(rjkroege): Remove when vom2 is ready.
+	// TODO(rjkroege): Remove when vom is ready.
 	vdlutil.Register(&naming.VDLMountedServer{})
 
 	modules.RegisterChild(repoCmd, "", appRepository)
diff --git a/services/mgmt/device/impl/impl_test.go b/services/mgmt/device/impl/impl_test.go
index 0e52bd3..99b86c4 100644
--- a/services/mgmt/device/impl/impl_test.go
+++ b/services/mgmt/device/impl/impl_test.go
@@ -77,7 +77,7 @@
 	// need to ensure it's defined.
 	flag.String("name", "", "")
 
-	// TODO(rthellend): Remove when vom2 is ready.
+	// TODO(rthellend): Remove when vom is ready.
 	vdlutil.Register(&naming.VDLMountedServer{})
 
 	modules.RegisterChild(execScriptCmd, "", execScript)
diff --git a/tools/principal/main.go b/tools/principal/main.go
index 654b897..bb2debd 100644
--- a/tools/principal/main.go
+++ b/tools/principal/main.go
@@ -20,7 +20,7 @@
 	"v.io/core/veyron2/ipc"
 	"v.io/core/veyron2/rt"
 	"v.io/core/veyron2/security"
-	"v.io/core/veyron2/vom2"
+	"v.io/core/veyron2/vom"
 	"v.io/lib/cmdline"
 )
 
@@ -849,7 +849,7 @@
 func base64VomEncode(i interface{}) (string, error) {
 	buf := &bytes.Buffer{}
 	closer := base64.NewEncoder(base64.URLEncoding, buf)
-	enc, err := vom2.NewBinaryEncoder(closer)
+	enc, err := vom.NewBinaryEncoder(closer)
 	if err != nil {
 		return "", err
 	}
@@ -869,7 +869,7 @@
 	if err != nil {
 		return err
 	}
-	dec, err := vom2.NewDecoder(bytes.NewBuffer(b))
+	dec, err := vom.NewDecoder(bytes.NewBuffer(b))
 	if err != nil {
 		return err
 	}