blob: 786b02108e924cf670ed90b35a05a0da91cbe068 [file] [log] [blame]
Jiri Simsad7616c92015-03-24 23:44:30 -07001// Copyright 2015 The Vanadium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
Matt Rosencrantz94502cf2015-03-18 09:43:44 -07005package fake
6
7import (
8 "v.io/v23/context"
Suharsh Sivakumar5859f5a2015-08-09 22:49:43 -07009 "v.io/v23/flow"
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070010 "v.io/v23/rpc"
Todd Wang96f300a2015-08-27 17:40:45 -070011 "v.io/v23/security"
Cosmos Nicolaouf3c19092015-05-27 17:53:37 -070012 "v.io/x/ref/lib/apilog"
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070013)
14
15// SetClient can be used to inject a mock client implementation into the context.
16func SetClient(ctx *context.T, client rpc.Client) *context.T {
17 return context.WithValue(ctx, clientKey, client)
18}
Todd Wangad492042015-04-17 15:58:40 -070019func (r *Runtime) WithNewClient(ctx *context.T, opts ...rpc.ClientOpt) (*context.T, rpc.Client, error) {
Cosmos Nicolaouf3c19092015-05-27 17:53:37 -070020 defer apilog.LogCallf(ctx, "opts...=%v", opts)(ctx, "") // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070021 panic("unimplemented")
22}
23func (r *Runtime) GetClient(ctx *context.T) rpc.Client {
Cosmos Nicolaouf3c19092015-05-27 17:53:37 -070024 defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070025 c, _ := ctx.Value(clientKey).(rpc.Client)
26 return c
27}
28
Matt Rosencrantz98d6d7c2015-09-04 12:34:08 -070029func (r *Runtime) NewServer(ctx *context.T, opts ...rpc.ServerOpt) (rpc.DeprecatedServer, error) {
Cosmos Nicolaouf3c19092015-05-27 17:53:37 -070030 defer apilog.LogCallf(ctx, "opts...=%v", opts)(ctx, "") // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070031 panic("unimplemented")
32}
Todd Wangad492042015-04-17 15:58:40 -070033func (r *Runtime) WithNewStreamManager(ctx *context.T) (*context.T, error) {
Cosmos Nicolaouf3c19092015-05-27 17:53:37 -070034 defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070035 panic("unimplemented")
36}
37
38func (r *Runtime) GetListenSpec(ctx *context.T) rpc.ListenSpec {
Cosmos Nicolaouf3c19092015-05-27 17:53:37 -070039 defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
Matt Rosencrantza1eadad2015-09-03 13:44:25 -070040 ls, _ := ctx.Value(listenSpecKey).(rpc.ListenSpec)
41 return ls
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070042}
Matt Rosencrantzbb6295d2015-06-19 15:13:58 -070043
44func (r *Runtime) WithListenSpec(ctx *context.T, ls rpc.ListenSpec) *context.T {
Bogdan Caprita95bca142015-06-29 17:16:05 -070045 defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
Matt Rosencrantza1eadad2015-09-03 13:44:25 -070046 return context.WithValue(ctx, listenSpecKey, ls)
Matt Rosencrantzbb6295d2015-06-19 15:13:58 -070047 return ctx
48}
Suharsh Sivakumar5859f5a2015-08-09 22:49:43 -070049
Matt Rosencrantza1eadad2015-09-03 13:44:25 -070050func SetFlowManager(ctx *context.T, manager flow.Manager) *context.T {
51 return context.WithValue(ctx, flowManagerKey, manager)
52}
53
Suharsh Sivakumar5859f5a2015-08-09 22:49:43 -070054func (r *Runtime) ExperimentalGetFlowManager(ctx *context.T) flow.Manager {
55 defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
Matt Rosencrantza1eadad2015-09-03 13:44:25 -070056 fm, _ := ctx.Value(flowManagerKey).(flow.Manager)
57 return fm
Suharsh Sivakumar5859f5a2015-08-09 22:49:43 -070058}
Suharsh Sivakumar179dc572015-08-18 14:11:53 -070059
60func (r *Runtime) ExperimentalWithNewFlowManager(ctx *context.T) (*context.T, flow.Manager, error) {
61 defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
62 panic("unimplemented")
63}
Todd Wang96f300a2015-08-27 17:40:45 -070064
Matt Rosencrantz98d6d7c2015-09-04 12:34:08 -070065func (r *Runtime) WithNewServer(ctx *context.T, name string, object interface{}, auth security.Authorizer, opts ...rpc.ServerOpt) (*context.T, rpc.Server, error) {
Todd Wang96f300a2015-08-27 17:40:45 -070066 defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
67 panic("unimplemented")
68}
69
Matt Rosencrantz98d6d7c2015-09-04 12:34:08 -070070func (r *Runtime) WithNewDispatchingServer(ctx *context.T, name string, disp rpc.Dispatcher, opts ...rpc.ServerOpt) (*context.T, rpc.Server, error) {
Todd Wang96f300a2015-08-27 17:40:45 -070071 defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
72 panic("unimplemented")
73}