Matt Rosencrantz | 9fe6082 | 2014-09-12 10:09:53 -0700 | [diff] [blame] | 1 | package runtime |
| 2 | |
| 3 | import ( |
Jiri Simsa | 519c507 | 2014-09-17 21:37:57 -0700 | [diff] [blame] | 4 | "veyron.io/veyron/veyron2" |
| 5 | "veyron.io/veyron/veyron2/config" |
| 6 | "veyron.io/veyron/veyron2/context" |
| 7 | "veyron.io/veyron/veyron2/ipc" |
| 8 | "veyron.io/veyron/veyron2/ipc/stream" |
| 9 | "veyron.io/veyron/veyron2/naming" |
| 10 | "veyron.io/veyron/veyron2/security" |
| 11 | "veyron.io/veyron/veyron2/vlog" |
| 12 | "veyron.io/veyron/veyron2/vtrace" |
Matt Rosencrantz | 9fe6082 | 2014-09-12 10:09:53 -0700 | [diff] [blame] | 13 | ) |
| 14 | |
| 15 | // PanicRuntime is a dummy implementation of veyron2.Runtime that panics on every |
| 16 | // operation. This is useful when you want to pass around a non-nil runtime |
| 17 | // implementation but you don't want it to be used. |
| 18 | type PanicRuntime struct { |
| 19 | unique int // Make non-empty to ensure pointer instances are unique. |
| 20 | } |
| 21 | |
| 22 | const badRuntime = "The runtime implmentation should not call methods on runtime intances." |
| 23 | |
| 24 | func (*PanicRuntime) Profile() veyron2.Profile { panic(badRuntime) } |
Cosmos Nicolaou | 39e3ae5 | 2014-11-14 13:30:01 -0800 | [diff] [blame^] | 25 | func (*PanicRuntime) AppCycle() veyron2.AppCycle { panic(badRuntime) } |
Matt Rosencrantz | 9fe6082 | 2014-09-12 10:09:53 -0700 | [diff] [blame] | 26 | func (*PanicRuntime) Publisher() *config.Publisher { panic(badRuntime) } |
Ankur | 7c89059 | 2014-10-02 11:36:28 -0700 | [diff] [blame] | 27 | func (*PanicRuntime) Principal() security.Principal { panic(badRuntime) } |
Matt Rosencrantz | 9fe6082 | 2014-09-12 10:09:53 -0700 | [diff] [blame] | 28 | func (*PanicRuntime) NewClient(opts ...ipc.ClientOpt) (ipc.Client, error) { panic(badRuntime) } |
| 29 | func (*PanicRuntime) NewServer(opts ...ipc.ServerOpt) (ipc.Server, error) { panic(badRuntime) } |
| 30 | func (*PanicRuntime) Client() ipc.Client { panic(badRuntime) } |
| 31 | func (*PanicRuntime) NewContext() context.T { panic(badRuntime) } |
| 32 | func (*PanicRuntime) WithNewSpan(context.T, string) (context.T, vtrace.Span) { panic(badRuntime) } |
| 33 | func (*PanicRuntime) SpanFromContext(context.T) vtrace.Span { panic(badRuntime) } |
| 34 | func (*PanicRuntime) NewStreamManager(opts ...stream.ManagerOpt) (stream.Manager, error) { |
| 35 | panic(badRuntime) |
| 36 | } |
| 37 | func (*PanicRuntime) NewEndpoint(ep string) (naming.Endpoint, error) { panic(badRuntime) } |
| 38 | func (*PanicRuntime) Namespace() naming.Namespace { panic(badRuntime) } |
| 39 | func (*PanicRuntime) Logger() vlog.Logger { panic(badRuntime) } |
| 40 | func (*PanicRuntime) NewLogger(name string, opts ...vlog.LoggingOpts) (vlog.Logger, error) { |
| 41 | panic(badRuntime) |
| 42 | } |
Cosmos Nicolaou | 6413c99 | 2014-11-06 11:00:54 -0800 | [diff] [blame] | 43 | func (*PanicRuntime) ConfigureReservedName(ipc.Dispatcher, ...ipc.ServerOpt) { |
Cosmos Nicolaou | 8246a8b | 2014-11-01 09:32:36 -0700 | [diff] [blame] | 44 | panic(badRuntime) |
| 45 | } |
Matt Rosencrantz | b30286b | 2014-11-10 14:52:17 -0800 | [diff] [blame] | 46 | func (*PanicRuntime) VtraceStore() vtrace.Store { panic(badRuntime) } |
| 47 | func (*PanicRuntime) Cleanup() { panic(badRuntime) } |