veyron/runtimes/google: log injection
Interface packages are "ipc" and "naming".
Implementation packages are all of veyron/runtimes/google excluding
ipc/benchmarks
vtrace
Command line:
vloggy inject -interface veyron.io/veyron/veyron2/naming,veyron.io/veyron/veyron2/ipc \
veyron.io/veyron/veyron/runtimes/google/appcycle \
veyron.io/veyron/veyron/runtimes/google/ipc \
veyron.io/veyron/veyron/runtimes/google/ipc/stream \
veyron.io/veyron/veyron/runtimes/google/ipc/stream/benchmark \
veyron.io/veyron/veyron/runtimes/google/ipc/stream/crypto \
veyron.io/veyron/veyron/runtimes/google/ipc/stream/crypto/tlsfork \
veyron.io/veyron/veyron/runtimes/google/ipc/stream/id \
veyron.io/veyron/veyron/runtimes/google/ipc/stream/manager \
veyron.io/veyron/veyron/runtimes/google/ipc/stream/message \
veyron.io/veyron/veyron/runtimes/google/ipc/stream/proxy \
veyron.io/veyron/veyron/runtimes/google/ipc/stream/vc \
veyron.io/veyron/veyron/runtimes/google/ipc/stream/vif \
veyron.io/veyron/veyron/runtimes/google/ipc/version \
veyron.io/veyron/veyron/runtimes/google/lib/bqueue \
veyron.io/veyron/veyron/runtimes/google/lib/bqueue/drrqueue \
veyron.io/veyron/veyron/runtimes/google/lib/deque \
veyron.io/veyron/veyron/runtimes/google/lib/follow \
veyron.io/veyron/veyron/runtimes/google/lib/functional \
veyron.io/veyron/veyron/runtimes/google/lib/functional/op \
veyron.io/veyron/veyron/runtimes/google/lib/functional/rb \
veyron.io/veyron/veyron/runtimes/google/lib/iobuf \
veyron.io/veyron/veyron/runtimes/google/lib/lru \
veyron.io/veyron/veyron/runtimes/google/lib/pcqueue \
veyron.io/veyron/veyron/runtimes/google/lib/publisher \
veyron.io/veyron/veyron/runtimes/google/lib/reflectutil \
veyron.io/veyron/veyron/runtimes/google/lib/sync \
veyron.io/veyron/veyron/runtimes/google/lib/timekeeper \
veyron.io/veyron/veyron/runtimes/google/lib/upcqueue \
veyron.io/veyron/veyron/runtimes/google/naming \
veyron.io/veyron/veyron/runtimes/google/naming/namespace \
veyron.io/veyron/veyron/runtimes/google/rt \
veyron.io/veyron/veyron/runtimes/google/security \
veyron.io/veyron/veyron/runtimes/google/security/keys \
veyron.io/veyron/veyron/runtimes/google/testing/concurrency \
veyron.io/veyron/veyron/runtimes/google/testing/concurrency/sync \
veyron.io/veyron/veyron/runtimes/google/testing/mocks/ipc \
veyron.io/veyron/veyron/runtimes/google/testing/mocks/naming
Change-Id: I901131ebdc442b7e5d05f0e29d925cadc1215956
diff --git a/runtimes/google/ipc/client.go b/runtimes/google/ipc/client.go
index 7cee2e7..5511c15 100644
--- a/runtimes/google/ipc/client.go
+++ b/runtimes/google/ipc/client.go
@@ -159,6 +159,7 @@
}
func (c *client) StartCall(ctx context.T, name, method string, args []interface{}, opts ...ipc.CallOpt) (ipc.Call, error) {
+ defer vlog.LogCall()()
var retry = true
deadline, hasDeadline := ctx.Deadline()
if !hasDeadline {
@@ -302,6 +303,7 @@
}
func (c *client) Close() {
+ defer vlog.LogCall()()
c.vcMapMu.Lock()
for _, v := range c.vcMap {
c.streamMgr.ShutdownEndpoint(v.remoteEP)
@@ -311,7 +313,9 @@
}
// IPCBindOpt makes client implement BindOpt.
-func (c *client) IPCBindOpt() {}
+func (c *client) IPCBindOpt() {
+ //nologcall
+}
var _ ipc.BindOpt = (*client)(nil)
@@ -384,6 +388,7 @@
}
func (fc *flowClient) Send(item interface{}) error {
+ defer vlog.LogCall()()
if fc.sendClosed {
return errFlowClosed
}
@@ -399,6 +404,7 @@
}
func (fc *flowClient) Recv(itemptr interface{}) error {
+ defer vlog.LogCall()()
switch {
case fc.response.Error != nil:
return fc.response.Error
@@ -427,6 +433,7 @@
}
func (fc *flowClient) CloseSend() error {
+ defer vlog.LogCall()()
return fc.closeSend()
}
@@ -458,6 +465,7 @@
}
func (fc *flowClient) Finish(resultptrs ...interface{}) error {
+ defer vlog.LogCall()()
err := fc.finish(resultptrs...)
vtrace.FromContext(fc.ctx).Annotate("Finished")
return err
@@ -522,6 +530,7 @@
}
func (fc *flowClient) Cancel() {
+ defer vlog.LogCall()()
vtrace.FromContext(fc.ctx).Annotate("Cancelled")
fc.flow.Cancel()
}
diff --git a/runtimes/google/ipc/discharges.go b/runtimes/google/ipc/discharges.go
index 1b35bb1..88fbfb0 100644
--- a/runtimes/google/ipc/discharges.go
+++ b/runtimes/google/ipc/discharges.go
@@ -2,6 +2,7 @@
import (
"sync"
+
"veyron.io/veyron/veyron2"
"veyron.io/veyron/veyron2/context"
"veyron.io/veyron/veyron2/ipc"
@@ -185,7 +186,10 @@
// Discharges in the cache and in the call options are still used.
type dontFetchDischarges struct{}
-func (dontFetchDischarges) IPCCallOpt() {}
+func (dontFetchDischarges) IPCCallOpt() {
+ //nologcall
+}
+
func shouldFetchDischarges(opts []ipc.CallOpt) bool {
for _, opt := range opts {
if _, ok := opt.(dontFetchDischarges); ok {
diff --git a/runtimes/google/ipc/server.go b/runtimes/google/ipc/server.go
index fff0337..4167dd1 100644
--- a/runtimes/google/ipc/server.go
+++ b/runtimes/google/ipc/server.go
@@ -94,6 +94,7 @@
}
func (s *server) Published() ([]string, error) {
+ defer vlog.LogCall()()
s.Lock()
defer s.Unlock()
if s.stopped {
@@ -130,6 +131,7 @@
}
func (s *server) Listen(protocol, address string) (naming.Endpoint, error) {
+ defer vlog.LogCall()()
s.Lock()
// Shortcut if the server is stopped, to avoid needlessly creating a
// listener.
@@ -246,6 +248,7 @@
}
func (s *server) ListenX(listenSpec *ipc.ListenSpec) (naming.Endpoint, error) {
+ defer vlog.LogCall()()
s.Lock()
// Shortcut if the server is stopped, to avoid needlessly creating a
// listener.
@@ -464,6 +467,7 @@
}
func (s *server) Serve(name string, disp ipc.Dispatcher) error {
+ defer vlog.LogCall()()
s.Lock()
defer s.Unlock()
if s.stopped {
@@ -482,6 +486,7 @@
}
func (s *server) Stop() error {
+ defer vlog.LogCall()()
s.Lock()
if s.stopped {
s.Unlock()
@@ -845,6 +850,7 @@
// Send implements the ipc.Stream method.
func (fs *flowServer) Send(item interface{}) error {
+ defer vlog.LogCall()()
// The empty response header indicates what follows is a streaming result.
if err := fs.enc.Encode(ipc.Response{}); err != nil {
return err
@@ -854,6 +860,7 @@
// Recv implements the ipc.Stream method.
func (fs *flowServer) Recv(itemptr interface{}) error {
+ defer vlog.LogCall()()
var req ipc.Request
if err := fs.dec.Decode(&req); err != nil {
return err
@@ -867,22 +874,64 @@
// Implementations of ipc.ServerContext methods.
-func (fs *flowServer) Discharges() map[string]security.Discharge { return fs.discharges }
+func (fs *flowServer) Discharges() map[string]security.Discharge {
+ //nologcall
+ return fs.discharges
+}
-func (fs *flowServer) Server() ipc.Server { return fs.server }
-func (fs *flowServer) Method() string { return fs.method }
+func (fs *flowServer) Server() ipc.Server {
+ //nologcall
+ return fs.server
+}
+func (fs *flowServer) Method() string {
+ //nologcall
+ return fs.method
+}
// TODO(cnicolaou): remove Name from ipc.ServerContext and all of
// its implementations
-func (fs *flowServer) Name() string { return fs.suffix }
-func (fs *flowServer) Suffix() string { return fs.suffix }
-func (fs *flowServer) Label() security.Label { return fs.label }
+func (fs *flowServer) Name() string {
+ //nologcall
+ return fs.suffix
+}
+func (fs *flowServer) Suffix() string {
+ //nologcall
+ return fs.suffix
+}
+func (fs *flowServer) Label() security.Label {
+ //nologcall
+ return fs.label
+}
-func (fs *flowServer) LocalID() security.PublicID { return fs.flow.LocalID() }
-func (fs *flowServer) RemoteID() security.PublicID { return fs.authorizedRemoteID }
-func (fs *flowServer) LocalPrincipal() security.Principal { return nil }
-func (fs *flowServer) LocalBlessings() security.Blessings { return nil }
-func (fs *flowServer) RemoteBlessings() security.Blessings { return nil }
-func (fs *flowServer) Blessing() security.PublicID { return fs.blessing }
-func (fs *flowServer) LocalEndpoint() naming.Endpoint { return fs.flow.LocalEndpoint() }
-func (fs *flowServer) RemoteEndpoint() naming.Endpoint { return fs.flow.RemoteEndpoint() }
+func (fs *flowServer) LocalID() security.PublicID {
+ //nologcall
+ return fs.flow.LocalID()
+}
+func (fs *flowServer) RemoteID() security.PublicID {
+ //nologcall
+ return fs.authorizedRemoteID
+}
+func (fs *flowServer) LocalPrincipal() security.Principal {
+ //nologcall
+ return nil
+}
+func (fs *flowServer) LocalBlessings() security.Blessings {
+ //nologcall
+ return nil
+}
+func (fs *flowServer) RemoteBlessings() security.Blessings {
+ //nologcall
+ return nil
+}
+func (fs *flowServer) Blessing() security.PublicID {
+ //nologcall
+ return fs.blessing
+}
+func (fs *flowServer) LocalEndpoint() naming.Endpoint {
+ //nologcall
+ return fs.flow.LocalEndpoint()
+}
+func (fs *flowServer) RemoteEndpoint() naming.Endpoint {
+ //nologcall
+ return fs.flow.RemoteEndpoint()
+}
diff --git a/runtimes/google/ipc/stream/vc/vc.go b/runtimes/google/ipc/stream/vc/vc.go
index d6bfc0d..a69df39 100644
--- a/runtimes/google/ipc/stream/vc/vc.go
+++ b/runtimes/google/ipc/stream/vc/vc.go
@@ -127,8 +127,12 @@
func (fixedLocalID) IPCStreamListenerOpt() {}
func (fixedLocalID) IPCStreamVCOpt() {}
-func (fixedLocalID) IPCClientOpt() {}
-func (fixedLocalID) IPCServerOpt() {}
+func (fixedLocalID) IPCClientOpt() {
+ //nologcall
+}
+func (fixedLocalID) IPCServerOpt() {
+ //nologcall
+}
// FixedLocalID creates a LocalID using the provided PrivateID. The
// provided PrivateID must always be non-nil.
diff --git a/runtimes/google/naming/endpoint.go b/runtimes/google/naming/endpoint.go
index 4df4a98..a69ffbe 100644
--- a/runtimes/google/naming/endpoint.go
+++ b/runtimes/google/naming/endpoint.go
@@ -129,9 +129,16 @@
return nil
}
-func (ep *Endpoint) RoutingID() naming.RoutingID { return ep.RID }
-func (ep *Endpoint) Network() string { return Network }
+func (ep *Endpoint) RoutingID() naming.RoutingID {
+ //nologcall
+ return ep.RID
+}
+func (ep *Endpoint) Network() string {
+ //nologcall
+ return Network
+}
func (ep *Endpoint) String() string {
+ //nologcall
return fmt.Sprintf("%s2@%s@%s@%s@%s@%s@@",
separator, ep.Protocol, ep.Address, ep.RID,
printIPCVersion(ep.MinIPCVersion), printIPCVersion(ep.MaxIPCVersion))
@@ -139,6 +146,7 @@
func (ep *Endpoint) version() int { return 2 }
func (ep *Endpoint) Addr() net.Addr {
+ //nologcall
return &addr{network: ep.Protocol, address: ep.Address}
}
diff --git a/runtimes/google/naming/namespace/glob.go b/runtimes/google/naming/namespace/glob.go
index 7328caa..b251c63 100644
--- a/runtimes/google/naming/namespace/glob.go
+++ b/runtimes/google/naming/namespace/glob.go
@@ -109,6 +109,7 @@
// Glob implements naming.MountTable.Glob.
func (ns *namespace) Glob(ctx context.T, pattern string) (chan naming.MountEntry, error) {
+ defer vlog.LogCall()()
root, globPattern := naming.SplitAddressName(pattern)
g, err := glob.Parse(globPattern)
if err != nil {
diff --git a/runtimes/google/naming/namespace/mount.go b/runtimes/google/naming/namespace/mount.go
index 2577f49..49cc811 100644
--- a/runtimes/google/naming/namespace/mount.go
+++ b/runtimes/google/naming/namespace/mount.go
@@ -35,6 +35,7 @@
}
func (ns *namespace) Mount(ctx context.T, name, server string, ttl time.Duration) error {
+ defer vlog.LogCall()()
// Resolve to all the mount tables implementing name.
mtServers, err := ns.ResolveToMountTable(ctx, name)
if err != nil {
@@ -62,6 +63,7 @@
}
func (ns *namespace) Unmount(ctx context.T, name, server string) error {
+ defer vlog.LogCall()()
mts, err := ns.ResolveToMountTable(ctx, name)
if err != nil {
return err
diff --git a/runtimes/google/naming/namespace/namespace.go b/runtimes/google/naming/namespace/namespace.go
index a3a3d2d..88855c0 100644
--- a/runtimes/google/naming/namespace/namespace.go
+++ b/runtimes/google/naming/namespace/namespace.go
@@ -7,6 +7,7 @@
"veyron.io/veyron/veyron2"
"veyron.io/veyron/veyron2/naming"
"veyron.io/veyron/veyron2/verror"
+ "veyron.io/veyron/veyron2/vlog"
)
const defaultMaxResolveDepth = 32
@@ -58,6 +59,7 @@
// SetRoots implements naming.Namespace.SetRoots
func (ns *namespace) SetRoots(roots ...string) error {
+ defer vlog.LogCall()()
if !rooted(roots) {
return badRoots(roots)
}
@@ -80,6 +82,7 @@
// Roots implements naming.Namespace.Roots
func (ns *namespace) Roots() []string {
+ //nologcall
ns.RLock()
defer ns.RUnlock()
roots := make([]string, len(ns.roots))
@@ -127,6 +130,7 @@
// CacheCtl implements naming.Namespace.CacheCtl
func (ns *namespace) CacheCtl(ctls ...naming.CacheCtl) []naming.CacheCtl {
+ defer vlog.LogCall()()
for _, c := range ctls {
switch v := c.(type) {
case naming.DisableCache:
diff --git a/runtimes/google/naming/namespace/resolve.go b/runtimes/google/naming/namespace/resolve.go
index da49886..f246c06 100644
--- a/runtimes/google/naming/namespace/resolve.go
+++ b/runtimes/google/naming/namespace/resolve.go
@@ -81,6 +81,7 @@
// Resolve implements veyron2/naming.Namespace.
func (ns *namespace) Resolve(ctx context.T, name string) ([]string, error) {
+ defer vlog.LogCall()()
names := ns.rootName(name)
if vlog.V(2) {
_, file, line, _ := runtime.Caller(1)
@@ -121,6 +122,7 @@
// ResolveToMountTable implements veyron2/naming.Namespace.
func (ns *namespace) ResolveToMountTable(ctx context.T, name string) ([]string, error) {
+ defer vlog.LogCall()()
names := ns.rootName(name)
if vlog.V(2) {
_, file, line, _ := runtime.Caller(1)
@@ -214,6 +216,7 @@
// Unesolve implements veyron2/naming.Namespace.
func (ns *namespace) Unresolve(ctx context.T, name string) ([]string, error) {
+ defer vlog.LogCall()()
vlog.VI(2).Infof("Unresolve %s", name)
names, err := ns.Resolve(ctx, name)
if err != nil {
@@ -235,6 +238,7 @@
// FlushCache flushes the most specific entry found for name. It returns true if anything was
// actually flushed.
func (ns *namespace) FlushCacheEntry(name string) bool {
+ defer vlog.LogCall()()
flushed := false
for _, n := range ns.rootName(name) {
// Walk the cache as we would in a resolution. Unlike a resolution, we have to follow
diff --git a/runtimes/google/rt/ipc.go b/runtimes/google/rt/ipc.go
index aa46f40..a2150f6 100644
--- a/runtimes/google/rt/ipc.go
+++ b/runtimes/google/rt/ipc.go
@@ -60,9 +60,13 @@
return lID.store.DefaultPublicID()
}
-func (*localID) IPCClientOpt() {}
-func (*localID) IPCStreamVCOpt() {}
-func (*localID) IPCServerOpt() {}
+func (*localID) IPCClientOpt() {
+ //nologcall
+}
+func (*localID) IPCStreamVCOpt() {}
+func (*localID) IPCServerOpt() {
+ //nologcall
+}
func (*localID) IPCStreamListenerOpt() {}
// newLocalID returns a localID embedding the runtime's PrivateID and a fixed
diff --git a/runtimes/google/testing/mocks/ipc/simple_client.go b/runtimes/google/testing/mocks/ipc/simple_client.go
index 9cc1a41..a329a72 100644
--- a/runtimes/google/testing/mocks/ipc/simple_client.go
+++ b/runtimes/google/testing/mocks/ipc/simple_client.go
@@ -8,6 +8,7 @@
"veyron.io/veyron/veyron2/context"
"veyron.io/veyron/veyron2/ipc"
+ "veyron.io/veyron/veyron2/vlog"
)
// NewSimpleClient creates a new mocked ipc client where the given map of method name
@@ -37,10 +38,13 @@
}
// IPCBindOpt Implements ipc.Client
-func (c *SimpleMockClient) IPCBindOpt() {}
+func (c *SimpleMockClient) IPCBindOpt() {
+ //nologcall
+}
// StartCall Implements ipc.Client
func (c *SimpleMockClient) StartCall(ctx context.T, name, method string, args []interface{}, opts ...ipc.CallOpt) (ipc.Call, error) {
+ defer vlog.LogCall()()
results, ok := c.results[method]
if !ok {
return nil, errors.New(fmt.Sprintf("method %s not found", method))
@@ -59,6 +63,7 @@
// Close Implements ipc.Client
func (*SimpleMockClient) Close() {
+ defer vlog.LogCall()()
}
// mockCall implements ipc.Call
@@ -69,15 +74,18 @@
// Cancel implements ipc.Call
func (*mockCall) Cancel() {
+ defer vlog.LogCall()()
}
// CloseSend implements ipc.Call
func (*mockCall) CloseSend() error {
+ defer vlog.LogCall()()
return nil
}
// Finish implements ipc.Call
func (mc *mockCall) Finish(resultptrs ...interface{}) error {
+ defer vlog.LogCall()()
if got, want := len(resultptrs), len(mc.results); got != want {
return errors.New(fmt.Sprintf("wrong number of output results; expected resultptrs of size %d but got %d", want, got))
}
@@ -95,10 +103,12 @@
//Send implements ipc.Stream
func (*mockStream) Send(interface{}) error {
+ defer vlog.LogCall()()
return nil
}
//Recv implements ipc.Stream
func (*mockStream) Recv(interface{}) error {
+ defer vlog.LogCall()()
return nil
}
diff --git a/runtimes/google/testing/mocks/naming/namespace.go b/runtimes/google/testing/mocks/naming/namespace.go
index 68ae90a..68b0bfe 100644
--- a/runtimes/google/testing/mocks/naming/namespace.go
+++ b/runtimes/google/testing/mocks/naming/namespace.go
@@ -9,6 +9,7 @@
"veyron.io/veyron/veyron2/context"
"veyron.io/veyron/veyron2/naming"
"veyron.io/veyron/veyron2/verror"
+ "veyron.io/veyron/veyron2/vlog"
)
// NewSimpleNamespace returns a simple implementation of a Namespace
@@ -25,6 +26,7 @@
}
func (ns *namespace) Mount(ctx context.T, name, server string, _ time.Duration) error {
+ defer vlog.LogCall()()
ns.Lock()
defer ns.Unlock()
for n, _ := range ns.mounts {
@@ -37,6 +39,7 @@
}
func (ns *namespace) Unmount(ctx context.T, name, server string) error {
+ defer vlog.LogCall()()
var servers []string
ns.Lock()
defer ns.Unlock()
@@ -55,6 +58,7 @@
}
func (ns *namespace) Resolve(ctx context.T, name string) ([]string, error) {
+ defer vlog.LogCall()()
if address, _ := naming.SplitAddressName(name); len(address) > 0 {
return []string{name}, nil
}
@@ -74,37 +78,44 @@
}
func (ns *namespace) ResolveToMountTable(ctx context.T, name string) ([]string, error) {
+ defer vlog.LogCall()()
// TODO(mattr): Implement this method for tests that might need it.
panic("ResolveToMountTable not implemented")
return nil, nil
}
func (ns *namespace) Unresolve(ctx context.T, name string) ([]string, error) {
+ defer vlog.LogCall()()
// TODO(mattr): Implement this method for tests that might need it.
panic("Unresolve not implemented")
return nil, nil
}
func (ns *namespace) FlushCacheEntry(name string) bool {
+ defer vlog.LogCall()()
return false
}
func (ns *namespace) CacheCtl(ctls ...naming.CacheCtl) []naming.CacheCtl {
+ defer vlog.LogCall()()
return nil
}
func (ns *namespace) Glob(ctx context.T, pattern string) (chan naming.MountEntry, error) {
+ defer vlog.LogCall()()
// TODO(mattr): Implement this method for tests that might need it.
panic("Glob not implemented")
return nil, nil
}
func (ns *namespace) SetRoots(...string) error {
+ defer vlog.LogCall()()
panic("Calling SetRoots on a mock namespace. This is not supported.")
return nil
}
func (ns *namespace) Roots() []string {
+ defer vlog.LogCall()()
panic("Calling Roots on a mock namespace. This is not supported.")
return nil
}