/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
go/protocol/keybase1/ctl.go
481 строка
12 KB
chrisnojima-zoom
Version 670 - clean2 (#29122)
08 июн 2026, 19:31
Не верифицирован
08 июн 2026, 19:31
1943197
Код
Авторство
О чём код?
// Code generated to Go types and interfaces using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler). DO NOT EDIT. // Input file: avdl/keybase1/ctl.avdl package keybase1 import ( "context" "fmt" "time" "github.com/keybase/go-framed-msgpack-rpc/rpc" ) type ExitCode int const ( ExitCode_OK ExitCode = 0 ExitCode_NOTOK ExitCode = 2 ExitCode_RESTART ExitCode = 4 ) func (o ExitCode) DeepCopy() ExitCode { return o } var ExitCodeMap = map[string]ExitCode{ "OK": 0, "NOTOK": 2, "RESTART": 4, } var ExitCodeRevMap = map[ExitCode]string{ 0: "OK", 2: "NOTOK", 4: "RESTART", } func (o ExitCode) String() string { if v, ok := ExitCodeRevMap[o]; ok { return v } return fmt.Sprintf("%v", int(o)) } type DbType int const ( DbType_MAIN DbType = 0 DbType_CHAT DbType = 1 DbType_FS_BLOCK_CACHE DbType = 2 DbType_FS_BLOCK_CACHE_META DbType = 3 DbType_FS_SYNC_BLOCK_CACHE DbType = 4 DbType_FS_SYNC_BLOCK_CACHE_META DbType = 5 ) func (o DbType) DeepCopy() DbType { return o } var DbTypeMap = map[string]DbType{ "MAIN": 0, "CHAT": 1, "FS_BLOCK_CACHE": 2, "FS_BLOCK_CACHE_META": 3, "FS_SYNC_BLOCK_CACHE": 4, "FS_SYNC_BLOCK_CACHE_META": 5, } var DbTypeRevMap = map[DbType]string{ 0: "MAIN", 1: "CHAT", 2: "FS_BLOCK_CACHE", 3: "FS_BLOCK_CACHE_META", 4: "FS_SYNC_BLOCK_CACHE", 5: "FS_SYNC_BLOCK_CACHE_META", } func (o DbType) String() string { if v, ok := DbTypeRevMap[o]; ok { return v } return fmt.Sprintf("%v", int(o)) } type DbKey struct { DbType DbType `codec:"dbType" json:"dbType"` ObjType int `codec:"objType" json:"objType"` Key string `codec:"key" json:"key"` } func (o DbKey) DeepCopy() DbKey { return DbKey{ DbType: o.DbType.DeepCopy(), ObjType: o.ObjType, Key: o.Key, } } type DbValue []byte func (o DbValue) DeepCopy() DbValue { return (func(x []byte) []byte { if x == nil { return nil } return append([]byte{}, x...) })(o) } type OnLoginStartupStatus int const ( OnLoginStartupStatus_UNKNOWN OnLoginStartupStatus = 0 OnLoginStartupStatus_DISABLED OnLoginStartupStatus = 1 OnLoginStartupStatus_ENABLED OnLoginStartupStatus = 2 ) func (o OnLoginStartupStatus) DeepCopy() OnLoginStartupStatus { return o } var OnLoginStartupStatusMap = map[string]OnLoginStartupStatus{ "UNKNOWN": 0, "DISABLED": 1, "ENABLED": 2, } var OnLoginStartupStatusRevMap = map[OnLoginStartupStatus]string{ 0: "UNKNOWN", 1: "DISABLED", 2: "ENABLED", } func (o OnLoginStartupStatus) String() string { if v, ok := OnLoginStartupStatusRevMap[o]; ok { return v } return fmt.Sprintf("%v", int(o)) } type StopArg struct { SessionID int `codec:"sessionID" json:"sessionID"` ExitCode ExitCode `codec:"exitCode" json:"exitCode"` } type StopServiceArg struct { SessionID int `codec:"sessionID" json:"sessionID"` ExitCode ExitCode `codec:"exitCode" json:"exitCode"` } type LogRotateArg struct { SessionID int `codec:"sessionID" json:"sessionID"` } type ReloadArg struct { SessionID int `codec:"sessionID" json:"sessionID"` } type DbNukeArg struct { SessionID int `codec:"sessionID" json:"sessionID"` } type DbCleanArg struct { SessionID int `codec:"sessionID" json:"sessionID"` Force bool `codec:"force" json:"force"` DbType DbType `codec:"dbType" json:"dbType"` } type AppExitArg struct { SessionID int `codec:"sessionID" json:"sessionID"` } type DbDeleteArg struct { SessionID int `codec:"sessionID" json:"sessionID"` Key DbKey `codec:"key" json:"key"` } type DbPutArg struct { SessionID int `codec:"sessionID" json:"sessionID"` Key DbKey `codec:"key" json:"key"` Value DbValue `codec:"value" json:"value"` } type DbGetArg struct { SessionID int `codec:"sessionID" json:"sessionID"` Key DbKey `codec:"key" json:"key"` } type DbKeysWithPrefixesArg struct { SessionID int `codec:"sessionID" json:"sessionID"` Prefix DbKey `codec:"prefix" json:"prefix"` } type SetOnLoginStartupArg struct { Enabled bool `codec:"enabled" json:"enabled"` } type GetOnLoginStartupArg struct { } type CtlInterface interface { Stop(context.Context, StopArg) error StopService(context.Context, StopServiceArg) error LogRotate(context.Context, int) error Reload(context.Context, int) error DbNuke(context.Context, int) error DbClean(context.Context, DbCleanArg) error AppExit(context.Context, int) error DbDelete(context.Context, DbDeleteArg) error DbPut(context.Context, DbPutArg) error DbGet(context.Context, DbGetArg) (*DbValue, error) DbKeysWithPrefixes(context.Context, DbKeysWithPrefixesArg) ([]DbKey, error) SetOnLoginStartup(context.Context, bool) error GetOnLoginStartup(context.Context) (OnLoginStartupStatus, error) } func CtlProtocol(i CtlInterface) rpc.Protocol { return rpc.Protocol{ Name: "keybase.1.ctl", Methods: map[string]rpc.ServeHandlerDescription{ "stop": { MakeArg: func() any { var ret [1]StopArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]StopArg) if !ok { err = rpc.NewTypeError((*[1]StopArg)(nil), args) return } err = i.Stop(ctx, typedArgs[0]) return }, }, "stopService": { MakeArg: func() any { var ret [1]StopServiceArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]StopServiceArg) if !ok { err = rpc.NewTypeError((*[1]StopServiceArg)(nil), args) return } err = i.StopService(ctx, typedArgs[0]) return }, }, "logRotate": { MakeArg: func() any { var ret [1]LogRotateArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]LogRotateArg) if !ok { err = rpc.NewTypeError((*[1]LogRotateArg)(nil), args) return } err = i.LogRotate(ctx, typedArgs[0].SessionID) return }, }, "reload": { MakeArg: func() any { var ret [1]ReloadArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]ReloadArg) if !ok { err = rpc.NewTypeError((*[1]ReloadArg)(nil), args) return } err = i.Reload(ctx, typedArgs[0].SessionID) return }, }, "dbNuke": { MakeArg: func() any { var ret [1]DbNukeArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]DbNukeArg) if !ok { err = rpc.NewTypeError((*[1]DbNukeArg)(nil), args) return } err = i.DbNuke(ctx, typedArgs[0].SessionID) return }, }, "dbClean": { MakeArg: func() any { var ret [1]DbCleanArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]DbCleanArg) if !ok { err = rpc.NewTypeError((*[1]DbCleanArg)(nil), args) return } err = i.DbClean(ctx, typedArgs[0]) return }, }, "appExit": { MakeArg: func() any { var ret [1]AppExitArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]AppExitArg) if !ok { err = rpc.NewTypeError((*[1]AppExitArg)(nil), args) return } err = i.AppExit(ctx, typedArgs[0].SessionID) return }, }, "dbDelete": { MakeArg: func() any { var ret [1]DbDeleteArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]DbDeleteArg) if !ok { err = rpc.NewTypeError((*[1]DbDeleteArg)(nil), args) return } err = i.DbDelete(ctx, typedArgs[0]) return }, }, "dbPut": { MakeArg: func() any { var ret [1]DbPutArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]DbPutArg) if !ok { err = rpc.NewTypeError((*[1]DbPutArg)(nil), args) return } err = i.DbPut(ctx, typedArgs[0]) return }, }, "dbGet": { MakeArg: func() any { var ret [1]DbGetArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]DbGetArg) if !ok { err = rpc.NewTypeError((*[1]DbGetArg)(nil), args) return } ret, err = i.DbGet(ctx, typedArgs[0]) return }, }, "dbKeysWithPrefixes": { MakeArg: func() any { var ret [1]DbKeysWithPrefixesArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]DbKeysWithPrefixesArg) if !ok { err = rpc.NewTypeError((*[1]DbKeysWithPrefixesArg)(nil), args) return } ret, err = i.DbKeysWithPrefixes(ctx, typedArgs[0]) return }, }, "setOnLoginStartup": { MakeArg: func() any { var ret [1]SetOnLoginStartupArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]SetOnLoginStartupArg) if !ok { err = rpc.NewTypeError((*[1]SetOnLoginStartupArg)(nil), args) return } err = i.SetOnLoginStartup(ctx, typedArgs[0].Enabled) return }, }, "getOnLoginStartup": { MakeArg: func() any { var ret [1]GetOnLoginStartupArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { ret, err = i.GetOnLoginStartup(ctx) return }, }, }, } } type CtlClient struct { Cli rpc.GenericClient } func (c CtlClient) Stop(ctx context.Context, __arg StopArg) (err error) { err = c.Cli.Call(ctx, "keybase.1.ctl.stop", []any{__arg}, nil, 0*time.Millisecond) return } func (c CtlClient) StopService(ctx context.Context, __arg StopServiceArg) (err error) { err = c.Cli.Call(ctx, "keybase.1.ctl.stopService", []any{__arg}, nil, 0*time.Millisecond) return } func (c CtlClient) LogRotate(ctx context.Context, sessionID int) (err error) { __arg := LogRotateArg{SessionID: sessionID} err = c.Cli.Call(ctx, "keybase.1.ctl.logRotate", []any{__arg}, nil, 0*time.Millisecond) return } func (c CtlClient) Reload(ctx context.Context, sessionID int) (err error) { __arg := ReloadArg{SessionID: sessionID} err = c.Cli.Call(ctx, "keybase.1.ctl.reload", []any{__arg}, nil, 0*time.Millisecond) return } func (c CtlClient) DbNuke(ctx context.Context, sessionID int) (err error) { __arg := DbNukeArg{SessionID: sessionID} err = c.Cli.Call(ctx, "keybase.1.ctl.dbNuke", []any{__arg}, nil, 0*time.Millisecond) return } func (c CtlClient) DbClean(ctx context.Context, __arg DbCleanArg) (err error) { err = c.Cli.Call(ctx, "keybase.1.ctl.dbClean", []any{__arg}, nil, 0*time.Millisecond) return } func (c CtlClient) AppExit(ctx context.Context, sessionID int) (err error) { __arg := AppExitArg{SessionID: sessionID} err = c.Cli.Call(ctx, "keybase.1.ctl.appExit", []any{__arg}, nil, 0*time.Millisecond) return } func (c CtlClient) DbDelete(ctx context.Context, __arg DbDeleteArg) (err error) { err = c.Cli.Call(ctx, "keybase.1.ctl.dbDelete", []any{__arg}, nil, 0*time.Millisecond) return } func (c CtlClient) DbPut(ctx context.Context, __arg DbPutArg) (err error) { err = c.Cli.Call(ctx, "keybase.1.ctl.dbPut", []any{__arg}, nil, 0*time.Millisecond) return } func (c CtlClient) DbGet(ctx context.Context, __arg DbGetArg) (res *DbValue, err error) { err = c.Cli.Call(ctx, "keybase.1.ctl.dbGet", []any{__arg}, &res, 0*time.Millisecond) return } func (c CtlClient) DbKeysWithPrefixes(ctx context.Context, __arg DbKeysWithPrefixesArg) (res []DbKey, err error) { err = c.Cli.Call(ctx, "keybase.1.ctl.dbKeysWithPrefixes", []any{__arg}, &res, 0*time.Millisecond) return } func (c CtlClient) SetOnLoginStartup(ctx context.Context, enabled bool) (err error) { __arg := SetOnLoginStartupArg{Enabled: enabled} err = c.Cli.Call(ctx, "keybase.1.ctl.setOnLoginStartup", []any{__arg}, nil, 0*time.Millisecond) return } func (c CtlClient) GetOnLoginStartup(ctx context.Context) (res OnLoginStartupStatus, err error) { err = c.Cli.Call(ctx, "keybase.1.ctl.getOnLoginStartup", []any{GetOnLoginStartupArg{}}, &res, 0*time.Millisecond) return }