Repository navigation
Expand file tree
/
Copy pathdebugging.go
More file actions
139 lines (124 loc) · 3.86 KB
/
Copy pathdebugging.go
File metadata and controls
139 lines (124 loc) · 3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// Auto-generated to Go types and interfaces using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler)
// Input file: avdl/keybase1/debugging.avdl
package keybase1
import (
"github.com/keybase/go-framed-msgpack-rpc/rpc"
context "golang.org/x/net/context"
"time"
)
type FirstStepResult struct {
ValPlusTwo int `codec:"valPlusTwo" json:"valPlusTwo"`
}
func (o FirstStepResult) DeepCopy() FirstStepResult {
return FirstStepResult{
ValPlusTwo: o.ValPlusTwo,
}
}
type FirstStepArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
Val int `codec:"val" json:"val"`
}
type SecondStepArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
Val int `codec:"val" json:"val"`
}
type IncrementArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
Val int `codec:"val" json:"val"`
}
type ScriptArg struct {
Script string `codec:"script" json:"script"`
Args []string `codec:"args" json:"args"`
}
type DebuggingInterface interface {
FirstStep(context.Context, FirstStepArg) (FirstStepResult, error)
SecondStep(context.Context, SecondStepArg) (int, error)
Increment(context.Context, IncrementArg) (int, error)
Script(context.Context, ScriptArg) (string, error)
}
func DebuggingProtocol(i DebuggingInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.debugging",
Methods: map[string]rpc.ServeHandlerDescription{
"firstStep": {
MakeArg: func() interface{} {
var ret [1]FirstStepArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]FirstStepArg)
if !ok {
err = rpc.NewTypeError((*[1]FirstStepArg)(nil), args)
return
}
ret, err = i.FirstStep(ctx, typedArgs[0])
return
},
},
"secondStep": {
MakeArg: func() interface{} {
var ret [1]SecondStepArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]SecondStepArg)
if !ok {
err = rpc.NewTypeError((*[1]SecondStepArg)(nil), args)
return
}
ret, err = i.SecondStep(ctx, typedArgs[0])
return
},
},
"increment": {
MakeArg: func() interface{} {
var ret [1]IncrementArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]IncrementArg)
if !ok {
err = rpc.NewTypeError((*[1]IncrementArg)(nil), args)
return
}
ret, err = i.Increment(ctx, typedArgs[0])
return
},
},
"script": {
MakeArg: func() interface{} {
var ret [1]ScriptArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]ScriptArg)
if !ok {
err = rpc.NewTypeError((*[1]ScriptArg)(nil), args)
return
}
ret, err = i.Script(ctx, typedArgs[0])
return
},
},
},
}
}
type DebuggingClient struct {
Cli rpc.GenericClient
}
func (c DebuggingClient) FirstStep(ctx context.Context, __arg FirstStepArg) (res FirstStepResult, err error) {
err = c.Cli.Call(ctx, "keybase.1.debugging.firstStep", []interface{}{__arg}, &res, 0*time.Millisecond)
return
}
func (c DebuggingClient) SecondStep(ctx context.Context, __arg SecondStepArg) (res int, err error) {
err = c.Cli.Call(ctx, "keybase.1.debugging.secondStep", []interface{}{__arg}, &res, 0*time.Millisecond)
return
}
func (c DebuggingClient) Increment(ctx context.Context, __arg IncrementArg) (res int, err error) {
err = c.Cli.Call(ctx, "keybase.1.debugging.increment", []interface{}{__arg}, &res, 0*time.Millisecond)
return
}
func (c DebuggingClient) Script(ctx context.Context, __arg ScriptArg) (res string, err error) {
err = c.Cli.Call(ctx, "keybase.1.debugging.script", []interface{}{__arg}, &res, 0*time.Millisecond)
return
}