veyron.go.core: Make context.T a concrete type.
Change-Id: I1f4ce09c8a302214e13da6939a20dbf625d31511
MultiPart: 1/6
diff --git a/lib/testutil/glob.go b/lib/testutil/glob.go
index 329be06..f6041c1 100644
--- a/lib/testutil/glob.go
+++ b/lib/testutil/glob.go
@@ -12,7 +12,7 @@
// GlobName calls __Glob on the given object with the given pattern and returns
// a sorted list of matching object names, or an error.
-func GlobName(ctx context.T, name, pattern string) ([]string, error) {
+func GlobName(ctx *context.T, name, pattern string) ([]string, error) {
client := ctx.Runtime().(veyron2.Runtime).Client()
call, err := client.StartCall(ctx, name, ipc.GlobMethod, []interface{}{pattern})
if err != nil {
diff --git a/runtimes/google/ipc/benchmarks/client.go b/runtimes/google/ipc/benchmarks/client.go
index f6558ea..c920458 100644
--- a/runtimes/google/ipc/benchmarks/client.go
+++ b/runtimes/google/ipc/benchmarks/client.go
@@ -14,7 +14,7 @@
// CallEcho calls 'Echo' method 'iterations' times with the given payload
// size, and optionally updates the stats.
-func CallEcho(b *testing.B, ctx context.T, address string, iterations, payloadSize int, stats *testutil.BenchStats) {
+func CallEcho(b *testing.B, ctx *context.T, address string, iterations, payloadSize int, stats *testutil.BenchStats) {
stub := BenchmarkClient(address)
payload := make([]byte, payloadSize)
for i := range payload {
@@ -53,7 +53,7 @@
// CallEchoStream calls 'EchoStream' method 'iterations' times. Each iteration
// sends 'chunkCnt' chunks on the stream and receives the same number of chunks
// back. Each chunk has the given payload size. Optionally updates the stats.
-func CallEchoStream(b *testing.B, ctx context.T, address string, iterations, chunkCnt, payloadSize int, stats *testutil.BenchStats) {
+func CallEchoStream(b *testing.B, ctx *context.T, address string, iterations, chunkCnt, payloadSize int, stats *testutil.BenchStats) {
done, _ := StartEchoStream(b, ctx, address, iterations, chunkCnt, payloadSize, stats)
<-done
}
@@ -64,7 +64,7 @@
// the streaming. Each iteration requests 'chunkCnt' chunks on the stream and
// receives that number of chunks back. Each chunk has the given payload size.
// Optionally updates the stats. Zero 'iterations' means unlimited.
-func StartEchoStream(b *testing.B, ctx context.T, address string, iterations, chunkCnt, payloadSize int, stats *testutil.BenchStats) (<-chan int, func()) {
+func StartEchoStream(b *testing.B, ctx *context.T, address string, iterations, chunkCnt, payloadSize int, stats *testutil.BenchStats) (<-chan int, func()) {
stub := BenchmarkClient(address)
payload := make([]byte, payloadSize)
for i := range payload {
diff --git a/runtimes/google/ipc/benchmarks/service.vdl.go b/runtimes/google/ipc/benchmarks/service.vdl.go
index 301bd4e..6613195 100644
--- a/runtimes/google/ipc/benchmarks/service.vdl.go
+++ b/runtimes/google/ipc/benchmarks/service.vdl.go
@@ -26,9 +26,9 @@
// containing Benchmark methods.
type BenchmarkClientMethods interface {
// Echo returns the payload that it receives.
- Echo(ctx __context.T, Payload []byte, opts ...__ipc.CallOpt) ([]byte, error)
+ Echo(ctx *__context.T, Payload []byte, opts ...__ipc.CallOpt) ([]byte, error)
// EchoStream returns the payload that it receives via the stream.
- EchoStream(__context.T, ...__ipc.CallOpt) (BenchmarkEchoStreamCall, error)
+ EchoStream(*__context.T, ...__ipc.CallOpt) (BenchmarkEchoStreamCall, error)
}
// BenchmarkClientStub adds universal methods to BenchmarkClientMethods.
@@ -53,14 +53,14 @@
client __ipc.Client
}
-func (c implBenchmarkClientStub) c(ctx __context.T) __ipc.Client {
+func (c implBenchmarkClientStub) c(ctx *__context.T) __ipc.Client {
if c.client != nil {
return c.client
}
return __veyron2.RuntimeFromContext(ctx).Client()
}
-func (c implBenchmarkClientStub) Echo(ctx __context.T, i0 []byte, opts ...__ipc.CallOpt) (o0 []byte, err error) {
+func (c implBenchmarkClientStub) Echo(ctx *__context.T, i0 []byte, opts ...__ipc.CallOpt) (o0 []byte, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Echo", []interface{}{i0}, opts...); err != nil {
return
@@ -71,7 +71,7 @@
return
}
-func (c implBenchmarkClientStub) EchoStream(ctx __context.T, opts ...__ipc.CallOpt) (ocall BenchmarkEchoStreamCall, err error) {
+func (c implBenchmarkClientStub) EchoStream(ctx *__context.T, opts ...__ipc.CallOpt) (ocall BenchmarkEchoStreamCall, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoStream", nil, opts...); err != nil {
return
@@ -80,7 +80,7 @@
return
}
-func (c implBenchmarkClientStub) Signature(ctx __context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
+func (c implBenchmarkClientStub) Signature(ctx *__context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Signature", nil, opts...); err != nil {
return
diff --git a/runtimes/google/ipc/client.go b/runtimes/google/ipc/client.go
index 83b2de3..4269466 100644
--- a/runtimes/google/ipc/client.go
+++ b/runtimes/google/ipc/client.go
@@ -137,7 +137,7 @@
return c, nil
}
-func (c *client) createFlow(ctx context.T, ep naming.Endpoint, noDischarges bool) (stream.Flow, verror.E) {
+func (c *client) createFlow(ctx *context.T, ep naming.Endpoint, noDischarges bool) (stream.Flow, verror.E) {
c.vcMapMu.Lock()
defer c.vcMapMu.Unlock()
if c.vcMap == nil {
@@ -194,7 +194,7 @@
// a flow to the endpoint, returning the parsed suffix.
// The server name passed in should be a rooted name, of the form "/ep/suffix" or
// "/ep//suffix", or just "/ep".
-func (c *client) connectFlow(ctx context.T, server string, noDischarges bool) (stream.Flow, string, verror.E) {
+func (c *client) connectFlow(ctx *context.T, server string, noDischarges bool) (stream.Flow, string, verror.E) {
address, suffix := naming.SplitAddressName(server)
if len(address) == 0 {
return nil, "", verror.Make(errNonRootedName, ctx, server)
@@ -244,7 +244,7 @@
return 0, false
}
-func (c *client) StartCall(ctx context.T, name, method string, args []interface{}, opts ...ipc.CallOpt) (ipc.Call, error) {
+func (c *client) StartCall(ctx *context.T, name, method string, args []interface{}, opts ...ipc.CallOpt) (ipc.Call, error) {
defer vlog.LogCall()()
return c.startCall(ctx, name, method, args, opts)
}
@@ -286,8 +286,8 @@
}
// startCall ensures StartCall always returns verror.E.
-func (c *client) startCall(ctx context.T, name, method string, args []interface{}, opts []ipc.CallOpt) (ipc.Call, verror.E) {
- if ctx == nil {
+func (c *client) startCall(ctx *context.T, name, method string, args []interface{}, opts []ipc.CallOpt) (ipc.Call, verror.E) {
+ if !ctx.Initialized() {
return nil, verror.ExplicitMake(verror.BadArg, i18n.NoLangID, "ipc.Client", "StartCall")
}
@@ -348,7 +348,7 @@
}
// TODO(cnicolaou): implement real, configurable load balancing.
-func (c *client) tryServer(ctx context.T, index int, server string, ch chan<- *serverStatus, noDischarges bool) {
+func (c *client) tryServer(ctx *context.T, index int, server string, ch chan<- *serverStatus, noDischarges bool) {
status := &serverStatus{index: index}
var err verror.E
var span vtrace.Span
@@ -364,7 +364,7 @@
}
// tryCall makes a single attempt at a call, against possibly multiple servers.
-func (c *client) tryCall(ctx context.T, name, method string, args []interface{}, skipResolve bool, opts []ipc.CallOpt) (ipc.Call, verror.ActionCode, verror.E) {
+func (c *client) tryCall(ctx *context.T, name, method string, args []interface{}, skipResolve bool, opts []ipc.CallOpt) (ipc.Call, verror.ActionCode, verror.E) {
noDischarges := shouldNotFetchDischarges(opts)
// Resolve name unless told not to.
var servers []string
@@ -557,7 +557,7 @@
// failedTryCall performs asynchronous cleanup for tryCall, and returns an
// appropriate error from the responses we've already received. All parallel
// calls in tryCall failed or we timed out if we get here.
-func (c *client) failedTryCall(ctx context.T, name, method string, servers []string, responses []*serverStatus, ch chan *serverStatus) (ipc.Call, verror.ActionCode, verror.E) {
+func (c *client) failedTryCall(ctx *context.T, name, method string, servers []string, responses []*serverStatus, ch chan *serverStatus) (ipc.Call, verror.ActionCode, verror.E) {
go cleanupTryCall(nil, responses, ch)
c.ns.FlushCacheEntry(name)
noconn, untrusted := []string{}, []string{}
@@ -594,7 +594,7 @@
// the RPC name.method for the client (local end of the flow). It returns the blessings at the
// server that are authorized for this purpose and any blessings that are to be granted to
// the server (via ipc.Granter implementations in opts.)
-func (c *client) authorizeServer(ctx context.T, flow stream.Flow, name, method string, serverPattern security.BlessingPattern, opts []ipc.CallOpt) (serverBlessings []string, grantedBlessings security.Blessings, err verror.E) {
+func (c *client) authorizeServer(ctx *context.T, flow stream.Flow, name, method string, serverPattern security.BlessingPattern, opts []ipc.CallOpt) (serverBlessings []string, grantedBlessings security.Blessings, err verror.E) {
if flow.RemoteBlessings() == nil {
return nil, nil, verror.Make(errNoBlessings, ctx)
}
@@ -648,7 +648,7 @@
// 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
+ ctx *context.T // context to annotate with call details
dec vomDecoder // to decode responses and results from the server
enc vomEncoder // 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.
@@ -668,7 +668,7 @@
var _ ipc.Call = (*flowClient)(nil)
var _ ipc.Stream = (*flowClient)(nil)
-func newFlowClient(ctx context.T, server []string, flow stream.Flow, dc vc.DischargeClient) (*flowClient, error) {
+func newFlowClient(ctx *context.T, server []string, flow stream.Flow, dc vc.DischargeClient) (*flowClient, error) {
fc := &flowClient{
ctx: ctx,
dec: vom.NewDecoder(flow),
@@ -760,7 +760,7 @@
return nil
}
-func decodeNetError(ctx context.T, err error) verror.IDAction {
+func decodeNetError(ctx *context.T, err error) verror.IDAction {
if neterr, ok := err.(net.Error); ok {
if neterr.Timeout() || neterr.Temporary() {
// If a read is cancelled in the lower levels we see
diff --git a/runtimes/google/ipc/context.go b/runtimes/google/ipc/context.go
deleted file mode 100644
index a2e916d..0000000
--- a/runtimes/google/ipc/context.go
+++ /dev/null
@@ -1,272 +0,0 @@
-package ipc
-
-import (
- "sync"
- "time"
-
- "v.io/core/veyron2"
- "v.io/core/veyron2/context"
-)
-
-const nilRuntimeMessage = "attempting to create a context with a nil runtime"
-
-// InternalNewContext creates a new context.T. This function should only
-// be called from within the runtime implementation.
-func InternalNewContext(runtime veyron2.Runtime) context.T {
- if runtime == nil {
- panic(nilRuntimeMessage)
- }
- return rootContext{runtime}
-}
-
-// cancellable is an interface to cancellable contexts.
-type cancellable interface {
- // cancel cancels the context and records the given error.
- cancel(err error)
- addChild(child cancellable)
- removeChild(parent cancellable)
-}
-
-// child is an interface that allows you to find the nearest cancelContext ancestor.
-type child interface {
- parent() context.T
-}
-
-// rootContext is an empty root context. It has no deadline or values
-// and can't be canceled.
-type rootContext struct {
- runtime veyron2.Runtime
-}
-
-func (r rootContext) parent() context.T { return nil }
-func (r rootContext) Deadline() (deadline time.Time, ok bool) { return }
-func (r rootContext) Done() <-chan struct{} { return nil }
-func (r rootContext) Err() error { return nil }
-func (r rootContext) Value(key interface{}) interface{} { return nil }
-func (r rootContext) Runtime() interface{} { return r.runtime }
-func (r rootContext) WithCancel() (ctx context.T, cancel context.CancelFunc) {
- return newCancelContext(r)
-}
-func (r rootContext) WithDeadline(deadline time.Time) (context.T, context.CancelFunc) {
- return newDeadlineContext(r, deadline)
-}
-func (r rootContext) WithTimeout(timeout time.Duration) (context.T, context.CancelFunc) {
- return newDeadlineContext(r, time.Now().Add(timeout))
-}
-func (r rootContext) WithValue(key interface{}, val interface{}) context.T {
- return newValueContext(r, key, val)
-}
-
-// A valueContext contains a single key/value mapping.
-type valueContext struct {
- context.T
- key, value interface{}
-}
-
-func newValueContext(parent context.T, key, val interface{}) *valueContext {
- return &valueContext{parent, key, val}
-}
-
-func (v *valueContext) parent() context.T {
- return v.T
-}
-func (v *valueContext) Value(key interface{}) interface{} {
- if key == v.key {
- return v.value
- }
- return v.T.Value(key)
-}
-func (v *valueContext) WithCancel() (ctx context.T, cancel context.CancelFunc) {
- return newCancelContext(v)
-}
-func (v *valueContext) WithDeadline(deadline time.Time) (context.T, context.CancelFunc) {
- return newDeadlineContext(v, deadline)
-}
-func (v *valueContext) WithTimeout(timeout time.Duration) (context.T, context.CancelFunc) {
- return newDeadlineContext(v, time.Now().Add(timeout))
-}
-func (v *valueContext) WithValue(key interface{}, val interface{}) context.T {
- return newValueContext(v, key, val)
-}
-
-// A cancelContext provides a mechanism for cancellation and a
-// done channel that allows it's status to be monitored.
-type cancelContext struct {
- context.T
- done chan struct{}
- err error
-
- // children is used to keep track of descendant cancellable
- // contexts. This is an optimization to prevent excessive
- // goroutines.
- children map[cancellable]bool
-
- mu sync.Mutex
-}
-
-func newCancelContext(parent context.T) (ctx *cancelContext, cancel context.CancelFunc) {
- ctx = &cancelContext{
- T: parent,
- done: make(chan struct{}),
- }
-
- cancel = func() { ctx.cancel(context.Canceled) }
- if parent.Done() == nil {
- return
- }
-
- if ancestor, nonStandardAncestor := ctx.findCancellableAncestor(); !nonStandardAncestor {
- if ancestor != nil {
- ancestor.addChild(ctx)
- }
- return
- }
-
- // If neither the parent nor the child are canceled then both the
- // parent and the child will leak. Note this will only happen for
- // non-standard implementations of the context.T interface.
- go func() {
- select {
- case <-parent.Done():
- ctx.cancel(parent.Err())
- case <-ctx.Done():
- }
- }()
-
- return
-}
-
-// addChild sets child as a descendant cancellable context. This
-// allows us to propagate cancellations through the context tree.
-func (c *cancelContext) addChild(child cancellable) {
- c.mu.Lock()
- if c.err != nil {
- // If the parent is already canceled, just cancel the child.
- c.mu.Unlock()
- child.cancel(c.err)
- return
- }
- defer c.mu.Unlock()
- if c.children == nil {
- c.children = make(map[cancellable]bool)
- }
- c.children[child] = true
-}
-
-// removeChild is called by descendant contexts when they are
-// canceled. This prevents old contexts which are no longer relevant
-// from consuming resources.
-func (c *cancelContext) removeChild(child cancellable) {
- c.mu.Lock()
- defer c.mu.Unlock()
- delete(c.children, child)
-}
-
-// cancelChildren cancels all descendant cancellable contexts. This
-// is called during cancel but while mu is NOT held. Children may try
-// to make calls to parents, which would result in a deadlock.
-func cancelChildren(children map[cancellable]bool, err error) {
- for child, _ := range children {
- child.cancel(err)
- }
-}
-
-// cancel cancels the context, propagates that signal to children,
-// and updates parents.
-func (c *cancelContext) cancel(err error) {
- if err == nil {
- panic("Context canceled with nil error.")
- }
- c.mu.Lock()
- // cancelChilren should be called after mu is released.
- defer cancelChildren(c.children, err)
- defer c.mu.Unlock()
- if c.err != nil {
- return
- }
- c.err = err
- c.children = nil
- if ancestor, nonStandardAncestor := c.findCancellableAncestor(); !nonStandardAncestor {
- if ancestor != nil {
- ancestor.removeChild(c)
- }
- }
- close(c.done)
-}
-
-// findCancelAncestor finds the nearest ancestor that supports cancellation.
-// nonStandardAncestor will be true if we cannot determine if there is a cancellable
-// ancestor due to the presence of an unknown context implementation. In this
-// case ancestor will always be nil.
-func (c *cancelContext) findCancellableAncestor() (ancestor cancellable, nonStandardAncestor bool) {
- parent := c.T
- for {
- if c, ok := parent.(cancellable); ok {
- return c, false
- }
- c, ok := parent.(child)
- if !ok {
- return nil, true
- }
- parent = c.parent()
- }
- return nil, false // Unreachable.
-}
-
-func (c *cancelContext) Done() <-chan struct{} { return c.done }
-func (c *cancelContext) Err() error {
- c.mu.Lock()
- defer c.mu.Unlock()
- return c.err
-}
-func (c *cancelContext) WithCancel() (ctx context.T, cancel context.CancelFunc) {
- return newCancelContext(c)
-}
-func (c *cancelContext) WithDeadline(deadline time.Time) (context.T, context.CancelFunc) {
- return newDeadlineContext(c, deadline)
-}
-func (c *cancelContext) WithTimeout(timeout time.Duration) (context.T, context.CancelFunc) {
- return newDeadlineContext(c, time.Now().Add(timeout))
-}
-func (c *cancelContext) WithValue(key interface{}, val interface{}) context.T {
- return newValueContext(c, key, val)
-}
-
-// A deadlineContext automatically cancels itself when the deadline is reached.
-type deadlineContext struct {
- *cancelContext
- deadline time.Time
- timer *time.Timer
-}
-
-// newDeadlineContext returns a new deadlineContext.
-func newDeadlineContext(parent context.T, deadline time.Time) (*deadlineContext, context.CancelFunc) {
- cancel, _ := newCancelContext(parent)
- ctx := &deadlineContext{
- cancelContext: cancel,
- deadline: deadline,
- }
- delta := deadline.Sub(time.Now())
- ctx.timer = time.AfterFunc(delta, func() { cancel.cancel(context.DeadlineExceeded) })
- return ctx, func() { ctx.cancel(context.Canceled) }
-}
-
-// cancel cancels the deadlineContext, forwards the signal to
-// descendants, and notifies parents.
-func (d *deadlineContext) cancel(err error) {
- d.timer.Stop()
- d.cancelContext.cancel(err)
-}
-func (d *deadlineContext) Deadline() (deadline time.Time, ok bool) { return d.deadline, true }
-func (d *deadlineContext) WithCancel() (ctx context.T, cancel context.CancelFunc) {
- return newCancelContext(d)
-}
-func (d *deadlineContext) WithDeadline(deadline time.Time) (context.T, context.CancelFunc) {
- return newDeadlineContext(d, deadline)
-}
-func (d *deadlineContext) WithTimeout(timeout time.Duration) (context.T, context.CancelFunc) {
- return newDeadlineContext(d, time.Now().Add(timeout))
-}
-func (d *deadlineContext) WithValue(key interface{}, val interface{}) context.T {
- return newValueContext(d, key, val)
-}
diff --git a/runtimes/google/ipc/context_test.go b/runtimes/google/ipc/context_test.go
deleted file mode 100644
index 469e954..0000000
--- a/runtimes/google/ipc/context_test.go
+++ /dev/null
@@ -1,228 +0,0 @@
-package ipc
-
-import (
- "sync"
- "testing"
- "time"
-
- "v.io/core/veyron/runtimes/google/testing/mocks/runtime"
- "v.io/core/veyron/runtimes/google/vtrace"
-
- "v.io/core/veyron2/context"
-)
-
-// We need a special way to create contexts for tests. We
-// can't create a real runtime in the runtime implementation
-// so we use a fake one that panics if used. The runtime
-// implementation should not ever use the Runtime from a context.
-func testContext() context.T {
- ctx, _ := testContextWithoutDeadline().WithTimeout(20 * time.Second)
- return ctx
-}
-
-func testContextWithoutDeadline() context.T {
- ctx := InternalNewContext(&runtime.PanicRuntime{})
- ctx, _ = vtrace.WithNewRootSpan(ctx, nil, false)
- return ctx
-}
-
-func testCancel(t *testing.T, ctx context.T, cancel context.CancelFunc) {
- select {
- case <-ctx.Done():
- t.Errorf("Done closed when deadline not yet passed")
- default:
- }
- ch := make(chan bool, 0)
- go func() {
- cancel()
- close(ch)
- }()
- select {
- case <-ch:
- case <-time.After(3 * time.Second):
- t.Fatal("timed out witing for cancel.")
- }
-
- select {
- case <-ctx.Done():
- case <-time.After(3 * time.Second):
- t.Fatal("timed out witing for cancellation.")
- }
- if err := ctx.Err(); err != context.Canceled {
- t.Errorf("Unexpected error want %v, got %v", context.Canceled, err)
- }
-}
-
-func TestRootContext(t *testing.T) {
- r := &runtime.PanicRuntime{}
- ctx := InternalNewContext(r)
-
- if got := ctx.Runtime(); got != r {
- t.Errorf("Expected runtime %v, but found %v", r, got)
- }
-
- if got := ctx.Err(); got != nil {
- t.Errorf("Expected nil error, got: %v", got)
- }
-
- defer func() {
- r := recover()
- if r != nilRuntimeMessage {
- t.Errorf("Unexpected recover value: %s", r)
- }
- }()
- InternalNewContext(nil)
-}
-
-func TestCancelContext(t *testing.T) {
- ctx, cancel := testContext().WithCancel()
- testCancel(t, ctx, cancel)
-
- // Test cancelling a cancel context which is the child
- // of a cancellable context.
- parent, _ := testContext().WithCancel()
- child, cancel := parent.WithCancel()
- cancel()
- <-child.Done()
-
- // Test adding a cancellable child context after the parent is
- // already cancelled.
- parent, cancel = testContext().WithCancel()
- cancel()
- child, _ = parent.WithCancel()
- <-child.Done() // The child should have been cancelled right away.
-}
-
-func TestMultiLevelCancelContext(t *testing.T) {
- c0, c0Cancel := testContext().WithCancel()
- c1, _ := c0.WithCancel()
- c2, _ := c1.WithCancel()
- c3, _ := c2.WithCancel()
- testCancel(t, c3, c0Cancel)
-}
-
-type nonStandardContext struct {
- context.T
-}
-
-func (n *nonStandardContext) WithCancel() (ctx context.T, cancel context.CancelFunc) {
- return newCancelContext(n)
-}
-func (n *nonStandardContext) WithDeadline(deadline time.Time) (context.T, context.CancelFunc) {
- return newDeadlineContext(n, deadline)
-}
-func (n *nonStandardContext) WithTimeout(timeout time.Duration) (context.T, context.CancelFunc) {
- return newDeadlineContext(n, time.Now().Add(timeout))
-}
-func (n *nonStandardContext) WithValue(key interface{}, val interface{}) context.T {
- return newValueContext(n, key, val)
-}
-
-func TestCancelContextWithNonStandard(t *testing.T) {
- // Test that cancellation flows properly through non-standard intermediates.
- ctx := testContext()
- c0 := &nonStandardContext{ctx}
- c1, c1Cancel := c0.WithCancel()
- c2 := &nonStandardContext{c1}
- c3 := &nonStandardContext{c2}
- c4, _ := c3.WithCancel()
- testCancel(t, c4, c1Cancel)
-}
-
-func testDeadline(t *testing.T, ctx context.T, start time.Time, desiredTimeout time.Duration) {
- <-ctx.Done()
- if delta := time.Now().Sub(start); delta < desiredTimeout {
- t.Errorf("Deadline too short want %s got %s", desiredTimeout, delta)
- }
- if err := ctx.Err(); err != context.DeadlineExceeded {
- t.Errorf("Unexpected error want %s, got %s", context.DeadlineExceeded, err)
- }
-}
-
-func TestDeadlineContext(t *testing.T) {
- cases := []time.Duration{
- 3 * time.Millisecond,
- 0,
- }
- rootCtx := InternalNewContext(&runtime.PanicRuntime{})
- cancelCtx, _ := rootCtx.WithCancel()
- deadlineCtx, _ := rootCtx.WithDeadline(time.Now().Add(time.Hour))
-
- for _, desiredTimeout := range cases {
- // Test all the various ways of getting deadline contexts.
- start := time.Now()
- ctx, _ := rootCtx.WithDeadline(start.Add(desiredTimeout))
- testDeadline(t, ctx, start, desiredTimeout)
-
- start = time.Now()
- ctx, _ = cancelCtx.WithDeadline(start.Add(desiredTimeout))
- testDeadline(t, ctx, start, desiredTimeout)
-
- start = time.Now()
- ctx, _ = deadlineCtx.WithDeadline(start.Add(desiredTimeout))
- testDeadline(t, ctx, start, desiredTimeout)
-
- start = time.Now()
- ctx, _ = rootCtx.WithTimeout(desiredTimeout)
- testDeadline(t, ctx, start, desiredTimeout)
-
- start = time.Now()
- ctx, _ = cancelCtx.WithTimeout(desiredTimeout)
- testDeadline(t, ctx, start, desiredTimeout)
-
- start = time.Now()
- ctx, _ = deadlineCtx.WithTimeout(desiredTimeout)
- testDeadline(t, ctx, start, desiredTimeout)
- }
-
- ctx, cancel := testContext().WithDeadline(time.Now().Add(100 * time.Hour))
- testCancel(t, ctx, cancel)
-}
-
-func TestDeadlineContextWithRace(t *testing.T) {
- ctx, cancel := testContext().WithDeadline(time.Now().Add(100 * time.Hour))
- var wg sync.WaitGroup
- wg.Add(10)
- for i := 0; i < 10; i++ {
- go func() {
- cancel()
- wg.Done()
- }()
- }
- wg.Wait()
- <-ctx.Done()
- if err := ctx.Err(); err != context.Canceled {
- t.Errorf("Unexpected error want %v, got %v", context.Canceled, err)
- }
-}
-
-func TestValueContext(t *testing.T) {
- type testContextKey int
- const (
- key1 = testContextKey(iota)
- key2
- key3
- key4
- )
- const (
- val1 = iota
- val2
- val3
- )
- ctx1 := testContext().WithValue(key1, val1)
- ctx2 := ctx1.WithValue(key2, val2)
- ctx3 := ctx2.WithValue(key3, val3)
-
- expected := map[interface{}]interface{}{
- key1: val1,
- key2: val2,
- key3: val3,
- key4: nil,
- }
- for k, v := range expected {
- if got := ctx3.Value(k); got != v {
- t.Errorf("Got wrong value for %v: want %v got %v", k, v, got)
- }
- }
-
-}
diff --git a/runtimes/google/ipc/discharges.go b/runtimes/google/ipc/discharges.go
index 3e1b3dd..be7641d 100644
--- a/runtimes/google/ipc/discharges.go
+++ b/runtimes/google/ipc/discharges.go
@@ -20,7 +20,7 @@
// discharger implements vc.DischargeClient.
type dischargeClient struct {
c ipc.Client
- defaultCtx context.T
+ defaultCtx *context.T
cache dischargeCache
}
@@ -31,7 +31,7 @@
// PrepareDischarges call. This typically happens when fetching discharges on
// behalf of a server accepting connections, i.e., before any notion of the
// "context" of an API call has been established.
-func InternalNewDischargeClient(streamMgr stream.Manager, ns naming.Namespace, defaultCtx context.T, opts ...ipc.ClientOpt) (vc.DischargeClient, error) {
+func InternalNewDischargeClient(streamMgr stream.Manager, ns naming.Namespace, defaultCtx *context.T, opts ...ipc.ClientOpt) (vc.DischargeClient, error) {
if defaultCtx == nil {
return nil, fmt.Errorf("must provide a non-nil context to InternalNewDischargeClient")
}
@@ -56,7 +56,7 @@
// options, or requested from the discharge issuer indicated on the caveat.
// Note that requesting a discharge is an ipc call, so one copy of this
// function must be able to successfully terminate while another is blocked.
-func (d *dischargeClient) PrepareDischarges(ctx context.T, forcaveats []security.ThirdPartyCaveat, impetus security.DischargeImpetus) (ret []security.Discharge) {
+func (d *dischargeClient) PrepareDischarges(ctx *context.T, forcaveats []security.ThirdPartyCaveat, impetus security.DischargeImpetus) (ret []security.Discharge) {
if len(forcaveats) == 0 {
return
}
@@ -98,7 +98,7 @@
// caveats, fetchDischarges keeps retrying until either all discharges can be
// fetched or no new discharges are fetched.
// REQUIRES: len(caveats) == len(out)
-func (d *dischargeClient) fetchDischarges(ctx context.T, caveats []security.ThirdPartyCaveat, impetus security.DischargeImpetus, out []security.Discharge) {
+func (d *dischargeClient) fetchDischarges(ctx *context.T, caveats []security.ThirdPartyCaveat, impetus security.DischargeImpetus, out []security.Discharge) {
var wg sync.WaitGroup
for {
type fetched struct {
@@ -111,7 +111,7 @@
continue
}
wg.Add(1)
- go func(i int, ctx context.T, cav security.ThirdPartyCaveat) {
+ go func(i int, ctx *context.T, cav security.ThirdPartyCaveat) {
defer wg.Done()
vlog.VI(3).Infof("Fetching discharge for %v", cav)
call, err := d.c.StartCall(ctx, cav.Location(), "Discharge", []interface{}{cav, filteredImpetus(cav.Requirements(), impetus)}, vc.NoDischarges{})
diff --git a/runtimes/google/ipc/full_test.go b/runtimes/google/ipc/full_test.go
index d5612b0..cd6ac56 100644
--- a/runtimes/google/ipc/full_test.go
+++ b/runtimes/google/ipc/full_test.go
@@ -37,6 +37,7 @@
"v.io/core/veyron/runtimes/google/lib/publisher"
inaming "v.io/core/veyron/runtimes/google/naming"
tnaming "v.io/core/veyron/runtimes/google/testing/mocks/naming"
+ truntime "v.io/core/veyron/runtimes/google/testing/mocks/runtime"
ivtrace "v.io/core/veyron/runtimes/google/vtrace"
)
@@ -76,6 +77,21 @@
return nil
}
+// We need a special way to create contexts for tests. We
+// can't create a real runtime in the runtime implementation
+// so we use a fake one that panics if used. The runtime
+// implementation should not ever use the Runtime from a context.
+func testContext() *context.T {
+ ctx, _ := testContextWithoutDeadline().WithTimeout(20 * time.Second)
+ return ctx
+}
+
+func testContextWithoutDeadline() *context.T {
+ ctx := context.NewUninitializedContext(&truntime.PanicRuntime{})
+ ctx, _ = ivtrace.WithNewRootSpan(ctx, nil, false)
+ return ctx
+}
+
type userType string
type testServer struct{}
diff --git a/runtimes/google/ipc/glob.go b/runtimes/google/ipc/glob.go
index b626f49..08480f0 100644
--- a/runtimes/google/ipc/glob.go
+++ b/runtimes/google/ipc/glob.go
@@ -314,7 +314,7 @@
// mutableContext is like mutableCall but only provides the context portion.
type mutableContext struct {
- context.T
+ *context.T
M struct {
security.ContextParams
Blessings security.Blessings
@@ -322,7 +322,7 @@
}
}
-func (c *mutableContext) Context() context.T { return c.T }
+func (c *mutableContext) Context() *context.T { return c.T }
func (c *mutableContext) Timestamp() time.Time { return c.M.Timestamp }
func (c *mutableContext) Method() string { return c.M.Method }
func (c *mutableContext) MethodTags() []interface{} { return c.M.MethodTags }
diff --git a/runtimes/google/ipc/server.go b/runtimes/google/ipc/server.go
index 12fb6cf..ca3b7c8 100644
--- a/runtimes/google/ipc/server.go
+++ b/runtimes/google/ipc/server.go
@@ -44,7 +44,7 @@
type server struct {
sync.Mutex
- ctx context.T // context used by the server to make internal RPCs.
+ ctx *context.T // context used by the server to make internal RPCs.
streamMgr stream.Manager // stream manager to listen for new flows.
publisher publisher.Publisher // publisher to publish mounttable mounts.
listenerOpts []stream.ListenerOpt // listener opts passed to Listen.
@@ -86,7 +86,7 @@
func (PreferredServerResolveProtocols) IPCServerOpt() {}
-func InternalNewServer(ctx context.T, streamMgr stream.Manager, ns naming.Namespace, store *ivtrace.Store, opts ...ipc.ServerOpt) (ipc.Server, error) {
+func InternalNewServer(ctx *context.T, streamMgr stream.Manager, ns naming.Namespace, store *ivtrace.Store, opts ...ipc.ServerOpt) (ipc.Server, error) {
ctx, _ = ivtrace.WithNewSpan(ctx, "NewServer")
statsPrefix := naming.Join("ipc", "server", "routing-id", streamMgr.RoutingID().String())
s := &server{
@@ -787,7 +787,7 @@
// flowServer implements the RPC server-side protocol for a single RPC, over a
// flow that's already connected to the client.
type flowServer struct {
- context.T
+ *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 vomDecoder // to decode requests and args from the client
@@ -885,11 +885,11 @@
results, err := fs.processRequest()
- ivtrace.FromContext(fs).Finish()
+ ivtrace.FromContext(fs.T).Finish()
var traceResponse vtrace.Response
if fs.allowDebug {
- traceResponse = ivtrace.Response(fs)
+ traceResponse = ivtrace.Response(fs.T)
}
// Respond to the client with the response header and positional results.
@@ -955,7 +955,7 @@
if verr != nil {
// We don't know what the ipc call was supposed to be, but we'll create
// a placeholder span so we can capture annotations.
- fs.T, _ = ivtrace.WithNewSpan(fs, fmt.Sprintf("\"%s\".UNKNOWN", fs.Name()))
+ fs.T, _ = ivtrace.WithNewSpan(fs.T, fmt.Sprintf("\"%s\".UNKNOWN", fs.Name()))
return nil, verr
}
fs.method = req.Method
@@ -965,7 +965,7 @@
// on the server even if they will not be allowed to collect the
// results later. This might be considered a DOS vector.
spanName := fmt.Sprintf("\"%s\".%s", fs.Name(), fs.Method())
- fs.T, _ = ivtrace.WithContinuedSpan(fs, spanName, req.TraceRequest, fs.server.traceStore)
+ fs.T, _ = ivtrace.WithContinuedSpan(fs.T, spanName, req.TraceRequest, fs.server.traceStore)
var cancel context.CancelFunc
if req.Timeout != ipc.NoTimeout {
@@ -1187,7 +1187,7 @@
//nologcall
return fs.tags
}
-func (fs *flowServer) Context() context.T {
+func (fs *flowServer) Context() *context.T {
return fs.T
}
diff --git a/runtimes/google/ipc/stream/vc/auth.go b/runtimes/google/ipc/stream/vc/auth.go
index f7cb796..7cfbeee 100644
--- a/runtimes/google/ipc/stream/vc/auth.go
+++ b/runtimes/google/ipc/stream/vc/auth.go
@@ -57,7 +57,7 @@
//
// TODO(ashankar): Seems like there is no way the blessing store
// can say that it does NOT want to share the default blessing with the server?
-func AuthenticateAsClient(ctx context.T, conn io.ReadWriteCloser, principal security.Principal, dc DischargeClient, crypter crypto.Crypter, v version.IPCVersion) (server, client security.Blessings, serverDischarges map[string]security.Discharge, err error) {
+func AuthenticateAsClient(ctx *context.T, conn io.ReadWriteCloser, principal security.Principal, dc DischargeClient, crypter crypto.Crypter, v version.IPCVersion) (server, client security.Blessings, serverDischarges map[string]security.Discharge, err error) {
defer conn.Close()
if server, serverDischarges, err = readBlessings(conn, authServerContextTag, crypter, v); err != nil {
return
diff --git a/runtimes/google/ipc/stream/vc/vc.go b/runtimes/google/ipc/stream/vc/vc.go
index e34344b..a52585b 100644
--- a/runtimes/google/ipc/stream/vc/vc.go
+++ b/runtimes/google/ipc/stream/vc/vc.go
@@ -122,7 +122,7 @@
//
// TODO(ataly, ashankar): What should be the impetus for obtaining the discharges?
type DischargeClient interface {
- PrepareDischarges(ctx context.T, forcaveats []security.ThirdPartyCaveat, impetus security.DischargeImpetus) []security.Discharge
+ PrepareDischarges(ctx *context.T, forcaveats []security.ThirdPartyCaveat, impetus security.DischargeImpetus) []security.Discharge
// Invalidate marks the provided discharges as invalid, and therefore unfit
// for being returned by a subsequent PrepareDischarges call.
Invalidate(discharges ...security.Discharge)
@@ -133,7 +133,7 @@
}
// DialContext establishes the context under which a VC Dial was initiated.
-type DialContext struct{ context.T }
+type DialContext struct{ *context.T }
func (DialContext) IPCStreamVCOpt() {}
@@ -380,7 +380,7 @@
tlsSessionCache crypto.TLSClientSessionCache
securityLevel options.VCSecurityLevel
dischargeClient DischargeClient
- ctx context.T
+ ctx *context.T
noDischarges bool
)
for _, o := range opts {
diff --git a/runtimes/google/ipc/stream/vc/vc_test.go b/runtimes/google/ipc/stream/vc/vc_test.go
index 3728eb4..ab6a300 100644
--- a/runtimes/google/ipc/stream/vc/vc_test.go
+++ b/runtimes/google/ipc/stream/vc/vc_test.go
@@ -165,7 +165,7 @@
type mockDischargeClient []security.Discharge
-func (m mockDischargeClient) PrepareDischarges(_ context.T, forcaveats []security.ThirdPartyCaveat, impetus security.DischargeImpetus) []security.Discharge {
+func (m mockDischargeClient) PrepareDischarges(_ *context.T, forcaveats []security.ThirdPartyCaveat, impetus security.DischargeImpetus) []security.Discharge {
return m
}
func (mockDischargeClient) Invalidate(...security.Discharge) {}
diff --git a/runtimes/google/ipc/stream/vif/auth.go b/runtimes/google/ipc/stream/vif/auth.go
index 681e91c..db659c2 100644
--- a/runtimes/google/ipc/stream/vif/auth.go
+++ b/runtimes/google/ipc/stream/vif/auth.go
@@ -61,7 +61,7 @@
// including a hash of the HopSetup message in the encrypted stream. It is
// likely that this will be addressed in subsequent protocol versions (or it may
// not be addressed at all if IPCVersion6 becomes the only supported version).
-func AuthenticateAsClient(ctx context.T, conn net.Conn, versions *version.Range, principal security.Principal, dc vc.DischargeClient) (crypto.ControlCipher, error) {
+func AuthenticateAsClient(ctx *context.T, conn net.Conn, versions *version.Range, principal security.Principal, dc vc.DischargeClient) (crypto.ControlCipher, error) {
if versions == nil {
versions = version.SupportedRange
}
@@ -117,7 +117,7 @@
}
}
-func authenticateAsClientIPC6(ctx context.T, writer io.Writer, reader *iobuf.Reader, principal security.Principal, dc vc.DischargeClient,
+func authenticateAsClientIPC6(ctx *context.T, writer io.Writer, reader *iobuf.Reader, principal security.Principal, dc vc.DischargeClient,
pvt *privateData, pub, ppub *message.HopSetup) (crypto.ControlCipher, error) {
pbox := ppub.NaclBox()
if pbox == nil {
@@ -230,7 +230,7 @@
// clientAuthOptions extracts the client authentication options from the options
// list.
-func clientAuthOptions(lopts []stream.VCOpt) (ctx context.T, principal security.Principal, dischargeClient vc.DischargeClient, err error) {
+func clientAuthOptions(lopts []stream.VCOpt) (ctx *context.T, principal security.Principal, dischargeClient vc.DischargeClient, err error) {
var securityLevel options.VCSecurityLevel
var noDischarges bool
for _, o := range lopts {
diff --git a/runtimes/google/lib/publisher/publisher.go b/runtimes/google/lib/publisher/publisher.go
index d2a27d5..c5d35ed 100644
--- a/runtimes/google/lib/publisher/publisher.go
+++ b/runtimes/google/lib/publisher/publisher.go
@@ -80,7 +80,7 @@
type stopCmd struct{} // sent to the runloop when we want it to exit.
// New returns a new publisher that updates mounts on ns every period.
-func New(ctx context.T, ns naming.Namespace, period time.Duration) Publisher {
+func New(ctx *context.T, ns naming.Namespace, period time.Duration) Publisher {
p := &publisher{
cmdchan: make(chan interface{}),
donechan: make(chan struct{}),
@@ -165,7 +165,7 @@
<-p.donechan
}
-func runLoop(ctx context.T, cmdchan chan interface{}, donechan chan struct{}, ns naming.Namespace, period time.Duration) {
+func runLoop(ctx *context.T, cmdchan chan interface{}, donechan chan struct{}, ns naming.Namespace, period time.Duration) {
vlog.VI(2).Info("ipc pub: start runLoop")
state := newPubState(ctx, ns, period)
@@ -207,7 +207,7 @@
// pubState maintains the state for our periodic mounts. It is not thread-safe;
// it's only used in the sequential publisher runLoop.
type pubState struct {
- ctx context.T
+ ctx *context.T
ns naming.Namespace
period time.Duration
deadline time.Time // deadline for the next sync call
@@ -229,7 +229,7 @@
lastUnmountErr error
}
-func newPubState(ctx context.T, ns naming.Namespace, period time.Duration) *pubState {
+func newPubState(ctx *context.T, ns naming.Namespace, period time.Duration) *pubState {
return &pubState{
ctx: ctx,
ns: ns,
diff --git a/runtimes/google/lib/publisher/publisher_test.go b/runtimes/google/lib/publisher/publisher_test.go
index 5e15a0f..cf00157 100644
--- a/runtimes/google/lib/publisher/publisher_test.go
+++ b/runtimes/google/lib/publisher/publisher_test.go
@@ -9,15 +9,14 @@
"v.io/core/veyron2/context"
"v.io/core/veyron2/naming"
- iipc "v.io/core/veyron/runtimes/google/ipc"
"v.io/core/veyron/runtimes/google/lib/publisher"
tnaming "v.io/core/veyron/runtimes/google/testing/mocks/naming"
"v.io/core/veyron/runtimes/google/testing/mocks/runtime"
"v.io/core/veyron/runtimes/google/vtrace"
)
-func testContext() context.T {
- ctx := iipc.InternalNewContext(&runtime.PanicRuntime{})
+func testContext() *context.T {
+ ctx := context.NewUninitializedContext(&runtime.PanicRuntime{})
ctx, _ = vtrace.WithNewSpan(ctx, "")
ctx, _ = ctx.WithDeadline(time.Now().Add(20 * time.Second))
return ctx
diff --git a/runtimes/google/naming/namespace/all_test.go b/runtimes/google/naming/namespace/all_test.go
index 9c76b45..f86af6a 100644
--- a/runtimes/google/naming/namespace/all_test.go
+++ b/runtimes/google/naming/namespace/all_test.go
@@ -140,7 +140,7 @@
}
}
-func doResolveTest(t *testing.T, fname string, f func(context.T, string, ...naming.ResolveOpt) ([]string, error), ctx context.T, name string, want []string, opts ...naming.ResolveOpt) {
+func doResolveTest(t *testing.T, fname string, f func(*context.T, string, ...naming.ResolveOpt) ([]string, error), ctx *context.T, name string, want []string, opts ...naming.ResolveOpt) {
servers, err := f(ctx, name, opts...)
if err != nil {
boom(t, "Failed to %s %s: %s", fname, name, err)
diff --git a/runtimes/google/naming/namespace/glob.go b/runtimes/google/naming/namespace/glob.go
index 3dc90e9..6d15ed7 100644
--- a/runtimes/google/naming/namespace/glob.go
+++ b/runtimes/google/naming/namespace/glob.go
@@ -29,7 +29,7 @@
// pelems the pattern to match relative to the mounted subtree.
// l the list to add results to.
// recursive true to continue below the matched pattern
-func (ns *namespace) globAtServer(ctx context.T, qe *queuedEntry, pattern *glob.Glob, l *list.List) error {
+func (ns *namespace) globAtServer(ctx *context.T, qe *queuedEntry, pattern *glob.Glob, l *list.List) error {
server := qe.me
client := veyron2.RuntimeFromContext(ctx).Client()
pstr := pattern.String()
@@ -107,7 +107,7 @@
}
// Glob implements naming.MountTable.Glob.
-func (ns *namespace) Glob(ctx context.T, pattern string) (chan naming.MountEntry, error) {
+func (ns *namespace) Glob(ctx *context.T, pattern string) (chan naming.MountEntry, error) {
defer vlog.LogCall()()
e, patternWasRooted := ns.rootMountEntry(pattern)
if len(e.Servers) == 0 {
@@ -140,7 +140,7 @@
return strings.Count(name, "/") + 1
}
-func (ns *namespace) globLoop(ctx context.T, e *naming.MountEntry, prefix string, pattern *glob.Glob, reply chan naming.MountEntry) {
+func (ns *namespace) globLoop(ctx *context.T, e *naming.MountEntry, prefix string, pattern *glob.Glob, reply chan naming.MountEntry) {
defer close(reply)
// As we encounter new mount tables while traversing the Glob, we add them to the list 'l'. The loop below
diff --git a/runtimes/google/naming/namespace/mount.go b/runtimes/google/naming/namespace/mount.go
index 1546d45..eb126dc 100644
--- a/runtimes/google/naming/namespace/mount.go
+++ b/runtimes/google/naming/namespace/mount.go
@@ -19,7 +19,7 @@
}
// mountIntoMountTable mounts a single server into a single mount table.
-func mountIntoMountTable(ctx context.T, client ipc.Client, name, server string, ttl time.Duration, flags naming.MountFlag, id string) (s status) {
+func mountIntoMountTable(ctx *context.T, client ipc.Client, name, server string, ttl time.Duration, flags naming.MountFlag, id string) (s status) {
s.id = id
ctx, _ = ctx.WithTimeout(callTimeout)
call, err := client.StartCall(ctx, name, "Mount", []interface{}{server, uint32(ttl.Seconds()), flags}, options.NoResolve(true))
@@ -34,7 +34,7 @@
}
// unmountFromMountTable removes a single mounted server from a single mount table.
-func unmountFromMountTable(ctx context.T, client ipc.Client, name, server string, id string) (s status) {
+func unmountFromMountTable(ctx *context.T, client ipc.Client, name, server string, id string) (s status) {
s.id = id
ctx, _ = ctx.WithTimeout(callTimeout)
call, err := client.StartCall(ctx, name, "Unmount", []interface{}{server}, options.NoResolve(true))
@@ -83,7 +83,7 @@
}
// dispatch executes f in parallel for each mount table implementing mTName.
-func (ns *namespace) dispatch(ctx context.T, mTName string, f func(context.T, string, string) status) error {
+func (ns *namespace) dispatch(ctx *context.T, mTName string, f func(*context.T, string, string) status) error {
// Resolve to all the mount tables implementing name.
mts, err := ns.ResolveToMountTable(ctx, mTName)
if err != nil {
@@ -102,7 +102,7 @@
return finalerr
}
-func (ns *namespace) Mount(ctx context.T, name, server string, ttl time.Duration, opts ...naming.MountOpt) error {
+func (ns *namespace) Mount(ctx *context.T, name, server string, ttl time.Duration, opts ...naming.MountOpt) error {
defer vlog.LogCall()()
var flags naming.MountFlag
@@ -123,7 +123,7 @@
client := veyron2.RuntimeFromContext(ctx).Client()
// Mount the server in all the returned mount tables.
- f := func(ctx context.T, mt, id string) status {
+ f := func(ctx *context.T, mt, id string) status {
return mountIntoMountTable(ctx, client, mt, server, ttl, flags, id)
}
err := ns.dispatch(ctx, name, f)
@@ -131,11 +131,11 @@
return err
}
-func (ns *namespace) Unmount(ctx context.T, name, server string) error {
+func (ns *namespace) Unmount(ctx *context.T, name, server string) error {
defer vlog.LogCall()()
// Unmount the server from all the mount tables.
client := veyron2.RuntimeFromContext(ctx).Client()
- f := func(context context.T, mt, id string) status {
+ f := func(context *context.T, mt, id string) status {
return unmountFromMountTable(ctx, client, mt, server, id)
}
err := ns.dispatch(ctx, name, f)
diff --git a/runtimes/google/naming/namespace/resolve.go b/runtimes/google/naming/namespace/resolve.go
index 097359a..1cd6005 100644
--- a/runtimes/google/naming/namespace/resolve.go
+++ b/runtimes/google/naming/namespace/resolve.go
@@ -14,7 +14,7 @@
"v.io/core/veyron2/vlog"
)
-func (ns *namespace) resolveAgainstMountTable(ctx context.T, client ipc.Client, e *naming.MountEntry, pattern string, opts ...ipc.CallOpt) (*naming.MountEntry, error) {
+func (ns *namespace) resolveAgainstMountTable(ctx *context.T, client ipc.Client, e *naming.MountEntry, pattern string, opts ...ipc.CallOpt) (*naming.MountEntry, error) {
// Try each server till one answers.
finalErr := errors.New("no servers to resolve query")
for _, s := range e.Servers {
@@ -69,7 +69,7 @@
}
// ResolveX implements veyron2/naming.Namespace.
-func (ns *namespace) ResolveX(ctx context.T, name string, opts ...naming.ResolveOpt) (*naming.MountEntry, error) {
+func (ns *namespace) ResolveX(ctx *context.T, name string, opts ...naming.ResolveOpt) (*naming.MountEntry, error) {
defer vlog.LogCall()()
e, _ := ns.rootMountEntry(name)
if vlog.V(2) {
@@ -119,7 +119,7 @@
}
// Resolve implements veyron2/naming.Namespace.
-func (ns *namespace) Resolve(ctx context.T, name string, opts ...naming.ResolveOpt) ([]string, error) {
+func (ns *namespace) Resolve(ctx *context.T, name string, opts ...naming.ResolveOpt) ([]string, error) {
defer vlog.LogCall()()
e, err := ns.ResolveX(ctx, name, opts...)
if err != nil {
@@ -129,7 +129,7 @@
}
// ResolveToMountTableX implements veyron2/naming.Namespace.
-func (ns *namespace) ResolveToMountTableX(ctx context.T, name string, opts ...naming.ResolveOpt) (*naming.MountEntry, error) {
+func (ns *namespace) ResolveToMountTableX(ctx *context.T, name string, opts ...naming.ResolveOpt) (*naming.MountEntry, error) {
defer vlog.LogCall()()
e, _ := ns.rootMountEntry(name)
if vlog.V(2) {
@@ -180,7 +180,7 @@
}
// ResolveToMountTable implements veyron2/naming.Namespace.
-func (ns *namespace) ResolveToMountTable(ctx context.T, name string, opts ...naming.ResolveOpt) ([]string, error) {
+func (ns *namespace) ResolveToMountTable(ctx *context.T, name string, opts ...naming.ResolveOpt) ([]string, error) {
defer vlog.LogCall()()
e, err := ns.ResolveToMountTableX(ctx, name, opts...)
if err != nil {
@@ -199,7 +199,7 @@
}
// TODO(caprita): UnresolveStep no longer exists.
-func unresolveAgainstServer(ctx context.T, client ipc.Client, names []string) ([]string, error) {
+func unresolveAgainstServer(ctx *context.T, client ipc.Client, names []string) ([]string, error) {
finalErr := errors.New("no servers to unresolve")
for _, name := range names {
callCtx, _ := ctx.WithTimeout(callTimeout)
@@ -229,7 +229,7 @@
// branches?).
// Unesolve implements veyron2/naming.Namespace.
-func (ns *namespace) Unresolve(ctx context.T, name string) ([]string, error) {
+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)
diff --git a/runtimes/google/rt/ipc.go b/runtimes/google/rt/ipc.go
index da8b27e..227455e 100644
--- a/runtimes/google/rt/ipc.go
+++ b/runtimes/google/rt/ipc.go
@@ -49,8 +49,8 @@
return rt.client
}
-func (rt *vrt) NewContext() context.T {
- ctx := iipc.InternalNewContext(rt)
+func (rt *vrt) NewContext() *context.T {
+ ctx := context.NewUninitializedContext(rt)
ctx = i18n.ContextWithLangID(ctx, rt.lang)
ctx = verror2.ContextWithComponentName(ctx, rt.program)
@@ -61,11 +61,11 @@
return ctx
}
-func (rt *vrt) WithNewSpan(ctx context.T, name string) (context.T, vtrace.Span) {
+func (rt *vrt) WithNewSpan(ctx *context.T, name string) (*context.T, vtrace.Span) {
return ivtrace.WithNewSpan(ctx, name)
}
-func (rt *vrt) SpanFromContext(ctx context.T) vtrace.Span {
+func (rt *vrt) SpanFromContext(ctx *context.T) vtrace.Span {
return ivtrace.FromContext(ctx)
}
diff --git a/runtimes/google/testing/mocks/ipc/simple_client.go b/runtimes/google/testing/mocks/ipc/simple_client.go
index 40bc9de..23a6b89 100644
--- a/runtimes/google/testing/mocks/ipc/simple_client.go
+++ b/runtimes/google/testing/mocks/ipc/simple_client.go
@@ -44,7 +44,7 @@
}
// StartCall Implements ipc.Client
-func (c *SimpleMockClient) StartCall(ctx context.T, name, method string, args []interface{}, opts ...ipc.CallOpt) (ipc.Call, error) {
+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 {
diff --git a/runtimes/google/testing/mocks/ipc/simple_client_test.go b/runtimes/google/testing/mocks/ipc/simple_client_test.go
index 9dcbc87..2ef7ba5 100644
--- a/runtimes/google/testing/mocks/ipc/simple_client_test.go
+++ b/runtimes/google/testing/mocks/ipc/simple_client_test.go
@@ -2,31 +2,12 @@
import (
"testing"
- "time"
"v.io/core/veyron2/context"
+
+ "v.io/core/veyron/runtimes/google/testing/mocks/runtime"
)
-type fakeContext struct{}
-
-func (*fakeContext) Deadline() (deadline time.Time, ok bool) { return }
-func (*fakeContext) Done() <-chan struct{} { return nil }
-func (*fakeContext) Err() error { return nil }
-func (*fakeContext) Value(key interface{}) interface{} { return nil }
-func (*fakeContext) Runtime() interface{} { return nil }
-func (*fakeContext) WithCancel() (context.T, context.CancelFunc) {
- return &fakeContext{}, func() {}
-}
-func (*fakeContext) WithDeadline(time.Time) (context.T, context.CancelFunc) {
- return &fakeContext{}, func() {}
-}
-func (*fakeContext) WithTimeout(time.Duration) (context.T, context.CancelFunc) {
- return &fakeContext{}, func() {}
-}
-func (*fakeContext) WithValue(k, v interface{}) context.T {
- return &fakeContext{}
-}
-
func TestSuccessfulCalls(t *testing.T) {
method1ExpectedResult := []interface{}{"one", 2}
@@ -39,7 +20,7 @@
"method3": method3ExpectedResult,
})
- ctx := &fakeContext{}
+ ctx := context.NewUninitializedContext(&runtime.PanicRuntime{})
// method1
method1Call, err := client.StartCall(ctx, "name/obj", "method1", []interface{}{})
@@ -95,7 +76,8 @@
sampleStruct{name: "bar"},
},
})
- call, _ := client.StartCall(&fakeContext{}, "name/obj", "foo", []interface{}{})
+ ctx := context.NewUninitializedContext(&runtime.PanicRuntime{})
+ call, _ := client.StartCall(ctx, "name/obj", "foo", []interface{}{})
var result sampleStruct
call.Finish(&result)
if result.name != "bar" {
@@ -108,7 +90,8 @@
client := NewSimpleClient(map[string][]interface{}{
"bar": []interface{}{},
})
- _, err := client.StartCall(&fakeContext{}, "name/obj", "wrongMethodName", []interface{}{})
+ ctx := context.NewUninitializedContext(&runtime.PanicRuntime{})
+ _, err := client.StartCall(ctx, "name/obj", "wrongMethodName", []interface{}{})
if err == nil {
t.Errorf(`StartCall: should have returned an error on invalid method name`)
return
@@ -122,7 +105,7 @@
})
errMsg := "Expected method to be called %d times but it was called %d"
- ctx := &fakeContext{}
+ ctx := context.NewUninitializedContext(&runtime.PanicRuntime{})
// method 1
if n := client.TimesCalled("method1"); n != 0 {
diff --git a/runtimes/google/testing/mocks/naming/namespace.go b/runtimes/google/testing/mocks/naming/namespace.go
index 6c68c83..b019b8c 100644
--- a/runtimes/google/testing/mocks/naming/namespace.go
+++ b/runtimes/google/testing/mocks/naming/namespace.go
@@ -32,7 +32,7 @@
ns naming.Namespace
}
-func (ns *namespace) Mount(ctx context.T, name, server string, _ time.Duration, _ ...naming.MountOpt) error {
+func (ns *namespace) Mount(ctx *context.T, name, server string, _ time.Duration, _ ...naming.MountOpt) error {
defer vlog.LogCall()()
ns.Lock()
defer ns.Unlock()
@@ -45,7 +45,7 @@
return nil
}
-func (ns *namespace) Unmount(ctx context.T, name, server string) error {
+func (ns *namespace) Unmount(ctx *context.T, name, server string) error {
defer vlog.LogCall()()
var servers []string
ns.Lock()
@@ -64,7 +64,7 @@
return nil
}
-func (ns *namespace) Resolve(ctx context.T, name string, opts ...naming.ResolveOpt) ([]string, error) {
+func (ns *namespace) Resolve(ctx *context.T, name string, opts ...naming.ResolveOpt) ([]string, error) {
defer vlog.LogCall()()
if address, _ := naming.SplitAddressName(name); len(address) > 0 {
return []string{name}, nil
@@ -84,7 +84,7 @@
return nil, verror.Make(naming.ErrNoSuchName, ctx, fmt.Sprintf("Resolve name %q not found in %v", name, ns.mounts))
}
-func (ns *namespace) ResolveX(ctx context.T, name string, opts ...naming.ResolveOpt) (*naming.MountEntry, error) {
+func (ns *namespace) ResolveX(ctx *context.T, name string, opts ...naming.ResolveOpt) (*naming.MountEntry, error) {
defer vlog.LogCall()()
e, err := ns.ns.ResolveX(ctx, name, naming.SkipResolveOpt{})
if err != nil {
@@ -110,21 +110,21 @@
return nil, verror.Make(naming.ErrNoSuchName, ctx, fmt.Sprintf("Resolve name %q not found in %v", name, ns.mounts))
}
-func (ns *namespace) ResolveToMountTableX(ctx context.T, name string, opts ...naming.ResolveOpt) (*naming.MountEntry, error) {
+func (ns *namespace) ResolveToMountTableX(ctx *context.T, name string, opts ...naming.ResolveOpt) (*naming.MountEntry, 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) ResolveToMountTable(ctx context.T, name string, opts ...naming.ResolveOpt) ([]string, error) {
+func (ns *namespace) ResolveToMountTable(ctx *context.T, name string, opts ...naming.ResolveOpt) ([]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) {
+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")
@@ -141,7 +141,7 @@
return nil
}
-func (ns *namespace) Glob(ctx context.T, pattern string) (chan naming.MountEntry, error) {
+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")
diff --git a/runtimes/google/testing/mocks/runtime/panic_runtime.go b/runtimes/google/testing/mocks/runtime/panic_runtime.go
index 694d3d7..84b8d8b 100644
--- a/runtimes/google/testing/mocks/runtime/panic_runtime.go
+++ b/runtimes/google/testing/mocks/runtime/panic_runtime.go
@@ -30,11 +30,11 @@
func (*PanicRuntime) NewClient(opts ...ipc.ClientOpt) (ipc.Client, error) { panic(badRuntime) }
func (*PanicRuntime) NewServer(opts ...ipc.ServerOpt) (ipc.Server, error) { panic(badRuntime) }
func (*PanicRuntime) Client() ipc.Client { panic(badRuntime) }
-func (*PanicRuntime) NewContext() context.T { panic(badRuntime) }
+func (*PanicRuntime) NewContext() *context.T { panic(badRuntime) }
-func (PanicRuntime) WithNewSpan(c context.T, m string) (context.T, vtrace.Span) { return c, &span{m} }
+func (PanicRuntime) WithNewSpan(c *context.T, m string) (*context.T, vtrace.Span) { return c, &span{m} }
-func (*PanicRuntime) SpanFromContext(context.T) vtrace.Span { return &span{} }
+func (*PanicRuntime) SpanFromContext(*context.T) vtrace.Span { return &span{} }
func (*PanicRuntime) NewStreamManager(opts ...stream.ManagerOpt) (stream.Manager, error) {
panic(badRuntime)
}
diff --git a/runtimes/google/vtrace/collector.go b/runtimes/google/vtrace/collector.go
index aed4e01..ab7000c 100644
--- a/runtimes/google/vtrace/collector.go
+++ b/runtimes/google/vtrace/collector.go
@@ -164,7 +164,7 @@
}
// MergeResponse merges a vtrace.Response into the current trace.
-func MergeResponse(ctx context.T, response *vtrace.Response) {
+func MergeResponse(ctx *context.T, response *vtrace.Response) {
if span := getSpan(ctx); span != nil {
span.collector.merge(span, response)
}
diff --git a/runtimes/google/vtrace/vtrace.go b/runtimes/google/vtrace/vtrace.go
index 9f4c357..84c2825 100644
--- a/runtimes/google/vtrace/vtrace.go
+++ b/runtimes/google/vtrace/vtrace.go
@@ -51,7 +51,7 @@
func (c *span) Finish() { c.collector.finish(c) }
// Request generates a vtrace.Request from the active Span.
-func Request(ctx context.T) vtrace.Request {
+func Request(ctx *context.T) vtrace.Request {
if span := getSpan(ctx); span != nil {
return vtrace.Request{
SpanID: span.id,
@@ -63,7 +63,7 @@
}
// Response captures the vtrace.Response for the active Span.
-func Response(ctx context.T) vtrace.Response {
+func Response(ctx *context.T) vtrace.Response {
if span := getSpan(ctx); span != nil {
return span.collector.response()
}
@@ -76,7 +76,7 @@
// ContinuedSpan creates a span that represents a continuation of a trace from
// a remote server. name is a user readable string that describes the context
// and req contains the parameters needed to connect this span with it's trace.
-func WithContinuedSpan(ctx context.T, name string, req vtrace.Request, store *Store) (context.T, vtrace.Span) {
+func WithContinuedSpan(ctx *context.T, name string, req vtrace.Request, store *Store) (*context.T, vtrace.Span) {
newSpan := newSpan(req.SpanID, name, newCollector(req.TraceID, store))
if req.Method == vtrace.InMemory {
newSpan.collector.ForceCollect()
@@ -84,7 +84,7 @@
return ctx.WithValue(spanKey{}, newSpan), newSpan
}
-func WithNewRootSpan(ctx context.T, store *Store, forceCollect bool) (context.T, vtrace.Span) {
+func WithNewRootSpan(ctx *context.T, store *Store, forceCollect bool) (*context.T, vtrace.Span) {
id, err := uniqueid.Random()
if err != nil {
vlog.Errorf("vtrace: Couldn't generate Trace ID, debug data may be lost: %v", err)
@@ -99,7 +99,7 @@
}
// NewSpan creates a new span.
-func WithNewSpan(parent context.T, name string) (context.T, vtrace.Span) {
+func WithNewSpan(parent *context.T, name string) (*context.T, vtrace.Span) {
if curSpan := getSpan(parent); curSpan != nil {
s := newSpan(curSpan.ID(), name, curSpan.collector)
return parent.WithValue(spanKey{}, s), s
@@ -109,13 +109,13 @@
return WithNewRootSpan(parent, nil, false)
}
-func getSpan(ctx context.T) *span {
+func getSpan(ctx *context.T) *span {
span, _ := ctx.Value(spanKey{}).(*span)
return span
}
// GetSpan returns the active span from the context.
-func FromContext(ctx context.T) vtrace.Span {
+func FromContext(ctx *context.T) vtrace.Span {
span, _ := ctx.Value(spanKey{}).(vtrace.Span)
return span
}
diff --git a/runtimes/google/vtrace/vtrace_test.go b/runtimes/google/vtrace/vtrace_test.go
index 8fc9cf9..398a3ed 100644
--- a/runtimes/google/vtrace/vtrace_test.go
+++ b/runtimes/google/vtrace/vtrace_test.go
@@ -25,8 +25,8 @@
// can't create a real runtime in the runtime implementation
// so we use a fake one that panics if used. The runtime
// implementation should not ever use the Runtime from a context.
-func testContext() context.T {
- return iipc.InternalNewContext(&truntime.PanicRuntime{})
+func testContext() *context.T {
+ return context.NewUninitializedContext(&truntime.PanicRuntime{})
}
func TestNewFromContext(t *testing.T) {
@@ -34,7 +34,7 @@
c1, s1 := ivtrace.WithNewSpan(c0, "s1")
c2, s2 := ivtrace.WithNewSpan(c1, "s2")
c3, s3 := ivtrace.WithNewSpan(c2, "s3")
- expected := map[context.T]vtrace.Span{
+ expected := map[*context.T]vtrace.Span{
c0: nil,
c1: s1,
c2: s2,
@@ -199,7 +199,7 @@
}
}
-func runCallChain(t *testing.T, ctx context.T, force1, force2 bool) {
+func runCallChain(t *testing.T, ctx *context.T, force1, force2 bool) {
sm := manager.InternalNew(naming.FixedRoutingID(0x555555555))
ns := tnaming.NewSimpleNamespace()
diff --git a/security/agent/client.go b/security/agent/client.go
index 2b654b2..38b9d49 100644
--- a/security/agent/client.go
+++ b/security/agent/client.go
@@ -28,7 +28,7 @@
type caller struct {
client ipc.Client
name string
- ctx context.T
+ ctx *context.T
}
func (c *caller) call(name string, results []interface{}, args ...interface{}) (err error) {
@@ -53,7 +53,7 @@
// 'fd' is the socket for connecting to the agent, typically obtained from
// os.GetEnv(agent.FdVarName).
// 'ctx' should not have a deadline, and should never be cancelled.
-func NewAgentPrincipal(c ipc.Client, fd int, ctx context.T) (security.Principal, error) {
+func NewAgentPrincipal(c ipc.Client, fd int, ctx *context.T) (security.Principal, error) {
f := os.NewFile(uintptr(fd), "agent_client")
defer f.Close()
conn, err := net.FileConn(f)
diff --git a/security/agent/keymgr/client.go b/security/agent/keymgr/client.go
index d963d6b..3d0641c 100644
--- a/security/agent/keymgr/client.go
+++ b/security/agent/keymgr/client.go
@@ -47,12 +47,12 @@
return &Agent{conn: conn.(*net.UnixConn)}, nil
}
-// TODO(caprita): Get rid of context.T arg. Doesn't seem to be used.
+// TODO(caprita): Get rid of *context.T arg. Doesn't seem to be used.
// NewPrincipal creates a new principal and returns the handle and a socket serving
// the principal.
// Typically the socket will be passed to a child process using cmd.ExtraFiles.
-func (a *Agent) NewPrincipal(ctx context.T, inMemory bool) (handle []byte, conn *os.File, err error) {
+func (a *Agent) NewPrincipal(ctx *context.T, inMemory bool) (handle []byte, conn *os.File, err error) {
req := make([]byte, 1)
if inMemory {
req[0] = 1
diff --git a/security/agent/pingpong/wire.vdl.go b/security/agent/pingpong/wire.vdl.go
index 4339076..e3ca4f7 100644
--- a/security/agent/pingpong/wire.vdl.go
+++ b/security/agent/pingpong/wire.vdl.go
@@ -22,7 +22,7 @@
//
// Simple service used in the agent tests.
type PingPongClientMethods interface {
- Ping(ctx __context.T, message string, opts ...__ipc.CallOpt) (string, error)
+ Ping(ctx *__context.T, message string, opts ...__ipc.CallOpt) (string, error)
}
// PingPongClientStub adds universal methods to PingPongClientMethods.
@@ -47,14 +47,14 @@
client __ipc.Client
}
-func (c implPingPongClientStub) c(ctx __context.T) __ipc.Client {
+func (c implPingPongClientStub) c(ctx *__context.T) __ipc.Client {
if c.client != nil {
return c.client
}
return __veyron2.RuntimeFromContext(ctx).Client()
}
-func (c implPingPongClientStub) Ping(ctx __context.T, i0 string, opts ...__ipc.CallOpt) (o0 string, err error) {
+func (c implPingPongClientStub) Ping(ctx *__context.T, i0 string, opts ...__ipc.CallOpt) (o0 string, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Ping", []interface{}{i0}, opts...); err != nil {
return
@@ -65,7 +65,7 @@
return
}
-func (c implPingPongClientStub) Signature(ctx __context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
+func (c implPingPongClientStub) Signature(ctx *__context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Signature", nil, opts...); err != nil {
return
diff --git a/security/agent/server/wire.vdl.go b/security/agent/server/wire.vdl.go
index 2e4166a..a40d840 100644
--- a/security/agent/server/wire.vdl.go
+++ b/security/agent/server/wire.vdl.go
@@ -22,23 +22,23 @@
// AgentClientMethods is the client interface
// containing Agent methods.
type AgentClientMethods interface {
- Bless(ctx __context.T, key []byte, wit security.WireBlessings, extension string, caveat security.Caveat, additionalCaveats []security.Caveat, opts ...__ipc.CallOpt) (security.WireBlessings, error)
- BlessSelf(ctx __context.T, name string, caveats []security.Caveat, opts ...__ipc.CallOpt) (security.WireBlessings, error)
- Sign(ctx __context.T, message []byte, opts ...__ipc.CallOpt) (security.Signature, error)
- MintDischarge(ctx __context.T, tp __vdlutil.Any, caveat security.Caveat, additionalCaveats []security.Caveat, opts ...__ipc.CallOpt) (__vdlutil.Any, error)
- PublicKey(__context.T, ...__ipc.CallOpt) ([]byte, error)
- BlessingsByName(ctx __context.T, name security.BlessingPattern, opts ...__ipc.CallOpt) ([]security.WireBlessings, error)
- BlessingsInfo(ctx __context.T, blessings security.WireBlessings, opts ...__ipc.CallOpt) ([]string, error)
- AddToRoots(ctx __context.T, blessing security.WireBlessings, opts ...__ipc.CallOpt) error
- BlessingStoreSet(ctx __context.T, blessings security.WireBlessings, forPeers security.BlessingPattern, opts ...__ipc.CallOpt) (security.WireBlessings, error)
- BlessingStoreForPeer(ctx __context.T, peerBlessings []string, opts ...__ipc.CallOpt) (security.WireBlessings, error)
- BlessingStoreSetDefault(ctx __context.T, blessings security.WireBlessings, opts ...__ipc.CallOpt) error
- BlessingStoreDefault(__context.T, ...__ipc.CallOpt) (security.WireBlessings, error)
- BlessingStorePeerBlessings(__context.T, ...__ipc.CallOpt) (map[security.BlessingPattern]security.WireBlessings, error)
- BlessingStoreDebugString(__context.T, ...__ipc.CallOpt) (string, error)
- BlessingRootsAdd(ctx __context.T, root []byte, pattern security.BlessingPattern, opts ...__ipc.CallOpt) error
- BlessingRootsRecognized(ctx __context.T, root []byte, blessing string, opts ...__ipc.CallOpt) error
- BlessingRootsDebugString(__context.T, ...__ipc.CallOpt) (string, error)
+ Bless(ctx *__context.T, key []byte, wit security.WireBlessings, extension string, caveat security.Caveat, additionalCaveats []security.Caveat, opts ...__ipc.CallOpt) (security.WireBlessings, error)
+ BlessSelf(ctx *__context.T, name string, caveats []security.Caveat, opts ...__ipc.CallOpt) (security.WireBlessings, error)
+ Sign(ctx *__context.T, message []byte, opts ...__ipc.CallOpt) (security.Signature, error)
+ MintDischarge(ctx *__context.T, tp __vdlutil.Any, caveat security.Caveat, additionalCaveats []security.Caveat, opts ...__ipc.CallOpt) (__vdlutil.Any, error)
+ PublicKey(*__context.T, ...__ipc.CallOpt) ([]byte, error)
+ BlessingsByName(ctx *__context.T, name security.BlessingPattern, opts ...__ipc.CallOpt) ([]security.WireBlessings, error)
+ BlessingsInfo(ctx *__context.T, blessings security.WireBlessings, opts ...__ipc.CallOpt) ([]string, error)
+ AddToRoots(ctx *__context.T, blessing security.WireBlessings, opts ...__ipc.CallOpt) error
+ BlessingStoreSet(ctx *__context.T, blessings security.WireBlessings, forPeers security.BlessingPattern, opts ...__ipc.CallOpt) (security.WireBlessings, error)
+ BlessingStoreForPeer(ctx *__context.T, peerBlessings []string, opts ...__ipc.CallOpt) (security.WireBlessings, error)
+ BlessingStoreSetDefault(ctx *__context.T, blessings security.WireBlessings, opts ...__ipc.CallOpt) error
+ BlessingStoreDefault(*__context.T, ...__ipc.CallOpt) (security.WireBlessings, error)
+ BlessingStorePeerBlessings(*__context.T, ...__ipc.CallOpt) (map[security.BlessingPattern]security.WireBlessings, error)
+ BlessingStoreDebugString(*__context.T, ...__ipc.CallOpt) (string, error)
+ BlessingRootsAdd(ctx *__context.T, root []byte, pattern security.BlessingPattern, opts ...__ipc.CallOpt) error
+ BlessingRootsRecognized(ctx *__context.T, root []byte, blessing string, opts ...__ipc.CallOpt) error
+ BlessingRootsDebugString(*__context.T, ...__ipc.CallOpt) (string, error)
}
// AgentClientStub adds universal methods to AgentClientMethods.
@@ -63,14 +63,14 @@
client __ipc.Client
}
-func (c implAgentClientStub) c(ctx __context.T) __ipc.Client {
+func (c implAgentClientStub) c(ctx *__context.T) __ipc.Client {
if c.client != nil {
return c.client
}
return __veyron2.RuntimeFromContext(ctx).Client()
}
-func (c implAgentClientStub) Bless(ctx __context.T, i0 []byte, i1 security.WireBlessings, i2 string, i3 security.Caveat, i4 []security.Caveat, opts ...__ipc.CallOpt) (o0 security.WireBlessings, err error) {
+func (c implAgentClientStub) Bless(ctx *__context.T, i0 []byte, i1 security.WireBlessings, i2 string, i3 security.Caveat, i4 []security.Caveat, opts ...__ipc.CallOpt) (o0 security.WireBlessings, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Bless", []interface{}{i0, i1, i2, i3, i4}, opts...); err != nil {
return
@@ -81,7 +81,7 @@
return
}
-func (c implAgentClientStub) BlessSelf(ctx __context.T, i0 string, i1 []security.Caveat, opts ...__ipc.CallOpt) (o0 security.WireBlessings, err error) {
+func (c implAgentClientStub) BlessSelf(ctx *__context.T, i0 string, i1 []security.Caveat, opts ...__ipc.CallOpt) (o0 security.WireBlessings, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "BlessSelf", []interface{}{i0, i1}, opts...); err != nil {
return
@@ -92,7 +92,7 @@
return
}
-func (c implAgentClientStub) Sign(ctx __context.T, i0 []byte, opts ...__ipc.CallOpt) (o0 security.Signature, err error) {
+func (c implAgentClientStub) Sign(ctx *__context.T, i0 []byte, opts ...__ipc.CallOpt) (o0 security.Signature, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Sign", []interface{}{i0}, opts...); err != nil {
return
@@ -103,7 +103,7 @@
return
}
-func (c implAgentClientStub) MintDischarge(ctx __context.T, i0 __vdlutil.Any, i1 security.Caveat, i2 []security.Caveat, opts ...__ipc.CallOpt) (o0 __vdlutil.Any, err error) {
+func (c implAgentClientStub) MintDischarge(ctx *__context.T, i0 __vdlutil.Any, i1 security.Caveat, i2 []security.Caveat, opts ...__ipc.CallOpt) (o0 __vdlutil.Any, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "MintDischarge", []interface{}{i0, i1, i2}, opts...); err != nil {
return
@@ -114,7 +114,7 @@
return
}
-func (c implAgentClientStub) PublicKey(ctx __context.T, opts ...__ipc.CallOpt) (o0 []byte, err error) {
+func (c implAgentClientStub) PublicKey(ctx *__context.T, opts ...__ipc.CallOpt) (o0 []byte, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "PublicKey", nil, opts...); err != nil {
return
@@ -125,7 +125,7 @@
return
}
-func (c implAgentClientStub) BlessingsByName(ctx __context.T, i0 security.BlessingPattern, opts ...__ipc.CallOpt) (o0 []security.WireBlessings, err error) {
+func (c implAgentClientStub) BlessingsByName(ctx *__context.T, i0 security.BlessingPattern, opts ...__ipc.CallOpt) (o0 []security.WireBlessings, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "BlessingsByName", []interface{}{i0}, opts...); err != nil {
return
@@ -136,7 +136,7 @@
return
}
-func (c implAgentClientStub) BlessingsInfo(ctx __context.T, i0 security.WireBlessings, opts ...__ipc.CallOpt) (o0 []string, err error) {
+func (c implAgentClientStub) BlessingsInfo(ctx *__context.T, i0 security.WireBlessings, opts ...__ipc.CallOpt) (o0 []string, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "BlessingsInfo", []interface{}{i0}, opts...); err != nil {
return
@@ -147,7 +147,7 @@
return
}
-func (c implAgentClientStub) AddToRoots(ctx __context.T, i0 security.WireBlessings, opts ...__ipc.CallOpt) (err error) {
+func (c implAgentClientStub) AddToRoots(ctx *__context.T, i0 security.WireBlessings, opts ...__ipc.CallOpt) (err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "AddToRoots", []interface{}{i0}, opts...); err != nil {
return
@@ -158,7 +158,7 @@
return
}
-func (c implAgentClientStub) BlessingStoreSet(ctx __context.T, i0 security.WireBlessings, i1 security.BlessingPattern, opts ...__ipc.CallOpt) (o0 security.WireBlessings, err error) {
+func (c implAgentClientStub) BlessingStoreSet(ctx *__context.T, i0 security.WireBlessings, i1 security.BlessingPattern, opts ...__ipc.CallOpt) (o0 security.WireBlessings, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "BlessingStoreSet", []interface{}{i0, i1}, opts...); err != nil {
return
@@ -169,7 +169,7 @@
return
}
-func (c implAgentClientStub) BlessingStoreForPeer(ctx __context.T, i0 []string, opts ...__ipc.CallOpt) (o0 security.WireBlessings, err error) {
+func (c implAgentClientStub) BlessingStoreForPeer(ctx *__context.T, i0 []string, opts ...__ipc.CallOpt) (o0 security.WireBlessings, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "BlessingStoreForPeer", []interface{}{i0}, opts...); err != nil {
return
@@ -180,7 +180,7 @@
return
}
-func (c implAgentClientStub) BlessingStoreSetDefault(ctx __context.T, i0 security.WireBlessings, opts ...__ipc.CallOpt) (err error) {
+func (c implAgentClientStub) BlessingStoreSetDefault(ctx *__context.T, i0 security.WireBlessings, opts ...__ipc.CallOpt) (err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "BlessingStoreSetDefault", []interface{}{i0}, opts...); err != nil {
return
@@ -191,7 +191,7 @@
return
}
-func (c implAgentClientStub) BlessingStoreDefault(ctx __context.T, opts ...__ipc.CallOpt) (o0 security.WireBlessings, err error) {
+func (c implAgentClientStub) BlessingStoreDefault(ctx *__context.T, opts ...__ipc.CallOpt) (o0 security.WireBlessings, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "BlessingStoreDefault", nil, opts...); err != nil {
return
@@ -202,7 +202,7 @@
return
}
-func (c implAgentClientStub) BlessingStorePeerBlessings(ctx __context.T, opts ...__ipc.CallOpt) (o0 map[security.BlessingPattern]security.WireBlessings, err error) {
+func (c implAgentClientStub) BlessingStorePeerBlessings(ctx *__context.T, opts ...__ipc.CallOpt) (o0 map[security.BlessingPattern]security.WireBlessings, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "BlessingStorePeerBlessings", nil, opts...); err != nil {
return
@@ -213,7 +213,7 @@
return
}
-func (c implAgentClientStub) BlessingStoreDebugString(ctx __context.T, opts ...__ipc.CallOpt) (o0 string, err error) {
+func (c implAgentClientStub) BlessingStoreDebugString(ctx *__context.T, opts ...__ipc.CallOpt) (o0 string, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "BlessingStoreDebugString", nil, opts...); err != nil {
return
@@ -224,7 +224,7 @@
return
}
-func (c implAgentClientStub) BlessingRootsAdd(ctx __context.T, i0 []byte, i1 security.BlessingPattern, opts ...__ipc.CallOpt) (err error) {
+func (c implAgentClientStub) BlessingRootsAdd(ctx *__context.T, i0 []byte, i1 security.BlessingPattern, opts ...__ipc.CallOpt) (err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "BlessingRootsAdd", []interface{}{i0, i1}, opts...); err != nil {
return
@@ -235,7 +235,7 @@
return
}
-func (c implAgentClientStub) BlessingRootsRecognized(ctx __context.T, i0 []byte, i1 string, opts ...__ipc.CallOpt) (err error) {
+func (c implAgentClientStub) BlessingRootsRecognized(ctx *__context.T, i0 []byte, i1 string, opts ...__ipc.CallOpt) (err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "BlessingRootsRecognized", []interface{}{i0, i1}, opts...); err != nil {
return
@@ -246,7 +246,7 @@
return
}
-func (c implAgentClientStub) BlessingRootsDebugString(ctx __context.T, opts ...__ipc.CallOpt) (o0 string, err error) {
+func (c implAgentClientStub) BlessingRootsDebugString(ctx *__context.T, opts ...__ipc.CallOpt) (o0 string, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "BlessingRootsDebugString", nil, opts...); err != nil {
return
@@ -257,7 +257,7 @@
return
}
-func (c implAgentClientStub) Signature(ctx __context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
+func (c implAgentClientStub) Signature(ctx *__context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Signature", nil, opts...); err != nil {
return
diff --git a/services/identity/identity.vdl.go b/services/identity/identity.vdl.go
index 4aa4423..c7b6dd2 100644
--- a/services/identity/identity.vdl.go
+++ b/services/identity/identity.vdl.go
@@ -39,7 +39,7 @@
type OAuthBlesserClientMethods interface {
// BlessUsingAccessToken uses the provided access token to obtain the email
// address and returns a blessing along with the email address.
- BlessUsingAccessToken(ctx __context.T, token string, opts ...__ipc.CallOpt) (blessing security.WireBlessings, email string, err error)
+ BlessUsingAccessToken(ctx *__context.T, token string, opts ...__ipc.CallOpt) (blessing security.WireBlessings, email string, err error)
}
// OAuthBlesserClientStub adds universal methods to OAuthBlesserClientMethods.
@@ -64,14 +64,14 @@
client __ipc.Client
}
-func (c implOAuthBlesserClientStub) c(ctx __context.T) __ipc.Client {
+func (c implOAuthBlesserClientStub) c(ctx *__context.T) __ipc.Client {
if c.client != nil {
return c.client
}
return __veyron2.RuntimeFromContext(ctx).Client()
}
-func (c implOAuthBlesserClientStub) BlessUsingAccessToken(ctx __context.T, i0 string, opts ...__ipc.CallOpt) (o0 security.WireBlessings, o1 string, err error) {
+func (c implOAuthBlesserClientStub) BlessUsingAccessToken(ctx *__context.T, i0 string, opts ...__ipc.CallOpt) (o0 security.WireBlessings, o1 string, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "BlessUsingAccessToken", []interface{}{i0}, opts...); err != nil {
return
@@ -82,7 +82,7 @@
return
}
-func (c implOAuthBlesserClientStub) Signature(ctx __context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
+func (c implOAuthBlesserClientStub) Signature(ctx *__context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Signature", nil, opts...); err != nil {
return
@@ -241,7 +241,7 @@
type MacaroonBlesserClientMethods interface {
// Bless uses the provided macaroon (which contains email and caveats)
// to return a blessing for the client.
- Bless(ctx __context.T, macaroon string, opts ...__ipc.CallOpt) (blessing security.WireBlessings, err error)
+ Bless(ctx *__context.T, macaroon string, opts ...__ipc.CallOpt) (blessing security.WireBlessings, err error)
}
// MacaroonBlesserClientStub adds universal methods to MacaroonBlesserClientMethods.
@@ -266,14 +266,14 @@
client __ipc.Client
}
-func (c implMacaroonBlesserClientStub) c(ctx __context.T) __ipc.Client {
+func (c implMacaroonBlesserClientStub) c(ctx *__context.T) __ipc.Client {
if c.client != nil {
return c.client
}
return __veyron2.RuntimeFromContext(ctx).Client()
}
-func (c implMacaroonBlesserClientStub) Bless(ctx __context.T, i0 string, opts ...__ipc.CallOpt) (o0 security.WireBlessings, err error) {
+func (c implMacaroonBlesserClientStub) Bless(ctx *__context.T, i0 string, opts ...__ipc.CallOpt) (o0 security.WireBlessings, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Bless", []interface{}{i0}, opts...); err != nil {
return
@@ -284,7 +284,7 @@
return
}
-func (c implMacaroonBlesserClientStub) Signature(ctx __context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
+func (c implMacaroonBlesserClientStub) Signature(ctx *__context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Signature", nil, opts...); err != nil {
return
diff --git a/services/mgmt/debug/dispatcher_test.go b/services/mgmt/debug/dispatcher_test.go
index d138978..2f93483 100644
--- a/services/mgmt/debug/dispatcher_test.go
+++ b/services/mgmt/debug/dispatcher_test.go
@@ -56,7 +56,7 @@
}
defer runtime.Cleanup()
- tracedContext := func() context.T {
+ tracedContext := func() *context.T {
ctx := runtime.NewContext()
vtrace.FromContext(ctx).Trace().ForceCollect()
return ctx
diff --git a/services/mgmt/device/config.vdl.go b/services/mgmt/device/config.vdl.go
index 2fd44cd..b8eb6fd 100644
--- a/services/mgmt/device/config.vdl.go
+++ b/services/mgmt/device/config.vdl.go
@@ -23,7 +23,7 @@
// Config is an RPC API to the config service.
type ConfigClientMethods interface {
// Set sets the value for key.
- Set(ctx __context.T, key string, value string, opts ...__ipc.CallOpt) error
+ Set(ctx *__context.T, key string, value string, opts ...__ipc.CallOpt) error
}
// ConfigClientStub adds universal methods to ConfigClientMethods.
@@ -48,14 +48,14 @@
client __ipc.Client
}
-func (c implConfigClientStub) c(ctx __context.T) __ipc.Client {
+func (c implConfigClientStub) c(ctx *__context.T) __ipc.Client {
if c.client != nil {
return c.client
}
return __veyron2.RuntimeFromContext(ctx).Client()
}
-func (c implConfigClientStub) Set(ctx __context.T, i0 string, i1 string, opts ...__ipc.CallOpt) (err error) {
+func (c implConfigClientStub) Set(ctx *__context.T, i0 string, i1 string, opts ...__ipc.CallOpt) (err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Set", []interface{}{i0, i1}, opts...); err != nil {
return
@@ -66,7 +66,7 @@
return
}
-func (c implConfigClientStub) Signature(ctx __context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
+func (c implConfigClientStub) Signature(ctx *__context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Signature", nil, opts...); err != nil {
return
diff --git a/services/mgmt/device/impl/app_service.go b/services/mgmt/device/impl/app_service.go
index bde4143..740c859 100644
--- a/services/mgmt/device/impl/app_service.go
+++ b/services/mgmt/device/impl/app_service.go
@@ -310,7 +310,7 @@
return nil
}
-func fetchAppEnvelope(ctx context.T, origin string) (*application.Envelope, error) {
+func fetchAppEnvelope(ctx *context.T, origin string) (*application.Envelope, error) {
envelope, err := fetchEnvelope(ctx, origin)
if err != nil {
return nil, err
@@ -324,7 +324,7 @@
}
// newVersion sets up the directory for a new application version.
-func newVersion(ctx context.T, installationDir string, envelope *application.Envelope, oldVersionDir string) (string, error) {
+func newVersion(ctx *context.T, installationDir string, envelope *application.Envelope, oldVersionDir string) (string, error) {
versionDir := filepath.Join(installationDir, generateVersionDirName())
if err := mkdir(versionDir); err != nil {
return "", verror2.Make(ErrOperationFailed, nil)
@@ -455,7 +455,7 @@
}
// setupPrincipal sets up the instance's principal, with the right blessings.
-func setupPrincipal(ctx context.T, instanceDir, versionDir string, call ipc.ServerContext, securityAgent *securityAgentState, info *instanceInfo) error {
+func setupPrincipal(ctx *context.T, instanceDir, versionDir string, call ipc.ServerContext, securityAgent *securityAgentState, info *instanceInfo) error {
var p security.Principal
if securityAgent != nil {
// TODO(caprita): Part of the cleanup upon destroying an
@@ -938,7 +938,7 @@
return i.run(veyron2.RuntimeFromContext(call.Context()).Namespace().Roots(), instanceDir, systemName)
}
-func stopAppRemotely(ctx context.T, appVON string) error {
+func stopAppRemotely(ctx *context.T, appVON string) error {
appStub := appcycle.AppCycleClient(appVON)
ctx, cancel := ctx.WithTimeout(ipcContextTimeout)
defer cancel()
@@ -962,7 +962,7 @@
return nil
}
-func stop(ctx context.T, instanceDir string) error {
+func stop(ctx *context.T, instanceDir string) error {
info, err := loadInstanceInfo(instanceDir)
if err != nil {
return err
diff --git a/services/mgmt/device/impl/callback.go b/services/mgmt/device/impl/callback.go
index c1ed6a6..174aec5 100644
--- a/services/mgmt/device/impl/callback.go
+++ b/services/mgmt/device/impl/callback.go
@@ -11,7 +11,7 @@
// InvokeCallback provides the parent device manager with the given name (which
// is expected to be this device manager's object name).
-func InvokeCallback(ctx context.T, name string) {
+func InvokeCallback(ctx *context.T, name string) {
handle, err := exec.GetChildHandle()
switch err {
case nil:
diff --git a/services/mgmt/device/impl/device_service.go b/services/mgmt/device/impl/device_service.go
index 22eabf8..08e9e86 100644
--- a/services/mgmt/device/impl/device_service.go
+++ b/services/mgmt/device/impl/device_service.go
@@ -152,7 +152,7 @@
return link, scriptPath, nil
}
-func (s *deviceService) revertDeviceManager(ctx context.T) error {
+func (s *deviceService) revertDeviceManager(ctx *context.T) error {
if err := updateLink(s.config.Previous, s.config.CurrentLink); err != nil {
return err
}
@@ -177,7 +177,7 @@
// TODO(cnicolaou): would this be better implemented using the modules
// framework now that it exists?
-func (s *deviceService) testDeviceManager(ctx context.T, workspace string, envelope *application.Envelope) error {
+func (s *deviceService) testDeviceManager(ctx *context.T, workspace string, envelope *application.Envelope) error {
path := filepath.Join(workspace, "deviced.sh")
cmd := exec.Command(path)
@@ -299,7 +299,7 @@
return nil
}
-func (s *deviceService) updateDeviceManager(ctx context.T) error {
+func (s *deviceService) updateDeviceManager(ctx *context.T) error {
if len(s.config.Origin) == 0 {
return verror2.Make(ErrUpdateNoOp, ctx)
}
diff --git a/services/mgmt/device/impl/impl_test.go b/services/mgmt/device/impl/impl_test.go
index 995b964..1113c34 100644
--- a/services/mgmt/device/impl/impl_test.go
+++ b/services/mgmt/device/impl/impl_test.go
@@ -757,7 +757,7 @@
return runtime
}
-func tryInstall(ctx context.T) error {
+func tryInstall(ctx *context.T) error {
appsName := "dm//apps"
stub := device.ApplicationClient(appsName)
if _, err := stub.Install(ctx, mockApplicationRepoName); err != nil {
diff --git a/services/mgmt/device/impl/util.go b/services/mgmt/device/impl/util.go
index 8a83af4..fd2d7f3 100644
--- a/services/mgmt/device/impl/util.go
+++ b/services/mgmt/device/impl/util.go
@@ -23,7 +23,7 @@
ipcContextTimeout = time.Minute
)
-func downloadBinary(ctx context.T, workspace, fileName, name string) error {
+func downloadBinary(ctx *context.T, workspace, fileName, name string) error {
data, _, err := binary.Download(ctx, name)
if err != nil {
vlog.Errorf("Download(%v) failed: %v", name, err)
@@ -37,7 +37,7 @@
return nil
}
-func fetchEnvelope(ctx context.T, origin string) (*application.Envelope, error) {
+func fetchEnvelope(ctx *context.T, origin string) (*application.Envelope, error) {
stub := repository.ApplicationClient(origin)
// TODO(jsimsa): Include logic that computes the set of supported
// profiles.
diff --git a/services/mgmt/lib/binary/impl.go b/services/mgmt/lib/binary/impl.go
index 6171670..ea7f6ec 100644
--- a/services/mgmt/lib/binary/impl.go
+++ b/services/mgmt/lib/binary/impl.go
@@ -35,7 +35,7 @@
subpartSize = 1 << 12
)
-func Delete(ctx context.T, name string) error {
+func Delete(ctx *context.T, name string) error {
ctx, cancel := ctx.WithTimeout(time.Minute)
defer cancel()
if err := repository.BinaryClient(name).Delete(ctx); err != nil {
@@ -51,7 +51,7 @@
offset int64
}
-func downloadPartAttempt(ctx context.T, w io.WriteSeeker, client repository.BinaryClientStub, ip *indexedPart) bool {
+func downloadPartAttempt(ctx *context.T, w io.WriteSeeker, client repository.BinaryClientStub, ip *indexedPart) bool {
ctx, cancel := ctx.WithCancel()
defer cancel()
@@ -95,7 +95,7 @@
return true
}
-func downloadPart(ctx context.T, w io.WriteSeeker, client repository.BinaryClientStub, ip *indexedPart) bool {
+func downloadPart(ctx *context.T, w io.WriteSeeker, client repository.BinaryClientStub, ip *indexedPart) bool {
for i := 0; i < nAttempts; i++ {
if downloadPartAttempt(ctx, w, client, ip) {
return true
@@ -104,7 +104,7 @@
return false
}
-func download(ctx context.T, w io.WriteSeeker, von string) (repository.MediaInfo, error) {
+func download(ctx *context.T, w io.WriteSeeker, von string) (repository.MediaInfo, error) {
client := repository.BinaryClient(von)
parts, mediaInfo, err := client.Stat(ctx)
if err != nil {
@@ -127,7 +127,7 @@
return mediaInfo, nil
}
-func Download(ctx context.T, von string) ([]byte, repository.MediaInfo, error) {
+func Download(ctx *context.T, von string) ([]byte, repository.MediaInfo, error) {
dir, prefix := "", ""
file, err := ioutil.TempFile(dir, prefix)
if err != nil {
@@ -150,7 +150,7 @@
return bytes, mediaInfo, nil
}
-func DownloadToFile(ctx context.T, von, path string) error {
+func DownloadToFile(ctx *context.T, von, path string) error {
dir, prefix := "", ""
file, err := ioutil.TempFile(dir, prefix)
if err != nil {
@@ -192,7 +192,7 @@
return nil
}
-func DownloadURL(ctx context.T, von string) (string, int64, error) {
+func DownloadURL(ctx *context.T, von string) (string, int64, error) {
ctx, cancel := ctx.WithTimeout(time.Minute)
defer cancel()
url, ttl, err := repository.BinaryClient(von).DownloadURL(ctx)
@@ -203,7 +203,7 @@
return url, ttl, nil
}
-func uploadPartAttempt(ctx context.T, r io.ReadSeeker, client repository.BinaryClientStub, part int, size int64) (bool, error) {
+func uploadPartAttempt(ctx *context.T, r io.ReadSeeker, client repository.BinaryClientStub, part int, size int64) (bool, error) {
ctx, cancel := ctx.WithCancel()
defer cancel()
@@ -274,7 +274,7 @@
return true, nil
}
-func uploadPart(ctx context.T, r io.ReadSeeker, client repository.BinaryClientStub, part int, size int64) error {
+func uploadPart(ctx *context.T, r io.ReadSeeker, client repository.BinaryClientStub, part int, size int64) error {
for i := 0; i < nAttempts; i++ {
if success, err := uploadPartAttempt(ctx, r, client, part, size); success || err != nil {
return err
@@ -283,7 +283,7 @@
return verror.Make(errOperationFailed, ctx)
}
-func upload(ctx context.T, r io.ReadSeeker, mediaInfo repository.MediaInfo, von string) error {
+func upload(ctx *context.T, r io.ReadSeeker, mediaInfo repository.MediaInfo, von string) error {
client := repository.BinaryClient(von)
offset, whence := int64(0), 2
size, err := r.Seek(offset, whence)
@@ -304,14 +304,14 @@
return nil
}
-func Upload(ctx context.T, von string, data []byte, mediaInfo repository.MediaInfo) error {
+func Upload(ctx *context.T, von string, data []byte, mediaInfo repository.MediaInfo) error {
buffer := bytes.NewReader(data)
ctx, cancel := ctx.WithTimeout(time.Minute)
defer cancel()
return upload(ctx, buffer, mediaInfo, von)
}
-func UploadFromFile(ctx context.T, von, path string) error {
+func UploadFromFile(ctx *context.T, von, path string) error {
file, err := os.Open(path)
defer file.Close()
if err != nil {
@@ -324,7 +324,7 @@
return upload(ctx, file, mediaInfo, von)
}
-func UploadFromDir(ctx context.T, von, sourceDir string) error {
+func UploadFromDir(ctx *context.T, von, sourceDir string) error {
dir, err := ioutil.TempDir("", "create-package-")
if err != nil {
return err
diff --git a/services/mgmt/repository/repository.vdl.go b/services/mgmt/repository/repository.vdl.go
index 8ded95a..2f10e48 100644
--- a/services/mgmt/repository/repository.vdl.go
+++ b/services/mgmt/repository/repository.vdl.go
@@ -48,7 +48,7 @@
// Put adds the given tuple of application version (specified
// through the object name suffix) and application envelope to all
// of the given application profiles.
- Put(ctx __context.T, Profiles []string, Envelope application.Envelope, opts ...__ipc.CallOpt) error
+ Put(ctx *__context.T, Profiles []string, Envelope application.Envelope, opts ...__ipc.CallOpt) error
// Remove removes the application envelope for the given profile
// name and application version (specified through the object name
// suffix). If no version is specified as part of the suffix, the
@@ -56,7 +56,7 @@
//
// TODO(jsimsa): Add support for using "*" to specify all profiles
// when Matt implements Globing (or Ken implements querying).
- Remove(ctx __context.T, Profile string, opts ...__ipc.CallOpt) error
+ Remove(ctx *__context.T, Profile string, opts ...__ipc.CallOpt) error
}
// ApplicationClientStub adds universal methods to ApplicationClientMethods.
@@ -83,14 +83,14 @@
repository.ApplicationClientStub
}
-func (c implApplicationClientStub) c(ctx __context.T) __ipc.Client {
+func (c implApplicationClientStub) c(ctx *__context.T) __ipc.Client {
if c.client != nil {
return c.client
}
return __veyron2.RuntimeFromContext(ctx).Client()
}
-func (c implApplicationClientStub) Put(ctx __context.T, i0 []string, i1 application.Envelope, opts ...__ipc.CallOpt) (err error) {
+func (c implApplicationClientStub) Put(ctx *__context.T, i0 []string, i1 application.Envelope, opts ...__ipc.CallOpt) (err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Put", []interface{}{i0, i1}, opts...); err != nil {
return
@@ -101,7 +101,7 @@
return
}
-func (c implApplicationClientStub) Remove(ctx __context.T, i0 string, opts ...__ipc.CallOpt) (err error) {
+func (c implApplicationClientStub) Remove(ctx *__context.T, i0 string, opts ...__ipc.CallOpt) (err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Remove", []interface{}{i0}, opts...); err != nil {
return
@@ -112,7 +112,7 @@
return
}
-func (c implApplicationClientStub) Signature(ctx __context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
+func (c implApplicationClientStub) Signature(ctx *__context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Signature", nil, opts...); err != nil {
return
@@ -352,13 +352,13 @@
repository.ProfileClientMethods
// Specification returns the profile specification for the profile
// identified through the object name suffix.
- Specification(__context.T, ...__ipc.CallOpt) (profile.Specification, error)
+ Specification(*__context.T, ...__ipc.CallOpt) (profile.Specification, error)
// Put sets the profile specification for the profile identified
// through the object name suffix.
- Put(ctx __context.T, Specification profile.Specification, opts ...__ipc.CallOpt) error
+ Put(ctx *__context.T, Specification profile.Specification, opts ...__ipc.CallOpt) error
// Remove removes the profile specification for the profile
// identified through the object name suffix.
- Remove(__context.T, ...__ipc.CallOpt) error
+ Remove(*__context.T, ...__ipc.CallOpt) error
}
// ProfileClientStub adds universal methods to ProfileClientMethods.
@@ -385,14 +385,14 @@
repository.ProfileClientStub
}
-func (c implProfileClientStub) c(ctx __context.T) __ipc.Client {
+func (c implProfileClientStub) c(ctx *__context.T) __ipc.Client {
if c.client != nil {
return c.client
}
return __veyron2.RuntimeFromContext(ctx).Client()
}
-func (c implProfileClientStub) Specification(ctx __context.T, opts ...__ipc.CallOpt) (o0 profile.Specification, err error) {
+func (c implProfileClientStub) Specification(ctx *__context.T, opts ...__ipc.CallOpt) (o0 profile.Specification, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Specification", nil, opts...); err != nil {
return
@@ -403,7 +403,7 @@
return
}
-func (c implProfileClientStub) Put(ctx __context.T, i0 profile.Specification, opts ...__ipc.CallOpt) (err error) {
+func (c implProfileClientStub) Put(ctx *__context.T, i0 profile.Specification, opts ...__ipc.CallOpt) (err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Put", []interface{}{i0}, opts...); err != nil {
return
@@ -414,7 +414,7 @@
return
}
-func (c implProfileClientStub) Remove(ctx __context.T, opts ...__ipc.CallOpt) (err error) {
+func (c implProfileClientStub) Remove(ctx *__context.T, opts ...__ipc.CallOpt) (err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Remove", nil, opts...); err != nil {
return
@@ -425,7 +425,7 @@
return
}
-func (c implProfileClientStub) Signature(ctx __context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
+func (c implProfileClientStub) Signature(ctx *__context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Signature", nil, opts...); err != nil {
return
diff --git a/services/mounttable/lib/collection_test_interface.vdl.go b/services/mounttable/lib/collection_test_interface.vdl.go
index 1c9f8d9..8fc2ae9 100644
--- a/services/mounttable/lib/collection_test_interface.vdl.go
+++ b/services/mounttable/lib/collection_test_interface.vdl.go
@@ -24,10 +24,10 @@
// an entry exists, if Overwrite is true, then the binding is replaced,
// otherwise the call fails with an error. The Val must be no larger than
// MaxSize bytes.
- Export(ctx __context.T, Val string, Overwrite bool, opts ...__ipc.CallOpt) error
+ Export(ctx *__context.T, Val string, Overwrite bool, opts ...__ipc.CallOpt) error
// Lookup retrieves the value associated with a name. Returns an error if
// there is no such binding.
- Lookup(__context.T, ...__ipc.CallOpt) ([]byte, error)
+ Lookup(*__context.T, ...__ipc.CallOpt) ([]byte, error)
}
// CollectionClientStub adds universal methods to CollectionClientMethods.
@@ -52,14 +52,14 @@
client __ipc.Client
}
-func (c implCollectionClientStub) c(ctx __context.T) __ipc.Client {
+func (c implCollectionClientStub) c(ctx *__context.T) __ipc.Client {
if c.client != nil {
return c.client
}
return __veyron2.RuntimeFromContext(ctx).Client()
}
-func (c implCollectionClientStub) Export(ctx __context.T, i0 string, i1 bool, opts ...__ipc.CallOpt) (err error) {
+func (c implCollectionClientStub) Export(ctx *__context.T, i0 string, i1 bool, opts ...__ipc.CallOpt) (err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Export", []interface{}{i0, i1}, opts...); err != nil {
return
@@ -70,7 +70,7 @@
return
}
-func (c implCollectionClientStub) Lookup(ctx __context.T, opts ...__ipc.CallOpt) (o0 []byte, err error) {
+func (c implCollectionClientStub) Lookup(ctx *__context.T, opts ...__ipc.CallOpt) (o0 []byte, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Lookup", nil, opts...); err != nil {
return
@@ -81,7 +81,7 @@
return
}
-func (c implCollectionClientStub) Signature(ctx __context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
+func (c implCollectionClientStub) Signature(ctx *__context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Signature", nil, opts...); err != nil {
return
diff --git a/services/security/discharger.vdl.go b/services/security/discharger.vdl.go
index 8523827..55ff551 100644
--- a/services/security/discharger.vdl.go
+++ b/services/security/discharger.vdl.go
@@ -32,7 +32,7 @@
// respectively. (not enforced here because vdl does not know these types)
// TODO(ataly,ashankar): Figure out a VDL representation for ThirdPartyCaveat
// and Discharge and use those here?
- Discharge(ctx __context.T, Caveat __vdlutil.Any, Impetus security.DischargeImpetus, opts ...__ipc.CallOpt) (Discharge __vdlutil.Any, err error)
+ Discharge(ctx *__context.T, Caveat __vdlutil.Any, Impetus security.DischargeImpetus, opts ...__ipc.CallOpt) (Discharge __vdlutil.Any, err error)
}
// DischargerClientStub adds universal methods to DischargerClientMethods.
@@ -57,14 +57,14 @@
client __ipc.Client
}
-func (c implDischargerClientStub) c(ctx __context.T) __ipc.Client {
+func (c implDischargerClientStub) c(ctx *__context.T) __ipc.Client {
if c.client != nil {
return c.client
}
return __veyron2.RuntimeFromContext(ctx).Client()
}
-func (c implDischargerClientStub) Discharge(ctx __context.T, i0 __vdlutil.Any, i1 security.DischargeImpetus, opts ...__ipc.CallOpt) (o0 __vdlutil.Any, err error) {
+func (c implDischargerClientStub) Discharge(ctx *__context.T, i0 __vdlutil.Any, i1 security.DischargeImpetus, opts ...__ipc.CallOpt) (o0 __vdlutil.Any, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Discharge", []interface{}{i0, i1}, opts...); err != nil {
return
@@ -75,7 +75,7 @@
return
}
-func (c implDischargerClientStub) Signature(ctx __context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
+func (c implDischargerClientStub) Signature(ctx *__context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Signature", nil, opts...); err != nil {
return
diff --git a/tools/application/impl.go b/tools/application/impl.go
index 183b966..2321350 100644
--- a/tools/application/impl.go
+++ b/tools/application/impl.go
@@ -17,7 +17,7 @@
"v.io/lib/cmdline"
)
-func getEnvelopeJSON(ctx context.T, app repository.ApplicationClientMethods, profiles string) ([]byte, error) {
+func getEnvelopeJSON(ctx *context.T, app repository.ApplicationClientMethods, profiles string) ([]byte, error) {
env, err := app.Match(ctx, strings.Split(profiles, ","))
if err != nil {
return nil, err
@@ -29,7 +29,7 @@
return j, nil
}
-func putEnvelopeJSON(ctx context.T, app repository.ApplicationClientMethods, profiles string, j []byte) error {
+func putEnvelopeJSON(ctx *context.T, app repository.ApplicationClientMethods, profiles string, j []byte) error {
var env application.Envelope
if err := json.Unmarshal(j, &env); err != nil {
return fmt.Errorf("Unmarshal(%v) failed: %v", string(j), err)
diff --git a/tools/build/impl.go b/tools/build/impl.go
index e426a86..3df7bd0 100644
--- a/tools/build/impl.go
+++ b/tools/build/impl.go
@@ -108,7 +108,7 @@
return nil
}
-func getSources(ctx context.T, pkgMap map[string]*build.Package, errchan chan<- error) <-chan vbuild.File {
+func getSources(ctx *context.T, pkgMap map[string]*build.Package, errchan chan<- error) <-chan vbuild.File {
sources := make(chan vbuild.File)
go func() {
defer close(sources)
@@ -135,7 +135,7 @@
return sources
}
-func invokeBuild(ctx context.T, name string, sources <-chan vbuild.File, errchan chan<- error) <-chan vbuild.File {
+func invokeBuild(ctx *context.T, name string, sources <-chan vbuild.File, errchan chan<- error) <-chan vbuild.File {
binaries := make(chan vbuild.File)
go func() {
defer close(binaries)
@@ -181,7 +181,7 @@
return binaries
}
-func saveBinaries(ctx context.T, prefix string, binaries <-chan vbuild.File, errchan chan<- error) {
+func saveBinaries(ctx *context.T, prefix string, binaries <-chan vbuild.File, errchan chan<- error) {
go func() {
for binary := range binaries {
select {
diff --git a/tools/debug/impl.go b/tools/debug/impl.go
index a37355a..41f2461 100644
--- a/tools/debug/impl.go
+++ b/tools/debug/impl.go
@@ -73,7 +73,7 @@
`,
}
-func doFetchTrace(ctx context.T, wg *sync.WaitGroup, client vtracesvc.StoreClientStub,
+func doFetchTrace(ctx *context.T, wg *sync.WaitGroup, client vtracesvc.StoreClientStub,
id uniqueid.ID, traces chan *vtrace.TraceRecord, errors chan error) {
defer wg.Done()
@@ -176,7 +176,7 @@
// doGlobs calls Glob on multiple patterns in parallel and sends all the results
// on the results channel and all the errors on the errors channel. It closes
// the results channel when all the results have been sent.
-func doGlobs(ctx context.T, patterns []string, results chan<- naming.MountEntry, errors chan<- error) {
+func doGlobs(ctx *context.T, patterns []string, results chan<- naming.MountEntry, errors chan<- error) {
var wg sync.WaitGroup
wg.Add(len(patterns))
for _, p := range patterns {
@@ -188,7 +188,7 @@
}()
}
-func doGlob(ctx context.T, pattern string, results chan<- naming.MountEntry, errors chan<- error, wg *sync.WaitGroup) {
+func doGlob(ctx *context.T, pattern string, results chan<- naming.MountEntry, errors chan<- error, wg *sync.WaitGroup) {
defer wg.Done()
ctx, cancel := ctx.WithTimeout(time.Minute)
defer cancel()
@@ -317,7 +317,7 @@
}
}
-func doValue(ctx context.T, name string, output chan<- string, errors chan<- error, wg *sync.WaitGroup) {
+func doValue(ctx *context.T, name string, output chan<- string, errors chan<- error, wg *sync.WaitGroup) {
defer wg.Done()
ctx, cancel := ctx.WithTimeout(time.Minute)
defer cancel()
@@ -372,7 +372,7 @@
}
}
-func doWatch(ctx context.T, pattern string, results chan<- string, errors chan<- error, wg *sync.WaitGroup) {
+func doWatch(ctx *context.T, pattern string, results chan<- string, errors chan<- error, wg *sync.WaitGroup) {
defer wg.Done()
root, globPattern := naming.SplitAddressName(pattern)
g, err := glob.Parse(globPattern)
diff --git a/tools/naming/simulator/shell_functions.go b/tools/naming/simulator/shell_functions.go
index 321b71e..a2eeed0 100644
--- a/tools/naming/simulator/shell_functions.go
+++ b/tools/naming/simulator/shell_functions.go
@@ -86,7 +86,7 @@
return nil
}
-type resolver func(ctx context.T, name string, opts ...naming.ResolveOpt) (names []string, err error)
+type resolver func(ctx *context.T, name string, opts ...naming.ResolveOpt) (names []string, err error)
func resolve(fn resolver, stdin io.Reader, stdout, stderr io.Writer, env map[string]string, args ...string) error {
if err := checkArgs(args[1:], 1, "<name>"); err != nil {
diff --git a/tools/vrpc/impl.go b/tools/vrpc/impl.go
index d75c8f8..57695ba 100644
--- a/tools/vrpc/impl.go
+++ b/tools/vrpc/impl.go
@@ -207,7 +207,7 @@
return client, nil
}
-func getSignature(ctx context.T, cmd *cmdline.Command, server string, client ipc.Client) (ipc.ServiceSignature, error) {
+func getSignature(ctx *context.T, cmd *cmdline.Command, server string, client ipc.Client) (ipc.ServiceSignature, error) {
call, err := client.StartCall(ctx, server, "Signature", nil)
if err != nil {
return ipc.ServiceSignature{}, fmt.Errorf("client.StartCall(%s, Signature, nil) failed with %v", server, err)
diff --git a/tools/vrpc/test_base/test_base.vdl.go b/tools/vrpc/test_base/test_base.vdl.go
index b4ec876..956570d 100644
--- a/tools/vrpc/test_base/test_base.vdl.go
+++ b/tools/vrpc/test_base/test_base.vdl.go
@@ -37,29 +37,29 @@
// containing TypeTester methods.
type TypeTesterClientMethods interface {
// Methods to test support for generic types.
- EchoBool(ctx __context.T, I1 bool, opts ...__ipc.CallOpt) (O1 bool, err error)
- EchoFloat32(ctx __context.T, I1 float32, opts ...__ipc.CallOpt) (O1 float32, err error)
- EchoFloat64(ctx __context.T, I1 float64, opts ...__ipc.CallOpt) (O1 float64, err error)
- EchoInt32(ctx __context.T, I1 int32, opts ...__ipc.CallOpt) (O1 int32, err error)
- EchoInt64(ctx __context.T, I1 int64, opts ...__ipc.CallOpt) (O1 int64, err error)
- EchoString(ctx __context.T, I1 string, opts ...__ipc.CallOpt) (O1 string, err error)
- EchoByte(ctx __context.T, I1 byte, opts ...__ipc.CallOpt) (O1 byte, err error)
- EchoUInt32(ctx __context.T, I1 uint32, opts ...__ipc.CallOpt) (O1 uint32, err error)
- EchoUInt64(ctx __context.T, I1 uint64, opts ...__ipc.CallOpt) (O1 uint64, err error)
+ EchoBool(ctx *__context.T, I1 bool, opts ...__ipc.CallOpt) (O1 bool, err error)
+ EchoFloat32(ctx *__context.T, I1 float32, opts ...__ipc.CallOpt) (O1 float32, err error)
+ EchoFloat64(ctx *__context.T, I1 float64, opts ...__ipc.CallOpt) (O1 float64, err error)
+ EchoInt32(ctx *__context.T, I1 int32, opts ...__ipc.CallOpt) (O1 int32, err error)
+ EchoInt64(ctx *__context.T, I1 int64, opts ...__ipc.CallOpt) (O1 int64, err error)
+ EchoString(ctx *__context.T, I1 string, opts ...__ipc.CallOpt) (O1 string, err error)
+ EchoByte(ctx *__context.T, I1 byte, opts ...__ipc.CallOpt) (O1 byte, err error)
+ EchoUInt32(ctx *__context.T, I1 uint32, opts ...__ipc.CallOpt) (O1 uint32, err error)
+ EchoUInt64(ctx *__context.T, I1 uint64, opts ...__ipc.CallOpt) (O1 uint64, err error)
// Methods to test support for composite types.
- InputArray(ctx __context.T, I1 [2]byte, opts ...__ipc.CallOpt) error
- InputMap(ctx __context.T, I1 map[byte]byte, opts ...__ipc.CallOpt) error
- InputSlice(ctx __context.T, I1 []byte, opts ...__ipc.CallOpt) error
- InputStruct(ctx __context.T, I1 Struct, opts ...__ipc.CallOpt) error
- OutputArray(__context.T, ...__ipc.CallOpt) (O1 [2]byte, err error)
- OutputMap(__context.T, ...__ipc.CallOpt) (O1 map[byte]byte, err error)
- OutputSlice(__context.T, ...__ipc.CallOpt) (O1 []byte, err error)
- OutputStruct(__context.T, ...__ipc.CallOpt) (O1 Struct, err error)
+ InputArray(ctx *__context.T, I1 [2]byte, opts ...__ipc.CallOpt) error
+ InputMap(ctx *__context.T, I1 map[byte]byte, opts ...__ipc.CallOpt) error
+ InputSlice(ctx *__context.T, I1 []byte, opts ...__ipc.CallOpt) error
+ InputStruct(ctx *__context.T, I1 Struct, opts ...__ipc.CallOpt) error
+ OutputArray(*__context.T, ...__ipc.CallOpt) (O1 [2]byte, err error)
+ OutputMap(*__context.T, ...__ipc.CallOpt) (O1 map[byte]byte, err error)
+ OutputSlice(*__context.T, ...__ipc.CallOpt) (O1 []byte, err error)
+ OutputStruct(*__context.T, ...__ipc.CallOpt) (O1 Struct, err error)
// Methods to test support for different number of arguments.
- NoArguments(__context.T, ...__ipc.CallOpt) error
- MultipleArguments(ctx __context.T, I1 int32, I2 int32, opts ...__ipc.CallOpt) (O1 int32, O2 int32, err error)
+ NoArguments(*__context.T, ...__ipc.CallOpt) error
+ MultipleArguments(ctx *__context.T, I1 int32, I2 int32, opts ...__ipc.CallOpt) (O1 int32, O2 int32, err error)
// Methods to test support for streaming.
- StreamingOutput(ctx __context.T, NumStreamItems int32, StreamItem bool, opts ...__ipc.CallOpt) (TypeTesterStreamingOutputCall, error)
+ StreamingOutput(ctx *__context.T, NumStreamItems int32, StreamItem bool, opts ...__ipc.CallOpt) (TypeTesterStreamingOutputCall, error)
}
// TypeTesterClientStub adds universal methods to TypeTesterClientMethods.
@@ -84,14 +84,14 @@
client __ipc.Client
}
-func (c implTypeTesterClientStub) c(ctx __context.T) __ipc.Client {
+func (c implTypeTesterClientStub) c(ctx *__context.T) __ipc.Client {
if c.client != nil {
return c.client
}
return __veyron2.RuntimeFromContext(ctx).Client()
}
-func (c implTypeTesterClientStub) EchoBool(ctx __context.T, i0 bool, opts ...__ipc.CallOpt) (o0 bool, err error) {
+func (c implTypeTesterClientStub) EchoBool(ctx *__context.T, i0 bool, opts ...__ipc.CallOpt) (o0 bool, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoBool", []interface{}{i0}, opts...); err != nil {
return
@@ -102,7 +102,7 @@
return
}
-func (c implTypeTesterClientStub) EchoFloat32(ctx __context.T, i0 float32, opts ...__ipc.CallOpt) (o0 float32, err error) {
+func (c implTypeTesterClientStub) EchoFloat32(ctx *__context.T, i0 float32, opts ...__ipc.CallOpt) (o0 float32, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoFloat32", []interface{}{i0}, opts...); err != nil {
return
@@ -113,7 +113,7 @@
return
}
-func (c implTypeTesterClientStub) EchoFloat64(ctx __context.T, i0 float64, opts ...__ipc.CallOpt) (o0 float64, err error) {
+func (c implTypeTesterClientStub) EchoFloat64(ctx *__context.T, i0 float64, opts ...__ipc.CallOpt) (o0 float64, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoFloat64", []interface{}{i0}, opts...); err != nil {
return
@@ -124,7 +124,7 @@
return
}
-func (c implTypeTesterClientStub) EchoInt32(ctx __context.T, i0 int32, opts ...__ipc.CallOpt) (o0 int32, err error) {
+func (c implTypeTesterClientStub) EchoInt32(ctx *__context.T, i0 int32, opts ...__ipc.CallOpt) (o0 int32, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoInt32", []interface{}{i0}, opts...); err != nil {
return
@@ -135,7 +135,7 @@
return
}
-func (c implTypeTesterClientStub) EchoInt64(ctx __context.T, i0 int64, opts ...__ipc.CallOpt) (o0 int64, err error) {
+func (c implTypeTesterClientStub) EchoInt64(ctx *__context.T, i0 int64, opts ...__ipc.CallOpt) (o0 int64, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoInt64", []interface{}{i0}, opts...); err != nil {
return
@@ -146,7 +146,7 @@
return
}
-func (c implTypeTesterClientStub) EchoString(ctx __context.T, i0 string, opts ...__ipc.CallOpt) (o0 string, err error) {
+func (c implTypeTesterClientStub) EchoString(ctx *__context.T, i0 string, opts ...__ipc.CallOpt) (o0 string, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoString", []interface{}{i0}, opts...); err != nil {
return
@@ -157,7 +157,7 @@
return
}
-func (c implTypeTesterClientStub) EchoByte(ctx __context.T, i0 byte, opts ...__ipc.CallOpt) (o0 byte, err error) {
+func (c implTypeTesterClientStub) EchoByte(ctx *__context.T, i0 byte, opts ...__ipc.CallOpt) (o0 byte, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoByte", []interface{}{i0}, opts...); err != nil {
return
@@ -168,7 +168,7 @@
return
}
-func (c implTypeTesterClientStub) EchoUInt32(ctx __context.T, i0 uint32, opts ...__ipc.CallOpt) (o0 uint32, err error) {
+func (c implTypeTesterClientStub) EchoUInt32(ctx *__context.T, i0 uint32, opts ...__ipc.CallOpt) (o0 uint32, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoUInt32", []interface{}{i0}, opts...); err != nil {
return
@@ -179,7 +179,7 @@
return
}
-func (c implTypeTesterClientStub) EchoUInt64(ctx __context.T, i0 uint64, opts ...__ipc.CallOpt) (o0 uint64, err error) {
+func (c implTypeTesterClientStub) EchoUInt64(ctx *__context.T, i0 uint64, opts ...__ipc.CallOpt) (o0 uint64, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "EchoUInt64", []interface{}{i0}, opts...); err != nil {
return
@@ -190,7 +190,7 @@
return
}
-func (c implTypeTesterClientStub) InputArray(ctx __context.T, i0 [2]byte, opts ...__ipc.CallOpt) (err error) {
+func (c implTypeTesterClientStub) InputArray(ctx *__context.T, i0 [2]byte, opts ...__ipc.CallOpt) (err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "InputArray", []interface{}{i0}, opts...); err != nil {
return
@@ -201,7 +201,7 @@
return
}
-func (c implTypeTesterClientStub) InputMap(ctx __context.T, i0 map[byte]byte, opts ...__ipc.CallOpt) (err error) {
+func (c implTypeTesterClientStub) InputMap(ctx *__context.T, i0 map[byte]byte, opts ...__ipc.CallOpt) (err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "InputMap", []interface{}{i0}, opts...); err != nil {
return
@@ -212,7 +212,7 @@
return
}
-func (c implTypeTesterClientStub) InputSlice(ctx __context.T, i0 []byte, opts ...__ipc.CallOpt) (err error) {
+func (c implTypeTesterClientStub) InputSlice(ctx *__context.T, i0 []byte, opts ...__ipc.CallOpt) (err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "InputSlice", []interface{}{i0}, opts...); err != nil {
return
@@ -223,7 +223,7 @@
return
}
-func (c implTypeTesterClientStub) InputStruct(ctx __context.T, i0 Struct, opts ...__ipc.CallOpt) (err error) {
+func (c implTypeTesterClientStub) InputStruct(ctx *__context.T, i0 Struct, opts ...__ipc.CallOpt) (err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "InputStruct", []interface{}{i0}, opts...); err != nil {
return
@@ -234,7 +234,7 @@
return
}
-func (c implTypeTesterClientStub) OutputArray(ctx __context.T, opts ...__ipc.CallOpt) (o0 [2]byte, err error) {
+func (c implTypeTesterClientStub) OutputArray(ctx *__context.T, opts ...__ipc.CallOpt) (o0 [2]byte, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "OutputArray", nil, opts...); err != nil {
return
@@ -245,7 +245,7 @@
return
}
-func (c implTypeTesterClientStub) OutputMap(ctx __context.T, opts ...__ipc.CallOpt) (o0 map[byte]byte, err error) {
+func (c implTypeTesterClientStub) OutputMap(ctx *__context.T, opts ...__ipc.CallOpt) (o0 map[byte]byte, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "OutputMap", nil, opts...); err != nil {
return
@@ -256,7 +256,7 @@
return
}
-func (c implTypeTesterClientStub) OutputSlice(ctx __context.T, opts ...__ipc.CallOpt) (o0 []byte, err error) {
+func (c implTypeTesterClientStub) OutputSlice(ctx *__context.T, opts ...__ipc.CallOpt) (o0 []byte, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "OutputSlice", nil, opts...); err != nil {
return
@@ -267,7 +267,7 @@
return
}
-func (c implTypeTesterClientStub) OutputStruct(ctx __context.T, opts ...__ipc.CallOpt) (o0 Struct, err error) {
+func (c implTypeTesterClientStub) OutputStruct(ctx *__context.T, opts ...__ipc.CallOpt) (o0 Struct, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "OutputStruct", nil, opts...); err != nil {
return
@@ -278,7 +278,7 @@
return
}
-func (c implTypeTesterClientStub) NoArguments(ctx __context.T, opts ...__ipc.CallOpt) (err error) {
+func (c implTypeTesterClientStub) NoArguments(ctx *__context.T, opts ...__ipc.CallOpt) (err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "NoArguments", nil, opts...); err != nil {
return
@@ -289,7 +289,7 @@
return
}
-func (c implTypeTesterClientStub) MultipleArguments(ctx __context.T, i0 int32, i1 int32, opts ...__ipc.CallOpt) (o0 int32, o1 int32, err error) {
+func (c implTypeTesterClientStub) MultipleArguments(ctx *__context.T, i0 int32, i1 int32, opts ...__ipc.CallOpt) (o0 int32, o1 int32, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "MultipleArguments", []interface{}{i0, i1}, opts...); err != nil {
return
@@ -300,7 +300,7 @@
return
}
-func (c implTypeTesterClientStub) StreamingOutput(ctx __context.T, i0 int32, i1 bool, opts ...__ipc.CallOpt) (ocall TypeTesterStreamingOutputCall, err error) {
+func (c implTypeTesterClientStub) StreamingOutput(ctx *__context.T, i0 int32, i1 bool, opts ...__ipc.CallOpt) (ocall TypeTesterStreamingOutputCall, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "StreamingOutput", []interface{}{i0, i1}, opts...); err != nil {
return
@@ -309,7 +309,7 @@
return
}
-func (c implTypeTesterClientStub) Signature(ctx __context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
+func (c implTypeTesterClientStub) Signature(ctx *__context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Signature", nil, opts...); err != nil {
return