github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/kbfsmount.go (about) 1 // Auto-generated to Go types and interfaces using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler) 2 // Input file: avdl/keybase1/kbfsmount.avdl 3 4 package keybase1 5 6 import ( 7 "github.com/keybase/go-framed-msgpack-rpc/rpc" 8 context "golang.org/x/net/context" 9 "time" 10 ) 11 12 type GetCurrentMountDirArg struct { 13 } 14 15 type WaitForMountsArg struct { 16 } 17 18 type GetPreferredMountDirsArg struct { 19 } 20 21 type GetAllAvailableMountDirsArg struct { 22 } 23 24 type SetCurrentMountDirArg struct { 25 Dir string `codec:"dir" json:"dir"` 26 } 27 28 type GetKBFSPathInfoArg struct { 29 StandardPath string `codec:"standardPath" json:"standardPath"` 30 } 31 32 type KbfsMountInterface interface { 33 GetCurrentMountDir(context.Context) (string, error) 34 WaitForMounts(context.Context) (bool, error) 35 GetPreferredMountDirs(context.Context) ([]string, error) 36 GetAllAvailableMountDirs(context.Context) ([]string, error) 37 SetCurrentMountDir(context.Context, string) error 38 GetKBFSPathInfo(context.Context, string) (KBFSPathInfo, error) 39 } 40 41 func KbfsMountProtocol(i KbfsMountInterface) rpc.Protocol { 42 return rpc.Protocol{ 43 Name: "keybase.1.kbfsMount", 44 Methods: map[string]rpc.ServeHandlerDescription{ 45 "GetCurrentMountDir": { 46 MakeArg: func() interface{} { 47 var ret [1]GetCurrentMountDirArg 48 return &ret 49 }, 50 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 51 ret, err = i.GetCurrentMountDir(ctx) 52 return 53 }, 54 }, 55 "WaitForMounts": { 56 MakeArg: func() interface{} { 57 var ret [1]WaitForMountsArg 58 return &ret 59 }, 60 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 61 ret, err = i.WaitForMounts(ctx) 62 return 63 }, 64 }, 65 "GetPreferredMountDirs": { 66 MakeArg: func() interface{} { 67 var ret [1]GetPreferredMountDirsArg 68 return &ret 69 }, 70 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 71 ret, err = i.GetPreferredMountDirs(ctx) 72 return 73 }, 74 }, 75 "GetAllAvailableMountDirs": { 76 MakeArg: func() interface{} { 77 var ret [1]GetAllAvailableMountDirsArg 78 return &ret 79 }, 80 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 81 ret, err = i.GetAllAvailableMountDirs(ctx) 82 return 83 }, 84 }, 85 "SetCurrentMountDir": { 86 MakeArg: func() interface{} { 87 var ret [1]SetCurrentMountDirArg 88 return &ret 89 }, 90 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 91 typedArgs, ok := args.(*[1]SetCurrentMountDirArg) 92 if !ok { 93 err = rpc.NewTypeError((*[1]SetCurrentMountDirArg)(nil), args) 94 return 95 } 96 err = i.SetCurrentMountDir(ctx, typedArgs[0].Dir) 97 return 98 }, 99 }, 100 "GetKBFSPathInfo": { 101 MakeArg: func() interface{} { 102 var ret [1]GetKBFSPathInfoArg 103 return &ret 104 }, 105 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 106 typedArgs, ok := args.(*[1]GetKBFSPathInfoArg) 107 if !ok { 108 err = rpc.NewTypeError((*[1]GetKBFSPathInfoArg)(nil), args) 109 return 110 } 111 ret, err = i.GetKBFSPathInfo(ctx, typedArgs[0].StandardPath) 112 return 113 }, 114 }, 115 }, 116 } 117 } 118 119 type KbfsMountClient struct { 120 Cli rpc.GenericClient 121 } 122 123 func (c KbfsMountClient) GetCurrentMountDir(ctx context.Context) (res string, err error) { 124 err = c.Cli.Call(ctx, "keybase.1.kbfsMount.GetCurrentMountDir", []interface{}{GetCurrentMountDirArg{}}, &res, 0*time.Millisecond) 125 return 126 } 127 128 func (c KbfsMountClient) WaitForMounts(ctx context.Context) (res bool, err error) { 129 err = c.Cli.Call(ctx, "keybase.1.kbfsMount.WaitForMounts", []interface{}{WaitForMountsArg{}}, &res, 0*time.Millisecond) 130 return 131 } 132 133 func (c KbfsMountClient) GetPreferredMountDirs(ctx context.Context) (res []string, err error) { 134 err = c.Cli.Call(ctx, "keybase.1.kbfsMount.GetPreferredMountDirs", []interface{}{GetPreferredMountDirsArg{}}, &res, 0*time.Millisecond) 135 return 136 } 137 138 func (c KbfsMountClient) GetAllAvailableMountDirs(ctx context.Context) (res []string, err error) { 139 err = c.Cli.Call(ctx, "keybase.1.kbfsMount.GetAllAvailableMountDirs", []interface{}{GetAllAvailableMountDirsArg{}}, &res, 0*time.Millisecond) 140 return 141 } 142 143 func (c KbfsMountClient) SetCurrentMountDir(ctx context.Context, dir string) (err error) { 144 __arg := SetCurrentMountDirArg{Dir: dir} 145 err = c.Cli.Call(ctx, "keybase.1.kbfsMount.SetCurrentMountDir", []interface{}{__arg}, nil, 0*time.Millisecond) 146 return 147 } 148 149 func (c KbfsMountClient) GetKBFSPathInfo(ctx context.Context, standardPath string) (res KBFSPathInfo, err error) { 150 __arg := GetKBFSPathInfoArg{StandardPath: standardPath} 151 err = c.Cli.Call(ctx, "keybase.1.kbfsMount.GetKBFSPathInfo", []interface{}{__arg}, &res, 0*time.Millisecond) 152 return 153 }