This repository has been archived by the owner on Jul 7, 2020. It is now read-only.
forked from keybase/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fs.go
83 lines (72 loc) · 1.79 KB
/
fs.go
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
// Auto-generated by avdl-compiler v1.3.22 (https://github.com/keybase/node-avdl-compiler)
// Input file: avdl/keybase1/fs.avdl
package keybase1
import (
"github.com/keybase/go-framed-msgpack-rpc/rpc"
context "golang.org/x/net/context"
)
type File struct {
Path string `codec:"path" json:"path"`
}
func (o File) DeepCopy() File {
return File{
Path: o.Path,
}
}
type ListResult struct {
Files []File `codec:"files" json:"files"`
}
func (o ListResult) DeepCopy() ListResult {
return ListResult{
Files: (func(x []File) []File {
if x == nil {
return nil
}
var ret []File
for _, v := range x {
vCopy := v.DeepCopy()
ret = append(ret, vCopy)
}
return ret
})(o.Files),
}
}
type ListArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
Path string `codec:"path" json:"path"`
}
type FsInterface interface {
// List files in a path. Implemented by KBFS service.
List(context.Context, ListArg) (ListResult, error)
}
func FsProtocol(i FsInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.fs",
Methods: map[string]rpc.ServeHandlerDescription{
"List": {
MakeArg: func() interface{} {
ret := make([]ListArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]ListArg)
if !ok {
err = rpc.NewTypeError((*[]ListArg)(nil), args)
return
}
ret, err = i.List(ctx, (*typedArgs)[0])
return
},
MethodType: rpc.MethodCall,
},
},
}
}
type FsClient struct {
Cli rpc.GenericClient
}
// List files in a path. Implemented by KBFS service.
func (c FsClient) List(ctx context.Context, __arg ListArg) (res ListResult, err error) {
err = c.Cli.Call(ctx, "keybase.1.fs.List", []interface{}{__arg}, &res)
return
}