From a79b9099165ca1f5ee26b5c81db5e7dc0cb7e1cf Mon Sep 17 00:00:00 2001 From: Zachary Wasserman Date: Mon, 2 Jul 2018 10:02:50 -0700 Subject: [PATCH] Revert "Update Thrift dependency version (and generated bindings) (#59)" This reverts commit eb3599eb1d47b59aa5082251facfa92def5a8b1b. The commit was intended to merge breaking changes from upstream Thrift into the library without causing breakage for our users. This was unsuccessful, and will be reverted until we can implement a suitable strategy. --- Gopkg.lock | 16 +- Gopkg.toml | 7 +- Makefile | 4 +- client.go | 15 +- client_test.go | 13 +- gen/osquery/GoUnusedProtection__.go | 5 +- gen/osquery/mock/osquery.go | 109 + gen/osquery/osquery-consts.go | 8 +- gen/osquery/osquery.go | 6019 +++++++++++++++------------ mock/osquery.go | 113 - server.go | 8 +- server_test.go | 6 +- 12 files changed, 3467 insertions(+), 2856 deletions(-) create mode 100644 gen/osquery/mock/osquery.go delete mode 100644 mock/osquery.go diff --git a/Gopkg.lock b/Gopkg.lock index 4d13f88..0f9fd97 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -4,8 +4,7 @@ [[projects]] name = "git.apache.org/thrift.git" packages = ["lib/go/thrift"] - revision = "327ebb6c2b6df8bf075da02ef45a2a034e9b79ba" - version = "0.11.0" + revision = "0dd823580c78a79ae9696eb9b3650e400fff140f" [[projects]] name = "github.com/Microsoft/go-winio" @@ -33,19 +32,10 @@ [[projects]] name = "github.com/stretchr/testify" - packages = [ - "assert", - "require" - ] + packages = ["assert","require"] revision = "69483b4bd14f5845b5a1e55bca19e954e827f1d0" version = "v1.1.4" -[[projects]] - branch = "master" - name = "golang.org/x/net" - packages = ["context"] - revision = "db08ff08e8622530d9ed3a0e8ac279f6d4c02196" - [[projects]] branch = "master" name = "golang.org/x/sys" @@ -55,6 +45,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "94aae89977b59e0e153d6d83eefbfbfe67c6bb765813b75fc1be00c64ab4d1b1" + inputs-digest = "789df63dd9cc38795d3f7628e73fd226a6ecd621bbd0181337ece8ecb7ae6fa8" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 0e04e8e..320332a 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -1,7 +1,12 @@ [[constraint]] + # This version includes concurrency fixes, but excludes changes to the + # library APIs. Using a version beyond this would require users to build the + # Thrift compiler from source to get API-compatible generated code. After the + # next Thrift release, this should become that tagged release (and the code + # generated appropriately). name = "git.apache.org/thrift.git" - version = "0.11.0" + revision = "0dd823580c78a79ae9696eb9b3650e400fff140f" [[constraint]] name = "github.com/Microsoft/go-winio" diff --git a/Makefile b/Makefile index dc54692..8764a84 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ deps: dep ensure -vendor-only gen: ./osquery.thrift + rm -rf ./gen mkdir ./gen thrift --gen go:package_prefix=github.com/kolide/osquery-go/gen/ -out ./gen ./osquery.thrift rm -rf gen/osquery/extension-remote gen/osquery/extension_manager-remote @@ -35,7 +36,4 @@ example_config: examples/config/*.go test: all go test -race -cover -v $(shell go list ./... | grep -v /vendor/) -clean: - rm -rf ./build ./gen - .PHONY: all diff --git a/client.go b/client.go index 5318517..45b2c6e 100644 --- a/client.go +++ b/client.go @@ -1,7 +1,6 @@ package osquery import ( - "context" "time" "github.com/kolide/osquery-go/gen/osquery" @@ -55,34 +54,34 @@ func (c *ExtensionManagerClient) Close() { // Ping requests metadata from the extension manager. func (c *ExtensionManagerClient) Ping() (*osquery.ExtensionStatus, error) { - return c.Client.Ping(context.Background()) + return c.Client.Ping() } // Call requests a call to an extension (or core) registry plugin. func (c *ExtensionManagerClient) Call(registry, item string, request osquery.ExtensionPluginRequest) (*osquery.ExtensionResponse, error) { - return c.Client.Call(context.Background(), registry, item, request) + return c.Client.Call(registry, item, request) } // Extensions requests the list of active registered extensions. func (c *ExtensionManagerClient) Extensions() (osquery.InternalExtensionList, error) { - return c.Client.Extensions(context.Background()) + return c.Client.Extensions() } // RegisterExtension registers the extension plugins with the osquery process. func (c *ExtensionManagerClient) RegisterExtension(info *osquery.InternalExtensionInfo, registry osquery.ExtensionRegistry) (*osquery.ExtensionStatus, error) { - return c.Client.RegisterExtension(context.Background(), info, registry) + return c.Client.RegisterExtension(info, registry) } // Options requests the list of bootstrap or configuration options. func (c *ExtensionManagerClient) Options() (osquery.InternalOptionList, error) { - return c.Client.Options(context.Background()) + return c.Client.Options() } // Query requests a query to be run and returns the extension response. // Consider using the QueryRow or QueryRows helpers for a more friendly // interface. func (c *ExtensionManagerClient) Query(sql string) (*osquery.ExtensionResponse, error) { - return c.Client.Query(context.Background(), sql) + return c.Client.Query(sql) } // QueryRows is a helper that executes the requested query and returns the @@ -118,5 +117,5 @@ func (c *ExtensionManagerClient) QueryRow(sql string) (map[string]string, error) // GetQueryColumns requests the columns returned by the parsed query. func (c *ExtensionManagerClient) GetQueryColumns(sql string) (*osquery.ExtensionResponse, error) { - return c.Client.GetQueryColumns(context.Background(), sql) + return c.Client.GetQueryColumns(sql) } diff --git a/client_test.go b/client_test.go index 126b124..bb254bc 100644 --- a/client_test.go +++ b/client_test.go @@ -1,12 +1,11 @@ package osquery import ( - "context" "errors" "testing" "github.com/kolide/osquery-go/gen/osquery" - "github.com/kolide/osquery-go/mock" + "github.com/kolide/osquery-go/gen/osquery/mock" "github.com/stretchr/testify/assert" ) @@ -15,7 +14,7 @@ func TestQueryRows(t *testing.T) { client := &ExtensionManagerClient{Client: mock} // Transport related error - mock.QueryFunc = func(ctx context.Context, sql string) (*osquery.ExtensionResponse, error) { + mock.QueryFunc = func(sql string) (*osquery.ExtensionResponse, error) { return nil, errors.New("boom!") } rows, err := client.QueryRows("select 1") @@ -24,7 +23,7 @@ func TestQueryRows(t *testing.T) { assert.NotNil(t, err) // Nil status - mock.QueryFunc = func(ctx context.Context, sql string) (*osquery.ExtensionResponse, error) { + mock.QueryFunc = func(sql string) (*osquery.ExtensionResponse, error) { return &osquery.ExtensionResponse{}, nil } rows, err = client.QueryRows("select 1") @@ -33,7 +32,7 @@ func TestQueryRows(t *testing.T) { assert.NotNil(t, err) // Query error - mock.QueryFunc = func(ctx context.Context, sql string) (*osquery.ExtensionResponse, error) { + mock.QueryFunc = func(sql string) (*osquery.ExtensionResponse, error) { return &osquery.ExtensionResponse{ Status: &osquery.ExtensionStatus{Code: 1, Message: "bad query"}, }, nil @@ -47,7 +46,7 @@ func TestQueryRows(t *testing.T) { expectedRows := []map[string]string{ {"1": "1"}, } - mock.QueryFunc = func(ctx context.Context, sql string) (*osquery.ExtensionResponse, error) { + mock.QueryFunc = func(sql string) (*osquery.ExtensionResponse, error) { return &osquery.ExtensionResponse{ Status: &osquery.ExtensionStatus{Code: 0, Message: "OK"}, Response: expectedRows, @@ -65,7 +64,7 @@ func TestQueryRows(t *testing.T) { {"1": "1"}, {"1": "2"}, } - mock.QueryFunc = func(ctx context.Context, sql string) (*osquery.ExtensionResponse, error) { + mock.QueryFunc = func(sql string) (*osquery.ExtensionResponse, error) { return &osquery.ExtensionResponse{ Status: &osquery.ExtensionStatus{Code: 0, Message: "OK"}, Response: expectedRows, diff --git a/gen/osquery/GoUnusedProtection__.go b/gen/osquery/GoUnusedProtection__.go index 7e40a57..3ba0504 100644 --- a/gen/osquery/GoUnusedProtection__.go +++ b/gen/osquery/GoUnusedProtection__.go @@ -1,7 +1,6 @@ -// Autogenerated by Thrift Compiler (0.11.0) +// Autogenerated by Thrift Compiler (0.10.0) // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING package osquery -var GoUnusedProtection__ int; - +var GoUnusedProtection__ int diff --git a/gen/osquery/mock/osquery.go b/gen/osquery/mock/osquery.go new file mode 100644 index 0000000..b2ba625 --- /dev/null +++ b/gen/osquery/mock/osquery.go @@ -0,0 +1,109 @@ +// Automatically generated by mockimpl. DO NOT EDIT! + +package mock + +import "github.com/kolide/osquery-go/gen/osquery" + +var _ osquery.ExtensionManager = (*ExtensionManager)(nil) + +type CloseFunc func() + +type PingFunc func() (*osquery.ExtensionStatus, error) + +type CallFunc func(registry string, item string, req osquery.ExtensionPluginRequest) (*osquery.ExtensionResponse, error) + +type ShutdownFunc func() error + +type ExtensionsFunc func() (osquery.InternalExtensionList, error) + +type RegisterExtensionFunc func(info *osquery.InternalExtensionInfo, registry osquery.ExtensionRegistry) (*osquery.ExtensionStatus, error) + +type DeregisterExtensionFunc func(uuid osquery.ExtensionRouteUUID) (*osquery.ExtensionStatus, error) + +type OptionsFunc func() (osquery.InternalOptionList, error) + +type QueryFunc func(sql string) (*osquery.ExtensionResponse, error) + +type GetQueryColumnsFunc func(sql string) (*osquery.ExtensionResponse, error) + +type ExtensionManager struct { + CloseFunc CloseFunc + CloseFuncInvoked bool + + PingFunc PingFunc + PingFuncInvoked bool + + CallFunc CallFunc + CallFuncInvoked bool + + ShutdownFunc ShutdownFunc + ShutdownFuncInvoked bool + + ExtensionsFunc ExtensionsFunc + ExtensionsFuncInvoked bool + + RegisterExtensionFunc RegisterExtensionFunc + RegisterExtensionFuncInvoked bool + + DeregisterExtensionFunc DeregisterExtensionFunc + DeregisterExtensionFuncInvoked bool + + OptionsFunc OptionsFunc + OptionsFuncInvoked bool + + QueryFunc QueryFunc + QueryFuncInvoked bool + + GetQueryColumnsFunc GetQueryColumnsFunc + GetQueryColumnsFuncInvoked bool +} + +func (m *ExtensionManager) Close() { + m.CloseFuncInvoked = true + m.CloseFunc() +} + +func (m *ExtensionManager) Ping() (*osquery.ExtensionStatus, error) { + m.PingFuncInvoked = true + return m.PingFunc() +} + +func (m *ExtensionManager) Call(registry string, item string, req osquery.ExtensionPluginRequest) (*osquery.ExtensionResponse, error) { + m.CallFuncInvoked = true + return m.CallFunc(registry, item, req) +} + +func (m *ExtensionManager) Shutdown() error { + m.ShutdownFuncInvoked = true + return m.ShutdownFunc() +} + +func (m *ExtensionManager) Extensions() (osquery.InternalExtensionList, error) { + m.ExtensionsFuncInvoked = true + return m.ExtensionsFunc() +} + +func (m *ExtensionManager) RegisterExtension(info *osquery.InternalExtensionInfo, registry osquery.ExtensionRegistry) (*osquery.ExtensionStatus, error) { + m.RegisterExtensionFuncInvoked = true + return m.RegisterExtensionFunc(info, registry) +} + +func (m *ExtensionManager) DeregisterExtension(uuid osquery.ExtensionRouteUUID) (*osquery.ExtensionStatus, error) { + m.DeregisterExtensionFuncInvoked = true + return m.DeregisterExtensionFunc(uuid) +} + +func (m *ExtensionManager) Options() (osquery.InternalOptionList, error) { + m.OptionsFuncInvoked = true + return m.OptionsFunc() +} + +func (m *ExtensionManager) Query(sql string) (*osquery.ExtensionResponse, error) { + m.QueryFuncInvoked = true + return m.QueryFunc(sql) +} + +func (m *ExtensionManager) GetQueryColumns(sql string) (*osquery.ExtensionResponse, error) { + m.GetQueryColumnsFuncInvoked = true + return m.GetQueryColumnsFunc(sql) +} diff --git a/gen/osquery/osquery-consts.go b/gen/osquery/osquery-consts.go index b10716f..2afa2ad 100644 --- a/gen/osquery/osquery-consts.go +++ b/gen/osquery/osquery-consts.go @@ -1,12 +1,10 @@ -// Autogenerated by Thrift Compiler (0.11.0) +// Autogenerated by Thrift Compiler (0.10.0) // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING package osquery import ( "bytes" - "reflect" - "context" "fmt" "git.apache.org/thrift.git/lib/go/thrift" ) @@ -14,11 +12,7 @@ import ( // (needed to ensure safety because of naive import list construction.) var _ = thrift.ZERO var _ = fmt.Printf -var _ = context.Background -var _ = reflect.DeepEqual var _ = bytes.Equal - func init() { } - diff --git a/gen/osquery/osquery.go b/gen/osquery/osquery.go index 14ddbab..e87adce 100644 --- a/gen/osquery/osquery.go +++ b/gen/osquery/osquery.go @@ -1,14 +1,12 @@ -// Autogenerated by Thrift Compiler (0.11.0) +// Autogenerated by Thrift Compiler (0.10.0) // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING package osquery import ( "bytes" - "reflect" "database/sql/driver" "errors" - "context" "fmt" "git.apache.org/thrift.git/lib/go/thrift" ) @@ -16,66 +14,71 @@ import ( // (needed to ensure safety because of naive import list construction.) var _ = thrift.ZERO var _ = fmt.Printf -var _ = context.Background -var _ = reflect.DeepEqual var _ = bytes.Equal type ExtensionCode int64 + const ( - ExtensionCode_EXT_SUCCESS ExtensionCode = 0 - ExtensionCode_EXT_FAILED ExtensionCode = 1 - ExtensionCode_EXT_FATAL ExtensionCode = 2 + ExtensionCode_EXT_SUCCESS ExtensionCode = 0 + ExtensionCode_EXT_FAILED ExtensionCode = 1 + ExtensionCode_EXT_FATAL ExtensionCode = 2 ) func (p ExtensionCode) String() string { - switch p { - case ExtensionCode_EXT_SUCCESS: return "EXT_SUCCESS" - case ExtensionCode_EXT_FAILED: return "EXT_FAILED" - case ExtensionCode_EXT_FATAL: return "EXT_FATAL" - } - return "" + switch p { + case ExtensionCode_EXT_SUCCESS: + return "EXT_SUCCESS" + case ExtensionCode_EXT_FAILED: + return "EXT_FAILED" + case ExtensionCode_EXT_FATAL: + return "EXT_FATAL" + } + return "" } func ExtensionCodeFromString(s string) (ExtensionCode, error) { - switch s { - case "EXT_SUCCESS": return ExtensionCode_EXT_SUCCESS, nil - case "EXT_FAILED": return ExtensionCode_EXT_FAILED, nil - case "EXT_FATAL": return ExtensionCode_EXT_FATAL, nil - } - return ExtensionCode(0), fmt.Errorf("not a valid ExtensionCode string") + switch s { + case "EXT_SUCCESS": + return ExtensionCode_EXT_SUCCESS, nil + case "EXT_FAILED": + return ExtensionCode_EXT_FAILED, nil + case "EXT_FATAL": + return ExtensionCode_EXT_FATAL, nil + } + return ExtensionCode(0), fmt.Errorf("not a valid ExtensionCode string") } - func ExtensionCodePtr(v ExtensionCode) *ExtensionCode { return &v } func (p ExtensionCode) MarshalText() ([]byte, error) { -return []byte(p.String()), nil + return []byte(p.String()), nil } func (p *ExtensionCode) UnmarshalText(text []byte) error { -q, err := ExtensionCodeFromString(string(text)) -if (err != nil) { -return err -} -*p = q -return nil + q, err := ExtensionCodeFromString(string(text)) + if err != nil { + return err + } + *p = q + return nil } func (p *ExtensionCode) Scan(value interface{}) error { -v, ok := value.(int64) -if !ok { -return errors.New("Scan value is not int64") -} -*p = ExtensionCode(v) -return nil + v, ok := value.(int64) + if !ok { + return errors.New("Scan value is not int64") + } + *p = ExtensionCode(v) + return nil } -func (p * ExtensionCode) Value() (driver.Value, error) { - if p == nil { - return nil, nil - } -return int64(*p), nil +func (p *ExtensionCode) Value() (driver.Value, error) { + if p == nil { + return nil, nil + } + return int64(*p), nil } + type ExtensionPluginRequest map[string]string func ExtensionPluginRequestPtr(v ExtensionPluginRequest) *ExtensionPluginRequest { return &v } @@ -109,162 +112,162 @@ func InternalExtensionListPtr(v InternalExtensionList) *InternalExtensionList { // - DefaultValue // - Type type InternalOptionInfo struct { - Value string `thrift:"value,1" db:"value" json:"value"` - DefaultValue string `thrift:"default_value,2" db:"default_value" json:"default_value"` - Type string `thrift:"type,3" db:"type" json:"type"` + Value string `thrift:"value,1" db:"value" json:"value"` + DefaultValue string `thrift:"default_value,2" db:"default_value" json:"default_value"` + Type string `thrift:"type,3" db:"type" json:"type"` } func NewInternalOptionInfo() *InternalOptionInfo { - return &InternalOptionInfo{} + return &InternalOptionInfo{} } - func (p *InternalOptionInfo) GetValue() string { - return p.Value + return p.Value } func (p *InternalOptionInfo) GetDefaultValue() string { - return p.DefaultValue + return p.DefaultValue } func (p *InternalOptionInfo) GetType() string { - return p.Type + return p.Type } func (p *InternalOptionInfo) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 1: - if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *InternalOptionInfo) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 1: ", err) -} else { - p.Value = v -} - return nil -} - -func (p *InternalOptionInfo) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 2: ", err) -} else { - p.DefaultValue = v -} - return nil -} - -func (p *InternalOptionInfo) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 3: ", err) -} else { - p.Type = v -} - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if err := p.ReadField1(iprot); err != nil { + return err + } + case 2: + if err := p.ReadField2(iprot); err != nil { + return err + } + case 3: + if err := p.ReadField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *InternalOptionInfo) ReadField1(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Value = v + } + return nil +} + +func (p *InternalOptionInfo) ReadField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.DefaultValue = v + } + return nil +} + +func (p *InternalOptionInfo) ReadField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.Type = v + } + return nil } func (p *InternalOptionInfo) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("InternalOptionInfo"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("InternalOptionInfo"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := p.writeField3(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *InternalOptionInfo) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("value", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:value: ", p), err) } - if err := oprot.WriteString(string(p.Value)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.value (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:value: ", p), err) } - return err + if err := oprot.WriteFieldBegin("value", thrift.STRING, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:value: ", p), err) + } + if err := oprot.WriteString(string(p.Value)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.value (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:value: ", p), err) + } + return err } func (p *InternalOptionInfo) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("default_value", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:default_value: ", p), err) } - if err := oprot.WriteString(string(p.DefaultValue)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.default_value (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:default_value: ", p), err) } - return err + if err := oprot.WriteFieldBegin("default_value", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:default_value: ", p), err) + } + if err := oprot.WriteString(string(p.DefaultValue)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.default_value (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:default_value: ", p), err) + } + return err } func (p *InternalOptionInfo) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("type", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:type: ", p), err) } - if err := oprot.WriteString(string(p.Type)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.type (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:type: ", p), err) } - return err + if err := oprot.WriteFieldBegin("type", thrift.STRING, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:type: ", p), err) + } + if err := oprot.WriteString(string(p.Type)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.type (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:type: ", p), err) + } + return err } func (p *InternalOptionInfo) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("InternalOptionInfo(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("InternalOptionInfo(%+v)", *p) } // Attributes: @@ -273,197 +276,196 @@ func (p *InternalOptionInfo) String() string { // - SdkVersion // - MinSdkVersion type InternalExtensionInfo struct { - Name string `thrift:"name,1" db:"name" json:"name"` - Version string `thrift:"version,2" db:"version" json:"version"` - SdkVersion string `thrift:"sdk_version,3" db:"sdk_version" json:"sdk_version"` - MinSdkVersion string `thrift:"min_sdk_version,4" db:"min_sdk_version" json:"min_sdk_version"` + Name string `thrift:"name,1" db:"name" json:"name"` + Version string `thrift:"version,2" db:"version" json:"version"` + SdkVersion string `thrift:"sdk_version,3" db:"sdk_version" json:"sdk_version"` + MinSdkVersion string `thrift:"min_sdk_version,4" db:"min_sdk_version" json:"min_sdk_version"` } func NewInternalExtensionInfo() *InternalExtensionInfo { - return &InternalExtensionInfo{} + return &InternalExtensionInfo{} } - func (p *InternalExtensionInfo) GetName() string { - return p.Name + return p.Name } func (p *InternalExtensionInfo) GetVersion() string { - return p.Version + return p.Version } func (p *InternalExtensionInfo) GetSdkVersion() string { - return p.SdkVersion + return p.SdkVersion } func (p *InternalExtensionInfo) GetMinSdkVersion() string { - return p.MinSdkVersion + return p.MinSdkVersion } func (p *InternalExtensionInfo) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 1: - if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.STRING { - if err := p.ReadField4(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *InternalExtensionInfo) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 1: ", err) -} else { - p.Name = v -} - return nil -} - -func (p *InternalExtensionInfo) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 2: ", err) -} else { - p.Version = v -} - return nil -} - -func (p *InternalExtensionInfo) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 3: ", err) -} else { - p.SdkVersion = v -} - return nil -} - -func (p *InternalExtensionInfo) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 4: ", err) -} else { - p.MinSdkVersion = v -} - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if err := p.ReadField1(iprot); err != nil { + return err + } + case 2: + if err := p.ReadField2(iprot); err != nil { + return err + } + case 3: + if err := p.ReadField3(iprot); err != nil { + return err + } + case 4: + if err := p.ReadField4(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *InternalExtensionInfo) ReadField1(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Name = v + } + return nil +} + +func (p *InternalExtensionInfo) ReadField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.Version = v + } + return nil +} + +func (p *InternalExtensionInfo) ReadField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.SdkVersion = v + } + return nil +} + +func (p *InternalExtensionInfo) ReadField4(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 4: ", err) + } else { + p.MinSdkVersion = v + } + return nil } func (p *InternalExtensionInfo) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("InternalExtensionInfo"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("InternalExtensionInfo"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := p.writeField3(oprot); err != nil { + return err + } + if err := p.writeField4(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *InternalExtensionInfo) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err) } - return err + if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) + } + if err := oprot.WriteString(string(p.Name)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err) + } + return err } func (p *InternalExtensionInfo) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("version", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:version: ", p), err) } - if err := oprot.WriteString(string(p.Version)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.version (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:version: ", p), err) } - return err + if err := oprot.WriteFieldBegin("version", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:version: ", p), err) + } + if err := oprot.WriteString(string(p.Version)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.version (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:version: ", p), err) + } + return err } func (p *InternalExtensionInfo) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("sdk_version", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:sdk_version: ", p), err) } - if err := oprot.WriteString(string(p.SdkVersion)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.sdk_version (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:sdk_version: ", p), err) } - return err + if err := oprot.WriteFieldBegin("sdk_version", thrift.STRING, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:sdk_version: ", p), err) + } + if err := oprot.WriteString(string(p.SdkVersion)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.sdk_version (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:sdk_version: ", p), err) + } + return err } func (p *InternalExtensionInfo) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("min_sdk_version", thrift.STRING, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:min_sdk_version: ", p), err) } - if err := oprot.WriteString(string(p.MinSdkVersion)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.min_sdk_version (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:min_sdk_version: ", p), err) } - return err + if err := oprot.WriteFieldBegin("min_sdk_version", thrift.STRING, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:min_sdk_version: ", p), err) + } + if err := oprot.WriteString(string(p.MinSdkVersion)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.min_sdk_version (4) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:min_sdk_version: ", p), err) + } + return err } func (p *InternalExtensionInfo) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("InternalExtensionInfo(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("InternalExtensionInfo(%+v)", *p) } // Attributes: @@ -471,346 +473,349 @@ func (p *InternalExtensionInfo) String() string { // - Message // - UUID type ExtensionStatus struct { - Code int32 `thrift:"code,1" db:"code" json:"code"` - Message string `thrift:"message,2" db:"message" json:"message"` - UUID ExtensionRouteUUID `thrift:"uuid,3" db:"uuid" json:"uuid"` + Code int32 `thrift:"code,1" db:"code" json:"code"` + Message string `thrift:"message,2" db:"message" json:"message"` + UUID ExtensionRouteUUID `thrift:"uuid,3" db:"uuid" json:"uuid"` } func NewExtensionStatus() *ExtensionStatus { - return &ExtensionStatus{} + return &ExtensionStatus{} } - func (p *ExtensionStatus) GetCode() int32 { - return p.Code + return p.Code } func (p *ExtensionStatus) GetMessage() string { - return p.Message + return p.Message } func (p *ExtensionStatus) GetUUID() ExtensionRouteUUID { - return p.UUID + return p.UUID } func (p *ExtensionStatus) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 1: - if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.I64 { - if err := p.ReadField3(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ExtensionStatus) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return thrift.PrependError("error reading field 1: ", err) -} else { - p.Code = v -} - return nil -} - -func (p *ExtensionStatus) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 2: ", err) -} else { - p.Message = v -} - return nil -} - -func (p *ExtensionStatus) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return thrift.PrependError("error reading field 3: ", err) -} else { - temp := ExtensionRouteUUID(v) - p.UUID = temp -} - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if err := p.ReadField1(iprot); err != nil { + return err + } + case 2: + if err := p.ReadField2(iprot); err != nil { + return err + } + case 3: + if err := p.ReadField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ExtensionStatus) ReadField1(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Code = v + } + return nil +} + +func (p *ExtensionStatus) ReadField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.Message = v + } + return nil +} + +func (p *ExtensionStatus) ReadField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + temp := ExtensionRouteUUID(v) + p.UUID = temp + } + return nil } func (p *ExtensionStatus) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ExtensionStatus"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("ExtensionStatus"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := p.writeField3(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionStatus) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("code", thrift.I32, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:code: ", p), err) } - if err := oprot.WriteI32(int32(p.Code)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.code (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:code: ", p), err) } - return err + if err := oprot.WriteFieldBegin("code", thrift.I32, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:code: ", p), err) + } + if err := oprot.WriteI32(int32(p.Code)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.code (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:code: ", p), err) + } + return err } func (p *ExtensionStatus) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("message", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:message: ", p), err) } - if err := oprot.WriteString(string(p.Message)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.message (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:message: ", p), err) } - return err + if err := oprot.WriteFieldBegin("message", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:message: ", p), err) + } + if err := oprot.WriteString(string(p.Message)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.message (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:message: ", p), err) + } + return err } func (p *ExtensionStatus) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("uuid", thrift.I64, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:uuid: ", p), err) } - if err := oprot.WriteI64(int64(p.UUID)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.uuid (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:uuid: ", p), err) } - return err + if err := oprot.WriteFieldBegin("uuid", thrift.I64, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:uuid: ", p), err) + } + if err := oprot.WriteI64(int64(p.UUID)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.uuid (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:uuid: ", p), err) + } + return err } func (p *ExtensionStatus) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionStatus(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionStatus(%+v)", *p) } // Attributes: // - Status // - Response type ExtensionResponse struct { - Status *ExtensionStatus `thrift:"status,1" db:"status" json:"status"` - Response ExtensionPluginResponse `thrift:"response,2" db:"response" json:"response"` + Status *ExtensionStatus `thrift:"status,1" db:"status" json:"status"` + Response ExtensionPluginResponse `thrift:"response,2" db:"response" json:"response"` } func NewExtensionResponse() *ExtensionResponse { - return &ExtensionResponse{} + return &ExtensionResponse{} } var ExtensionResponse_Status_DEFAULT *ExtensionStatus + func (p *ExtensionResponse) GetStatus() *ExtensionStatus { - if !p.IsSetStatus() { - return ExtensionResponse_Status_DEFAULT - } -return p.Status + if !p.IsSetStatus() { + return ExtensionResponse_Status_DEFAULT + } + return p.Status } func (p *ExtensionResponse) GetResponse() ExtensionPluginResponse { - return p.Response + return p.Response } func (p *ExtensionResponse) IsSetStatus() bool { - return p.Status != nil + return p.Status != nil } func (p *ExtensionResponse) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 1: - if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.LIST { - if err := p.ReadField2(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ExtensionResponse) ReadField1(iprot thrift.TProtocol) error { - p.Status = &ExtensionStatus{} - if err := p.Status.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) - } - return nil -} - -func (p *ExtensionResponse) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make(ExtensionPluginResponse, 0, size) - p.Response = tSlice - for i := 0; i < size; i ++ { - _, _, size, err := iprot.ReadMapBegin() - if err != nil { - return thrift.PrependError("error reading map begin: ", err) - } - tMap := make(map[string]string, size) - _elem0 := tMap - for i := 0; i < size; i ++ { -var _key1 string - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _key1 = v -} -var _val2 string - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _val2 = v -} - _elem0[_key1] = _val2 - } - if err := iprot.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) - } - p.Response = append(p.Response, _elem0) - } - if err := iprot.ReadListEnd(); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if err := p.ReadField1(iprot); err != nil { + return err + } + case 2: + if err := p.ReadField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ExtensionResponse) ReadField1(iprot thrift.TProtocol) error { + p.Status = &ExtensionStatus{} + if err := p.Status.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Status), err) + } + return nil +} + +func (p *ExtensionResponse) ReadField2(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make(ExtensionPluginResponse, 0, size) + p.Response = tSlice + for i := 0; i < size; i++ { + _, _, size, err := iprot.ReadMapBegin() + if err != nil { + return thrift.PrependError("error reading map begin: ", err) + } + tMap := make(map[string]string, size) + _elem0 := tMap + for i := 0; i < size; i++ { + var _key1 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _key1 = v + } + var _val2 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _val2 = v + } + _elem0[_key1] = _val2 + } + if err := iprot.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) + } + p.Response = append(p.Response, _elem0) + } + if err := iprot.ReadListEnd(); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil } func (p *ExtensionResponse) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ExtensionResponse"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("ExtensionResponse"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionResponse) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("status", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } - if err := p.Status.Write(oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Status), err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } - return err + if err := oprot.WriteFieldBegin("status", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) + } + if err := p.Status.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Status), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) + } + return err } func (p *ExtensionResponse) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("response", thrift.LIST, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:response: ", p), err) } - if err := oprot.WriteListBegin(thrift.MAP, len(p.Response)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Response { - if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(v)); err != nil { - return thrift.PrependError("error writing map begin: ", err) - } - for k, v := range v { - if err := oprot.WriteString(string(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := oprot.WriteString(string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:response: ", p), err) } - return err + if err := oprot.WriteFieldBegin("response", thrift.LIST, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:response: ", p), err) + } + if err := oprot.WriteListBegin(thrift.MAP, len(p.Response)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.Response { + if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(v)); err != nil { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range v { + if err := oprot.WriteString(string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + if err := oprot.WriteString(string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) + } + } + if err := oprot.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:response: ", p), err) + } + return err } func (p *ExtensionResponse) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionResponse(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionResponse(%+v)", *p) } // Attributes: @@ -818,574 +823,776 @@ func (p *ExtensionResponse) String() string { // - Message // - UUID type ExtensionException struct { - Code int32 `thrift:"code,1" db:"code" json:"code"` - Message string `thrift:"message,2" db:"message" json:"message"` - UUID ExtensionRouteUUID `thrift:"uuid,3" db:"uuid" json:"uuid"` + Code int32 `thrift:"code,1" db:"code" json:"code"` + Message string `thrift:"message,2" db:"message" json:"message"` + UUID ExtensionRouteUUID `thrift:"uuid,3" db:"uuid" json:"uuid"` } func NewExtensionException() *ExtensionException { - return &ExtensionException{} + return &ExtensionException{} } - func (p *ExtensionException) GetCode() int32 { - return p.Code + return p.Code } func (p *ExtensionException) GetMessage() string { - return p.Message + return p.Message } func (p *ExtensionException) GetUUID() ExtensionRouteUUID { - return p.UUID + return p.UUID } func (p *ExtensionException) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 1: - if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.I64 { - if err := p.ReadField3(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ExtensionException) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return thrift.PrependError("error reading field 1: ", err) -} else { - p.Code = v -} - return nil -} - -func (p *ExtensionException) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 2: ", err) -} else { - p.Message = v -} - return nil -} - -func (p *ExtensionException) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return thrift.PrependError("error reading field 3: ", err) -} else { - temp := ExtensionRouteUUID(v) - p.UUID = temp -} - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if err := p.ReadField1(iprot); err != nil { + return err + } + case 2: + if err := p.ReadField2(iprot); err != nil { + return err + } + case 3: + if err := p.ReadField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ExtensionException) ReadField1(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Code = v + } + return nil +} + +func (p *ExtensionException) ReadField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.Message = v + } + return nil +} + +func (p *ExtensionException) ReadField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + temp := ExtensionRouteUUID(v) + p.UUID = temp + } + return nil } func (p *ExtensionException) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ExtensionException"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("ExtensionException"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := p.writeField3(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionException) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("code", thrift.I32, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:code: ", p), err) } - if err := oprot.WriteI32(int32(p.Code)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.code (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:code: ", p), err) } - return err + if err := oprot.WriteFieldBegin("code", thrift.I32, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:code: ", p), err) + } + if err := oprot.WriteI32(int32(p.Code)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.code (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:code: ", p), err) + } + return err } func (p *ExtensionException) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("message", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:message: ", p), err) } - if err := oprot.WriteString(string(p.Message)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.message (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:message: ", p), err) } - return err + if err := oprot.WriteFieldBegin("message", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:message: ", p), err) + } + if err := oprot.WriteString(string(p.Message)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.message (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:message: ", p), err) + } + return err } func (p *ExtensionException) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("uuid", thrift.I64, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:uuid: ", p), err) } - if err := oprot.WriteI64(int64(p.UUID)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.uuid (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:uuid: ", p), err) } - return err + if err := oprot.WriteFieldBegin("uuid", thrift.I64, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:uuid: ", p), err) + } + if err := oprot.WriteI64(int64(p.UUID)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.uuid (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:uuid: ", p), err) + } + return err } func (p *ExtensionException) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionException(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionException(%+v)", *p) } func (p *ExtensionException) Error() string { - return p.String() + return p.String() } type Extension interface { - Ping(ctx context.Context) (r *ExtensionStatus, err error) - // Parameters: - // - Registry - // - Item - // - Request - Call(ctx context.Context, registry string, item string, request ExtensionPluginRequest) (r *ExtensionResponse, err error) - Shutdown(ctx context.Context) (err error) + Ping() (r *ExtensionStatus, err error) + // Parameters: + // - Registry + // - Item + // - Request + Call(registry string, item string, request ExtensionPluginRequest) (r *ExtensionResponse, err error) + Shutdown() (err error) } type ExtensionClient struct { - c thrift.TClient + Transport thrift.TTransport + ProtocolFactory thrift.TProtocolFactory + InputProtocol thrift.TProtocol + OutputProtocol thrift.TProtocol + SeqId int32 } -// Deprecated: Use NewExtension instead func NewExtensionClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ExtensionClient { - return &ExtensionClient{ - c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), - } + return &ExtensionClient{Transport: t, + ProtocolFactory: f, + InputProtocol: f.GetProtocol(t), + OutputProtocol: f.GetProtocol(t), + SeqId: 0, + } } -// Deprecated: Use NewExtension instead func NewExtensionClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ExtensionClient { - return &ExtensionClient{ - c: thrift.NewTStandardClient(iprot, oprot), - } -} - -func NewExtensionClient(c thrift.TClient) *ExtensionClient { - return &ExtensionClient{ - c: c, - } -} - -func (p *ExtensionClient) Ping(ctx context.Context) (r *ExtensionStatus, err error) { - var _args3 ExtensionPingArgs - var _result4 ExtensionPingResult - if err = p.c.Call(ctx, "ping", &_args3, &_result4); err != nil { - return - } - return _result4.GetSuccess(), nil + return &ExtensionClient{Transport: t, + ProtocolFactory: nil, + InputProtocol: iprot, + OutputProtocol: oprot, + SeqId: 0, + } +} + +func (p *ExtensionClient) Ping() (r *ExtensionStatus, err error) { + if err = p.sendPing(); err != nil { + return + } + return p.recvPing() +} + +func (p *ExtensionClient) sendPing() (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("ping", thrift.CALL, p.SeqId); err != nil { + return + } + args := ExtensionPingArgs{} + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ExtensionClient) recvPing() (value *ExtensionStatus, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "ping" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "ping failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "ping failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error3 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error4 error + error4, err = error3.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error4 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "ping failed: invalid message type") + return + } + result := ExtensionPingResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return } // Parameters: // - Registry // - Item // - Request -func (p *ExtensionClient) Call(ctx context.Context, registry string, item string, request ExtensionPluginRequest) (r *ExtensionResponse, err error) { - var _args5 ExtensionCallArgs - _args5.Registry = registry - _args5.Item = item - _args5.Request = request - var _result6 ExtensionCallResult - if err = p.c.Call(ctx, "call", &_args5, &_result6); err != nil { - return - } - return _result6.GetSuccess(), nil -} - -func (p *ExtensionClient) Shutdown(ctx context.Context) (err error) { - var _args7 ExtensionShutdownArgs - var _result8 ExtensionShutdownResult - if err = p.c.Call(ctx, "shutdown", &_args7, &_result8); err != nil { - return - } - return nil +func (p *ExtensionClient) Call(registry string, item string, request ExtensionPluginRequest) (r *ExtensionResponse, err error) { + if err = p.sendCall(registry, item, request); err != nil { + return + } + return p.recvCall() +} + +func (p *ExtensionClient) sendCall(registry string, item string, request ExtensionPluginRequest) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("call", thrift.CALL, p.SeqId); err != nil { + return + } + args := ExtensionCallArgs{ + Registry: registry, + Item: item, + Request: request, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ExtensionClient) recvCall() (value *ExtensionResponse, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "call" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "call failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "call failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error5 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error6 error + error6, err = error5.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error6 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "call failed: invalid message type") + return + } + result := ExtensionCallResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +func (p *ExtensionClient) Shutdown() (err error) { + if err = p.sendShutdown(); err != nil { + return + } + return p.recvShutdown() +} + +func (p *ExtensionClient) sendShutdown() (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("shutdown", thrift.CALL, p.SeqId); err != nil { + return + } + args := ExtensionShutdownArgs{} + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ExtensionClient) recvShutdown() (err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "shutdown" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "shutdown failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "shutdown failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error7 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error8 error + error8, err = error7.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error8 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "shutdown failed: invalid message type") + return + } + result := ExtensionShutdownResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + return } type ExtensionProcessor struct { - processorMap map[string]thrift.TProcessorFunction - handler Extension + processorMap map[string]thrift.TProcessorFunction + handler Extension } func (p *ExtensionProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { - p.processorMap[key] = processor + p.processorMap[key] = processor } func (p *ExtensionProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { - processor, ok = p.processorMap[key] - return processor, ok + processor, ok = p.processorMap[key] + return processor, ok } func (p *ExtensionProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { - return p.processorMap + return p.processorMap } func NewExtensionProcessor(handler Extension) *ExtensionProcessor { - self9 := &ExtensionProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)} - self9.processorMap["ping"] = &extensionProcessorPing{handler:handler} - self9.processorMap["call"] = &extensionProcessorCall{handler:handler} - self9.processorMap["shutdown"] = &extensionProcessorShutdown{handler:handler} -return self9 + self9 := &ExtensionProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} + self9.processorMap["ping"] = &extensionProcessorPing{handler: handler} + self9.processorMap["call"] = &extensionProcessorCall{handler: handler} + self9.processorMap["shutdown"] = &extensionProcessorShutdown{handler: handler} + return self9 } -func (p *ExtensionProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err := iprot.ReadMessageBegin() - if err != nil { return false, err } - if processor, ok := p.GetProcessorFunction(name); ok { - return processor.Process(ctx, seqId, iprot, oprot) - } - iprot.Skip(thrift.STRUCT) - iprot.ReadMessageEnd() - x10 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) - oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) - x10.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, x10 +func (p *ExtensionProcessor) Process(iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + name, _, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return false, err + } + if processor, ok := p.GetProcessorFunction(name); ok { + return processor.Process(seqId, iprot, oprot) + } + iprot.Skip(thrift.STRUCT) + iprot.ReadMessageEnd() + x10 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) + oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) + x10.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return false, x10 } type extensionProcessorPing struct { - handler Extension -} - -func (p *extensionProcessorPing) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := ExtensionPingArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("ping", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := ExtensionPingResult{} -var retval *ExtensionStatus - var err2 error - if retval, err2 = p.handler.Ping(ctx); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing ping: " + err2.Error()) - oprot.WriteMessageBegin("ping", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } else { - result.Success = retval -} - if err2 = oprot.WriteMessageBegin("ping", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err + handler Extension +} + +func (p *extensionProcessorPing) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := ExtensionPingArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("ping", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ExtensionPingResult{} + var retval *ExtensionStatus + var err2 error + if retval, err2 = p.handler.Ping(); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing ping: "+err2.Error()) + oprot.WriteMessageBegin("ping", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("ping", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err } type extensionProcessorCall struct { - handler Extension -} - -func (p *extensionProcessorCall) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := ExtensionCallArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("call", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := ExtensionCallResult{} -var retval *ExtensionResponse - var err2 error - if retval, err2 = p.handler.Call(ctx, args.Registry, args.Item, args.Request); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing call: " + err2.Error()) - oprot.WriteMessageBegin("call", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } else { - result.Success = retval -} - if err2 = oprot.WriteMessageBegin("call", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err + handler Extension +} + +func (p *extensionProcessorCall) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := ExtensionCallArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("call", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ExtensionCallResult{} + var retval *ExtensionResponse + var err2 error + if retval, err2 = p.handler.Call(args.Registry, args.Item, args.Request); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing call: "+err2.Error()) + oprot.WriteMessageBegin("call", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("call", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err } type extensionProcessorShutdown struct { - handler Extension -} - -func (p *extensionProcessorShutdown) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := ExtensionShutdownArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("shutdown", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := ExtensionShutdownResult{} - var err2 error - if err2 = p.handler.Shutdown(ctx); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing shutdown: " + err2.Error()) - oprot.WriteMessageBegin("shutdown", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - if err2 = oprot.WriteMessageBegin("shutdown", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err + handler Extension +} + +func (p *extensionProcessorShutdown) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := ExtensionShutdownArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("shutdown", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ExtensionShutdownResult{} + var err2 error + if err2 = p.handler.Shutdown(); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing shutdown: "+err2.Error()) + oprot.WriteMessageBegin("shutdown", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, err2 + } + if err2 = oprot.WriteMessageBegin("shutdown", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err } - // HELPER FUNCTIONS AND STRUCTURES type ExtensionPingArgs struct { } func NewExtensionPingArgs() *ExtensionPingArgs { - return &ExtensionPingArgs{} + return &ExtensionPingArgs{} } func (p *ExtensionPingArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil } func (p *ExtensionPingArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ping_args"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("ping_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionPingArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionPingArgs(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionPingArgs(%+v)", *p) } // Attributes: // - Success type ExtensionPingResult struct { - Success *ExtensionStatus `thrift:"success,0" db:"success" json:"success,omitempty"` + Success *ExtensionStatus `thrift:"success,0" db:"success" json:"success,omitempty"` } func NewExtensionPingResult() *ExtensionPingResult { - return &ExtensionPingResult{} + return &ExtensionPingResult{} } var ExtensionPingResult_Success_DEFAULT *ExtensionStatus + func (p *ExtensionPingResult) GetSuccess() *ExtensionStatus { - if !p.IsSetSuccess() { - return ExtensionPingResult_Success_DEFAULT - } -return p.Success + if !p.IsSetSuccess() { + return ExtensionPingResult_Success_DEFAULT + } + return p.Success } func (p *ExtensionPingResult) IsSetSuccess() bool { - return p.Success != nil + return p.Success != nil } func (p *ExtensionPingResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 0: - if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ExtensionPingResult) ReadField0(iprot thrift.TProtocol) error { - p.Success = &ExtensionStatus{} - if err := p.Success.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) - } - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.ReadField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ExtensionPingResult) ReadField0(iprot thrift.TProtocol) error { + p.Success = &ExtensionStatus{} + if err := p.Success.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) + } + return nil } func (p *ExtensionPingResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ping_result"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField0(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("ping_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField0(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionPingResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } - } - return err + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) + } + if err := p.Success.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err } func (p *ExtensionPingResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionPingResult(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionPingResult(%+v)", *p) } // Attributes: @@ -1393,2077 +1600,2501 @@ func (p *ExtensionPingResult) String() string { // - Item // - Request type ExtensionCallArgs struct { - Registry string `thrift:"registry,1" db:"registry" json:"registry"` - Item string `thrift:"item,2" db:"item" json:"item"` - Request ExtensionPluginRequest `thrift:"request,3" db:"request" json:"request"` + Registry string `thrift:"registry,1" db:"registry" json:"registry"` + Item string `thrift:"item,2" db:"item" json:"item"` + Request ExtensionPluginRequest `thrift:"request,3" db:"request" json:"request"` } func NewExtensionCallArgs() *ExtensionCallArgs { - return &ExtensionCallArgs{} + return &ExtensionCallArgs{} } - func (p *ExtensionCallArgs) GetRegistry() string { - return p.Registry + return p.Registry } func (p *ExtensionCallArgs) GetItem() string { - return p.Item + return p.Item } func (p *ExtensionCallArgs) GetRequest() ExtensionPluginRequest { - return p.Request + return p.Request } func (p *ExtensionCallArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 1: - if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.MAP { - if err := p.ReadField3(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ExtensionCallArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 1: ", err) -} else { - p.Registry = v -} - return nil -} - -func (p *ExtensionCallArgs) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 2: ", err) -} else { - p.Item = v -} - return nil -} - -func (p *ExtensionCallArgs) ReadField3(iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin() - if err != nil { - return thrift.PrependError("error reading map begin: ", err) - } - tMap := make(ExtensionPluginRequest, size) - p.Request = tMap - for i := 0; i < size; i ++ { -var _key11 string - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _key11 = v -} -var _val12 string - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _val12 = v -} - p.Request[_key11] = _val12 - } - if err := iprot.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) - } - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if err := p.ReadField1(iprot); err != nil { + return err + } + case 2: + if err := p.ReadField2(iprot); err != nil { + return err + } + case 3: + if err := p.ReadField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ExtensionCallArgs) ReadField1(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Registry = v + } + return nil +} + +func (p *ExtensionCallArgs) ReadField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.Item = v + } + return nil +} + +func (p *ExtensionCallArgs) ReadField3(iprot thrift.TProtocol) error { + _, _, size, err := iprot.ReadMapBegin() + if err != nil { + return thrift.PrependError("error reading map begin: ", err) + } + tMap := make(ExtensionPluginRequest, size) + p.Request = tMap + for i := 0; i < size; i++ { + var _key11 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _key11 = v + } + var _val12 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _val12 = v + } + p.Request[_key11] = _val12 + } + if err := iprot.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) + } + return nil } func (p *ExtensionCallArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("call_args"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("call_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := p.writeField3(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionCallArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("registry", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:registry: ", p), err) } - if err := oprot.WriteString(string(p.Registry)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.registry (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:registry: ", p), err) } - return err + if err := oprot.WriteFieldBegin("registry", thrift.STRING, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:registry: ", p), err) + } + if err := oprot.WriteString(string(p.Registry)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.registry (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:registry: ", p), err) + } + return err } func (p *ExtensionCallArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("item", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:item: ", p), err) } - if err := oprot.WriteString(string(p.Item)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.item (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:item: ", p), err) } - return err + if err := oprot.WriteFieldBegin("item", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:item: ", p), err) + } + if err := oprot.WriteString(string(p.Item)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.item (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:item: ", p), err) + } + return err } func (p *ExtensionCallArgs) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("request", thrift.MAP, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:request: ", p), err) } - if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.Request)); err != nil { - return thrift.PrependError("error writing map begin: ", err) - } - for k, v := range p.Request { - if err := oprot.WriteString(string(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := oprot.WriteString(string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:request: ", p), err) } - return err + if err := oprot.WriteFieldBegin("request", thrift.MAP, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:request: ", p), err) + } + if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.Request)); err != nil { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range p.Request { + if err := oprot.WriteString(string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + if err := oprot.WriteString(string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:request: ", p), err) + } + return err } func (p *ExtensionCallArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionCallArgs(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionCallArgs(%+v)", *p) } // Attributes: // - Success type ExtensionCallResult struct { - Success *ExtensionResponse `thrift:"success,0" db:"success" json:"success,omitempty"` + Success *ExtensionResponse `thrift:"success,0" db:"success" json:"success,omitempty"` } func NewExtensionCallResult() *ExtensionCallResult { - return &ExtensionCallResult{} + return &ExtensionCallResult{} } var ExtensionCallResult_Success_DEFAULT *ExtensionResponse + func (p *ExtensionCallResult) GetSuccess() *ExtensionResponse { - if !p.IsSetSuccess() { - return ExtensionCallResult_Success_DEFAULT - } -return p.Success + if !p.IsSetSuccess() { + return ExtensionCallResult_Success_DEFAULT + } + return p.Success } func (p *ExtensionCallResult) IsSetSuccess() bool { - return p.Success != nil + return p.Success != nil } func (p *ExtensionCallResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 0: - if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ExtensionCallResult) ReadField0(iprot thrift.TProtocol) error { - p.Success = &ExtensionResponse{} - if err := p.Success.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) - } - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.ReadField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ExtensionCallResult) ReadField0(iprot thrift.TProtocol) error { + p.Success = &ExtensionResponse{} + if err := p.Success.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) + } + return nil } func (p *ExtensionCallResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("call_result"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField0(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("call_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField0(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionCallResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } - } - return err + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) + } + if err := p.Success.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err } func (p *ExtensionCallResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionCallResult(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionCallResult(%+v)", *p) } type ExtensionShutdownArgs struct { } func NewExtensionShutdownArgs() *ExtensionShutdownArgs { - return &ExtensionShutdownArgs{} + return &ExtensionShutdownArgs{} } func (p *ExtensionShutdownArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil } func (p *ExtensionShutdownArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("shutdown_args"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("shutdown_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionShutdownArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionShutdownArgs(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionShutdownArgs(%+v)", *p) } type ExtensionShutdownResult struct { } func NewExtensionShutdownResult() *ExtensionShutdownResult { - return &ExtensionShutdownResult{} + return &ExtensionShutdownResult{} } func (p *ExtensionShutdownResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil } func (p *ExtensionShutdownResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("shutdown_result"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("shutdown_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionShutdownResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionShutdownResult(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionShutdownResult(%+v)", *p) } - type ExtensionManager interface { -Extension - - Extensions(ctx context.Context) (r InternalExtensionList, err error) - Options(ctx context.Context) (r InternalOptionList, err error) - // Parameters: - // - Info - // - Registry - RegisterExtension(ctx context.Context, info *InternalExtensionInfo, registry ExtensionRegistry) (r *ExtensionStatus, err error) - // Parameters: - // - UUID - DeregisterExtension(ctx context.Context, uuid ExtensionRouteUUID) (r *ExtensionStatus, err error) - // Parameters: - // - Sql - Query(ctx context.Context, sql string) (r *ExtensionResponse, err error) - // Parameters: - // - Sql - GetQueryColumns(ctx context.Context, sql string) (r *ExtensionResponse, err error) + Extension + + Extensions() (r InternalExtensionList, err error) + Options() (r InternalOptionList, err error) + // Parameters: + // - Info + // - Registry + RegisterExtension(info *InternalExtensionInfo, registry ExtensionRegistry) (r *ExtensionStatus, err error) + // Parameters: + // - UUID + DeregisterExtension(uuid ExtensionRouteUUID) (r *ExtensionStatus, err error) + // Parameters: + // - Sql + Query(sql string) (r *ExtensionResponse, err error) + // Parameters: + // - Sql + GetQueryColumns(sql string) (r *ExtensionResponse, err error) } type ExtensionManagerClient struct { - c thrift.TClient - *ExtensionClient + *ExtensionClient } -// Deprecated: Use NewExtensionManager instead func NewExtensionManagerClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ExtensionManagerClient { - return &ExtensionManagerClient{ExtensionClient: NewExtensionClientFactory(t, f)}} - -// Deprecated: Use NewExtensionManager instead -func NewExtensionManagerClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ExtensionManagerClient { - return &ExtensionManagerClient{ExtensionClient: NewExtensionClientProtocol(t, iprot, oprot)} + return &ExtensionManagerClient{ExtensionClient: NewExtensionClientFactory(t, f)} } -func NewExtensionManagerClient(c thrift.TClient) *ExtensionManagerClient { - return &ExtensionManagerClient{ - c: c, - ExtensionClient: NewExtensionClient(c), - } -} - -func (p *ExtensionManagerClient) Extensions(ctx context.Context) (r InternalExtensionList, err error) { - var _args21 ExtensionManagerExtensionsArgs - var _result22 ExtensionManagerExtensionsResult - if err = p.c.Call(ctx, "extensions", &_args21, &_result22); err != nil { - return - } - return _result22.GetSuccess(), nil -} - -func (p *ExtensionManagerClient) Options(ctx context.Context) (r InternalOptionList, err error) { - var _args23 ExtensionManagerOptionsArgs - var _result24 ExtensionManagerOptionsResult - if err = p.c.Call(ctx, "options", &_args23, &_result24); err != nil { - return - } - return _result24.GetSuccess(), nil +func NewExtensionManagerClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ExtensionManagerClient { + return &ExtensionManagerClient{ExtensionClient: NewExtensionClientProtocol(t, iprot, oprot)} +} + +func (p *ExtensionManagerClient) Extensions() (r InternalExtensionList, err error) { + if err = p.sendExtensions(); err != nil { + return + } + return p.recvExtensions() +} + +func (p *ExtensionManagerClient) sendExtensions() (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("extensions", thrift.CALL, p.SeqId); err != nil { + return + } + args := ExtensionManagerExtensionsArgs{} + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ExtensionManagerClient) recvExtensions() (value InternalExtensionList, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "extensions" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "extensions failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "extensions failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error21 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error22 error + error22, err = error21.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error22 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "extensions failed: invalid message type") + return + } + result := ExtensionManagerExtensionsResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +func (p *ExtensionManagerClient) Options() (r InternalOptionList, err error) { + if err = p.sendOptions(); err != nil { + return + } + return p.recvOptions() +} + +func (p *ExtensionManagerClient) sendOptions() (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("options", thrift.CALL, p.SeqId); err != nil { + return + } + args := ExtensionManagerOptionsArgs{} + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ExtensionManagerClient) recvOptions() (value InternalOptionList, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "options" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "options failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "options failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error23 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error24 error + error24, err = error23.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error24 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "options failed: invalid message type") + return + } + result := ExtensionManagerOptionsResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return } // Parameters: // - Info // - Registry -func (p *ExtensionManagerClient) RegisterExtension(ctx context.Context, info *InternalExtensionInfo, registry ExtensionRegistry) (r *ExtensionStatus, err error) { - var _args25 ExtensionManagerRegisterExtensionArgs - _args25.Info = info - _args25.Registry = registry - var _result26 ExtensionManagerRegisterExtensionResult - if err = p.c.Call(ctx, "registerExtension", &_args25, &_result26); err != nil { - return - } - return _result26.GetSuccess(), nil +func (p *ExtensionManagerClient) RegisterExtension(info *InternalExtensionInfo, registry ExtensionRegistry) (r *ExtensionStatus, err error) { + if err = p.sendRegisterExtension(info, registry); err != nil { + return + } + return p.recvRegisterExtension() +} + +func (p *ExtensionManagerClient) sendRegisterExtension(info *InternalExtensionInfo, registry ExtensionRegistry) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("registerExtension", thrift.CALL, p.SeqId); err != nil { + return + } + args := ExtensionManagerRegisterExtensionArgs{ + Info: info, + Registry: registry, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ExtensionManagerClient) recvRegisterExtension() (value *ExtensionStatus, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "registerExtension" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "registerExtension failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "registerExtension failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error25 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error26 error + error26, err = error25.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error26 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "registerExtension failed: invalid message type") + return + } + result := ExtensionManagerRegisterExtensionResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return } // Parameters: // - UUID -func (p *ExtensionManagerClient) DeregisterExtension(ctx context.Context, uuid ExtensionRouteUUID) (r *ExtensionStatus, err error) { - var _args27 ExtensionManagerDeregisterExtensionArgs - _args27.UUID = uuid - var _result28 ExtensionManagerDeregisterExtensionResult - if err = p.c.Call(ctx, "deregisterExtension", &_args27, &_result28); err != nil { - return - } - return _result28.GetSuccess(), nil +func (p *ExtensionManagerClient) DeregisterExtension(uuid ExtensionRouteUUID) (r *ExtensionStatus, err error) { + if err = p.sendDeregisterExtension(uuid); err != nil { + return + } + return p.recvDeregisterExtension() +} + +func (p *ExtensionManagerClient) sendDeregisterExtension(uuid ExtensionRouteUUID) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("deregisterExtension", thrift.CALL, p.SeqId); err != nil { + return + } + args := ExtensionManagerDeregisterExtensionArgs{ + UUID: uuid, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ExtensionManagerClient) recvDeregisterExtension() (value *ExtensionStatus, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "deregisterExtension" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "deregisterExtension failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "deregisterExtension failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error27 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error28 error + error28, err = error27.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error28 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "deregisterExtension failed: invalid message type") + return + } + result := ExtensionManagerDeregisterExtensionResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return } // Parameters: // - Sql -func (p *ExtensionManagerClient) Query(ctx context.Context, sql string) (r *ExtensionResponse, err error) { - var _args29 ExtensionManagerQueryArgs - _args29.Sql = sql - var _result30 ExtensionManagerQueryResult - if err = p.c.Call(ctx, "query", &_args29, &_result30); err != nil { - return - } - return _result30.GetSuccess(), nil +func (p *ExtensionManagerClient) Query(sql string) (r *ExtensionResponse, err error) { + if err = p.sendQuery(sql); err != nil { + return + } + return p.recvQuery() +} + +func (p *ExtensionManagerClient) sendQuery(sql string) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("query", thrift.CALL, p.SeqId); err != nil { + return + } + args := ExtensionManagerQueryArgs{ + Sql: sql, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ExtensionManagerClient) recvQuery() (value *ExtensionResponse, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "query" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "query failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "query failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error29 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error30 error + error30, err = error29.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error30 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "query failed: invalid message type") + return + } + result := ExtensionManagerQueryResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return } // Parameters: // - Sql -func (p *ExtensionManagerClient) GetQueryColumns(ctx context.Context, sql string) (r *ExtensionResponse, err error) { - var _args31 ExtensionManagerGetQueryColumnsArgs - _args31.Sql = sql - var _result32 ExtensionManagerGetQueryColumnsResult - if err = p.c.Call(ctx, "getQueryColumns", &_args31, &_result32); err != nil { - return - } - return _result32.GetSuccess(), nil +func (p *ExtensionManagerClient) GetQueryColumns(sql string) (r *ExtensionResponse, err error) { + if err = p.sendGetQueryColumns(sql); err != nil { + return + } + return p.recvGetQueryColumns() +} + +func (p *ExtensionManagerClient) sendGetQueryColumns(sql string) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("getQueryColumns", thrift.CALL, p.SeqId); err != nil { + return + } + args := ExtensionManagerGetQueryColumnsArgs{ + Sql: sql, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ExtensionManagerClient) recvGetQueryColumns() (value *ExtensionResponse, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "getQueryColumns" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "getQueryColumns failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getQueryColumns failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error31 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error32 error + error32, err = error31.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error32 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "getQueryColumns failed: invalid message type") + return + } + result := ExtensionManagerGetQueryColumnsResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return } type ExtensionManagerProcessor struct { - *ExtensionProcessor + *ExtensionProcessor } func NewExtensionManagerProcessor(handler ExtensionManager) *ExtensionManagerProcessor { - self33 := &ExtensionManagerProcessor{NewExtensionProcessor(handler)} - self33.AddToProcessorMap("extensions", &extensionManagerProcessorExtensions{handler:handler}) - self33.AddToProcessorMap("options", &extensionManagerProcessorOptions{handler:handler}) - self33.AddToProcessorMap("registerExtension", &extensionManagerProcessorRegisterExtension{handler:handler}) - self33.AddToProcessorMap("deregisterExtension", &extensionManagerProcessorDeregisterExtension{handler:handler}) - self33.AddToProcessorMap("query", &extensionManagerProcessorQuery{handler:handler}) - self33.AddToProcessorMap("getQueryColumns", &extensionManagerProcessorGetQueryColumns{handler:handler}) - return self33 + self33 := &ExtensionManagerProcessor{NewExtensionProcessor(handler)} + self33.AddToProcessorMap("extensions", &extensionManagerProcessorExtensions{handler: handler}) + self33.AddToProcessorMap("options", &extensionManagerProcessorOptions{handler: handler}) + self33.AddToProcessorMap("registerExtension", &extensionManagerProcessorRegisterExtension{handler: handler}) + self33.AddToProcessorMap("deregisterExtension", &extensionManagerProcessorDeregisterExtension{handler: handler}) + self33.AddToProcessorMap("query", &extensionManagerProcessorQuery{handler: handler}) + self33.AddToProcessorMap("getQueryColumns", &extensionManagerProcessorGetQueryColumns{handler: handler}) + return self33 } type extensionManagerProcessorExtensions struct { - handler ExtensionManager -} - -func (p *extensionManagerProcessorExtensions) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := ExtensionManagerExtensionsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("extensions", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := ExtensionManagerExtensionsResult{} -var retval InternalExtensionList - var err2 error - if retval, err2 = p.handler.Extensions(ctx); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing extensions: " + err2.Error()) - oprot.WriteMessageBegin("extensions", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } else { - result.Success = retval -} - if err2 = oprot.WriteMessageBegin("extensions", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err + handler ExtensionManager +} + +func (p *extensionManagerProcessorExtensions) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := ExtensionManagerExtensionsArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("extensions", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ExtensionManagerExtensionsResult{} + var retval InternalExtensionList + var err2 error + if retval, err2 = p.handler.Extensions(); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing extensions: "+err2.Error()) + oprot.WriteMessageBegin("extensions", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("extensions", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err } type extensionManagerProcessorOptions struct { - handler ExtensionManager -} - -func (p *extensionManagerProcessorOptions) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := ExtensionManagerOptionsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("options", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := ExtensionManagerOptionsResult{} -var retval InternalOptionList - var err2 error - if retval, err2 = p.handler.Options(ctx); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing options: " + err2.Error()) - oprot.WriteMessageBegin("options", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } else { - result.Success = retval -} - if err2 = oprot.WriteMessageBegin("options", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err + handler ExtensionManager +} + +func (p *extensionManagerProcessorOptions) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := ExtensionManagerOptionsArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("options", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ExtensionManagerOptionsResult{} + var retval InternalOptionList + var err2 error + if retval, err2 = p.handler.Options(); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing options: "+err2.Error()) + oprot.WriteMessageBegin("options", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("options", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err } type extensionManagerProcessorRegisterExtension struct { - handler ExtensionManager -} - -func (p *extensionManagerProcessorRegisterExtension) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := ExtensionManagerRegisterExtensionArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("registerExtension", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := ExtensionManagerRegisterExtensionResult{} -var retval *ExtensionStatus - var err2 error - if retval, err2 = p.handler.RegisterExtension(ctx, args.Info, args.Registry); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing registerExtension: " + err2.Error()) - oprot.WriteMessageBegin("registerExtension", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } else { - result.Success = retval -} - if err2 = oprot.WriteMessageBegin("registerExtension", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err + handler ExtensionManager +} + +func (p *extensionManagerProcessorRegisterExtension) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := ExtensionManagerRegisterExtensionArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("registerExtension", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ExtensionManagerRegisterExtensionResult{} + var retval *ExtensionStatus + var err2 error + if retval, err2 = p.handler.RegisterExtension(args.Info, args.Registry); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing registerExtension: "+err2.Error()) + oprot.WriteMessageBegin("registerExtension", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("registerExtension", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err } type extensionManagerProcessorDeregisterExtension struct { - handler ExtensionManager -} - -func (p *extensionManagerProcessorDeregisterExtension) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := ExtensionManagerDeregisterExtensionArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("deregisterExtension", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := ExtensionManagerDeregisterExtensionResult{} -var retval *ExtensionStatus - var err2 error - if retval, err2 = p.handler.DeregisterExtension(ctx, args.UUID); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing deregisterExtension: " + err2.Error()) - oprot.WriteMessageBegin("deregisterExtension", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } else { - result.Success = retval -} - if err2 = oprot.WriteMessageBegin("deregisterExtension", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err + handler ExtensionManager +} + +func (p *extensionManagerProcessorDeregisterExtension) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := ExtensionManagerDeregisterExtensionArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("deregisterExtension", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ExtensionManagerDeregisterExtensionResult{} + var retval *ExtensionStatus + var err2 error + if retval, err2 = p.handler.DeregisterExtension(args.UUID); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing deregisterExtension: "+err2.Error()) + oprot.WriteMessageBegin("deregisterExtension", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("deregisterExtension", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err } type extensionManagerProcessorQuery struct { - handler ExtensionManager -} - -func (p *extensionManagerProcessorQuery) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := ExtensionManagerQueryArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("query", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := ExtensionManagerQueryResult{} -var retval *ExtensionResponse - var err2 error - if retval, err2 = p.handler.Query(ctx, args.Sql); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing query: " + err2.Error()) - oprot.WriteMessageBegin("query", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } else { - result.Success = retval -} - if err2 = oprot.WriteMessageBegin("query", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err + handler ExtensionManager +} + +func (p *extensionManagerProcessorQuery) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := ExtensionManagerQueryArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("query", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ExtensionManagerQueryResult{} + var retval *ExtensionResponse + var err2 error + if retval, err2 = p.handler.Query(args.Sql); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing query: "+err2.Error()) + oprot.WriteMessageBegin("query", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("query", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err } type extensionManagerProcessorGetQueryColumns struct { - handler ExtensionManager -} - -func (p *extensionManagerProcessorGetQueryColumns) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := ExtensionManagerGetQueryColumnsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getQueryColumns", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := ExtensionManagerGetQueryColumnsResult{} -var retval *ExtensionResponse - var err2 error - if retval, err2 = p.handler.GetQueryColumns(ctx, args.Sql); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getQueryColumns: " + err2.Error()) - oprot.WriteMessageBegin("getQueryColumns", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } else { - result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getQueryColumns", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err + handler ExtensionManager +} + +func (p *extensionManagerProcessorGetQueryColumns) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := ExtensionManagerGetQueryColumnsArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("getQueryColumns", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ExtensionManagerGetQueryColumnsResult{} + var retval *ExtensionResponse + var err2 error + if retval, err2 = p.handler.GetQueryColumns(args.Sql); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getQueryColumns: "+err2.Error()) + oprot.WriteMessageBegin("getQueryColumns", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("getQueryColumns", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err } - // HELPER FUNCTIONS AND STRUCTURES type ExtensionManagerExtensionsArgs struct { } func NewExtensionManagerExtensionsArgs() *ExtensionManagerExtensionsArgs { - return &ExtensionManagerExtensionsArgs{} + return &ExtensionManagerExtensionsArgs{} } func (p *ExtensionManagerExtensionsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil } func (p *ExtensionManagerExtensionsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("extensions_args"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("extensions_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionManagerExtensionsArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionManagerExtensionsArgs(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionManagerExtensionsArgs(%+v)", *p) } // Attributes: // - Success type ExtensionManagerExtensionsResult struct { - Success InternalExtensionList `thrift:"success,0" db:"success" json:"success,omitempty"` + Success InternalExtensionList `thrift:"success,0" db:"success" json:"success,omitempty"` } func NewExtensionManagerExtensionsResult() *ExtensionManagerExtensionsResult { - return &ExtensionManagerExtensionsResult{} + return &ExtensionManagerExtensionsResult{} } var ExtensionManagerExtensionsResult_Success_DEFAULT InternalExtensionList func (p *ExtensionManagerExtensionsResult) GetSuccess() InternalExtensionList { - return p.Success + return p.Success } func (p *ExtensionManagerExtensionsResult) IsSetSuccess() bool { - return p.Success != nil + return p.Success != nil } func (p *ExtensionManagerExtensionsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 0: - if fieldTypeId == thrift.MAP { - if err := p.ReadField0(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ExtensionManagerExtensionsResult) ReadField0(iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin() - if err != nil { - return thrift.PrependError("error reading map begin: ", err) - } - tMap := make(InternalExtensionList, size) - p.Success = tMap - for i := 0; i < size; i ++ { -var _key34 ExtensionRouteUUID - if v, err := iprot.ReadI64(); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - temp := ExtensionRouteUUID(v) - _key34 = temp -} - _val35 := &InternalExtensionInfo{} - if err := _val35.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _val35), err) - } - p.Success[_key34] = _val35 - } - if err := iprot.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) - } - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.ReadField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ExtensionManagerExtensionsResult) ReadField0(iprot thrift.TProtocol) error { + _, _, size, err := iprot.ReadMapBegin() + if err != nil { + return thrift.PrependError("error reading map begin: ", err) + } + tMap := make(InternalExtensionList, size) + p.Success = tMap + for i := 0; i < size; i++ { + var _key34 ExtensionRouteUUID + if v, err := iprot.ReadI64(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + temp := ExtensionRouteUUID(v) + _key34 = temp + } + _val35 := &InternalExtensionInfo{} + if err := _val35.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _val35), err) + } + p.Success[_key34] = _val35 + } + if err := iprot.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) + } + return nil } func (p *ExtensionManagerExtensionsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("extensions_result"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField0(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("extensions_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField0(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionManagerExtensionsResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.MAP, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := oprot.WriteMapBegin(thrift.I64, thrift.STRUCT, len(p.Success)); err != nil { - return thrift.PrependError("error writing map begin: ", err) - } - for k, v := range p.Success { - if err := oprot.WriteI64(int64(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := v.Write(oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } - } - return err + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("success", thrift.MAP, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) + } + if err := oprot.WriteMapBegin(thrift.I64, thrift.STRUCT, len(p.Success)); err != nil { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range p.Success { + if err := oprot.WriteI64(int64(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err } func (p *ExtensionManagerExtensionsResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionManagerExtensionsResult(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionManagerExtensionsResult(%+v)", *p) } type ExtensionManagerOptionsArgs struct { } func NewExtensionManagerOptionsArgs() *ExtensionManagerOptionsArgs { - return &ExtensionManagerOptionsArgs{} + return &ExtensionManagerOptionsArgs{} } func (p *ExtensionManagerOptionsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil } func (p *ExtensionManagerOptionsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("options_args"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("options_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionManagerOptionsArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionManagerOptionsArgs(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionManagerOptionsArgs(%+v)", *p) } // Attributes: // - Success type ExtensionManagerOptionsResult struct { - Success InternalOptionList `thrift:"success,0" db:"success" json:"success,omitempty"` + Success InternalOptionList `thrift:"success,0" db:"success" json:"success,omitempty"` } func NewExtensionManagerOptionsResult() *ExtensionManagerOptionsResult { - return &ExtensionManagerOptionsResult{} + return &ExtensionManagerOptionsResult{} } var ExtensionManagerOptionsResult_Success_DEFAULT InternalOptionList func (p *ExtensionManagerOptionsResult) GetSuccess() InternalOptionList { - return p.Success + return p.Success } func (p *ExtensionManagerOptionsResult) IsSetSuccess() bool { - return p.Success != nil + return p.Success != nil } func (p *ExtensionManagerOptionsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 0: - if fieldTypeId == thrift.MAP { - if err := p.ReadField0(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ExtensionManagerOptionsResult) ReadField0(iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin() - if err != nil { - return thrift.PrependError("error reading map begin: ", err) - } - tMap := make(InternalOptionList, size) - p.Success = tMap - for i := 0; i < size; i ++ { -var _key36 string - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _key36 = v -} - _val37 := &InternalOptionInfo{} - if err := _val37.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _val37), err) - } - p.Success[_key36] = _val37 - } - if err := iprot.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) - } - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.ReadField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ExtensionManagerOptionsResult) ReadField0(iprot thrift.TProtocol) error { + _, _, size, err := iprot.ReadMapBegin() + if err != nil { + return thrift.PrependError("error reading map begin: ", err) + } + tMap := make(InternalOptionList, size) + p.Success = tMap + for i := 0; i < size; i++ { + var _key36 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _key36 = v + } + _val37 := &InternalOptionInfo{} + if err := _val37.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _val37), err) + } + p.Success[_key36] = _val37 + } + if err := iprot.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) + } + return nil } func (p *ExtensionManagerOptionsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("options_result"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField0(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("options_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField0(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionManagerOptionsResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.MAP, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRUCT, len(p.Success)); err != nil { - return thrift.PrependError("error writing map begin: ", err) - } - for k, v := range p.Success { - if err := oprot.WriteString(string(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := v.Write(oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } - } - return err + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("success", thrift.MAP, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) + } + if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRUCT, len(p.Success)); err != nil { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range p.Success { + if err := oprot.WriteString(string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err } func (p *ExtensionManagerOptionsResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionManagerOptionsResult(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionManagerOptionsResult(%+v)", *p) } // Attributes: // - Info // - Registry type ExtensionManagerRegisterExtensionArgs struct { - Info *InternalExtensionInfo `thrift:"info,1" db:"info" json:"info"` - Registry ExtensionRegistry `thrift:"registry,2" db:"registry" json:"registry"` + Info *InternalExtensionInfo `thrift:"info,1" db:"info" json:"info"` + Registry ExtensionRegistry `thrift:"registry,2" db:"registry" json:"registry"` } func NewExtensionManagerRegisterExtensionArgs() *ExtensionManagerRegisterExtensionArgs { - return &ExtensionManagerRegisterExtensionArgs{} + return &ExtensionManagerRegisterExtensionArgs{} } var ExtensionManagerRegisterExtensionArgs_Info_DEFAULT *InternalExtensionInfo + func (p *ExtensionManagerRegisterExtensionArgs) GetInfo() *InternalExtensionInfo { - if !p.IsSetInfo() { - return ExtensionManagerRegisterExtensionArgs_Info_DEFAULT - } -return p.Info + if !p.IsSetInfo() { + return ExtensionManagerRegisterExtensionArgs_Info_DEFAULT + } + return p.Info } func (p *ExtensionManagerRegisterExtensionArgs) GetRegistry() ExtensionRegistry { - return p.Registry + return p.Registry } func (p *ExtensionManagerRegisterExtensionArgs) IsSetInfo() bool { - return p.Info != nil + return p.Info != nil } func (p *ExtensionManagerRegisterExtensionArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 1: - if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.MAP { - if err := p.ReadField2(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ExtensionManagerRegisterExtensionArgs) ReadField1(iprot thrift.TProtocol) error { - p.Info = &InternalExtensionInfo{} - if err := p.Info.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Info), err) - } - return nil -} - -func (p *ExtensionManagerRegisterExtensionArgs) ReadField2(iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin() - if err != nil { - return thrift.PrependError("error reading map begin: ", err) - } - tMap := make(ExtensionRegistry, size) - p.Registry = tMap - for i := 0; i < size; i ++ { -var _key38 string - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _key38 = v -} - _, _, size, err := iprot.ReadMapBegin() - if err != nil { - return thrift.PrependError("error reading map begin: ", err) - } - tMap := make(ExtensionRouteTable, size) - _val39 := tMap - for i := 0; i < size; i ++ { -var _key40 string - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _key40 = v -} - _, size, err := iprot.ReadListBegin() - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make(ExtensionPluginResponse, 0, size) - _val41 := tSlice - for i := 0; i < size; i ++ { - _, _, size, err := iprot.ReadMapBegin() - if err != nil { - return thrift.PrependError("error reading map begin: ", err) - } - tMap := make(map[string]string, size) - _elem42 := tMap - for i := 0; i < size; i ++ { -var _key43 string - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _key43 = v -} -var _val44 string - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 0: ", err) -} else { - _val44 = v -} - _elem42[_key43] = _val44 - } - if err := iprot.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) - } - _val41 = append(_val41, _elem42) - } - if err := iprot.ReadListEnd(); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - _val39[_key40] = _val41 - } - if err := iprot.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) - } - p.Registry[_key38] = _val39 - } - if err := iprot.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) - } - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if err := p.ReadField1(iprot); err != nil { + return err + } + case 2: + if err := p.ReadField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ExtensionManagerRegisterExtensionArgs) ReadField1(iprot thrift.TProtocol) error { + p.Info = &InternalExtensionInfo{} + if err := p.Info.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Info), err) + } + return nil +} + +func (p *ExtensionManagerRegisterExtensionArgs) ReadField2(iprot thrift.TProtocol) error { + _, _, size, err := iprot.ReadMapBegin() + if err != nil { + return thrift.PrependError("error reading map begin: ", err) + } + tMap := make(ExtensionRegistry, size) + p.Registry = tMap + for i := 0; i < size; i++ { + var _key38 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _key38 = v + } + _, _, size, err := iprot.ReadMapBegin() + if err != nil { + return thrift.PrependError("error reading map begin: ", err) + } + tMap := make(ExtensionRouteTable, size) + _val39 := tMap + for i := 0; i < size; i++ { + var _key40 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _key40 = v + } + _, size, err := iprot.ReadListBegin() + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make(ExtensionPluginResponse, 0, size) + _val41 := tSlice + for i := 0; i < size; i++ { + _, _, size, err := iprot.ReadMapBegin() + if err != nil { + return thrift.PrependError("error reading map begin: ", err) + } + tMap := make(map[string]string, size) + _elem42 := tMap + for i := 0; i < size; i++ { + var _key43 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _key43 = v + } + var _val44 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _val44 = v + } + _elem42[_key43] = _val44 + } + if err := iprot.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) + } + _val41 = append(_val41, _elem42) + } + if err := iprot.ReadListEnd(); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + _val39[_key40] = _val41 + } + if err := iprot.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) + } + p.Registry[_key38] = _val39 + } + if err := iprot.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) + } + return nil } func (p *ExtensionManagerRegisterExtensionArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("registerExtension_args"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("registerExtension_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionManagerRegisterExtensionArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("info", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:info: ", p), err) } - if err := p.Info.Write(oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Info), err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:info: ", p), err) } - return err + if err := oprot.WriteFieldBegin("info", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:info: ", p), err) + } + if err := p.Info.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Info), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:info: ", p), err) + } + return err } func (p *ExtensionManagerRegisterExtensionArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("registry", thrift.MAP, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:registry: ", p), err) } - if err := oprot.WriteMapBegin(thrift.STRING, thrift.MAP, len(p.Registry)); err != nil { - return thrift.PrependError("error writing map begin: ", err) - } - for k, v := range p.Registry { - if err := oprot.WriteString(string(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := oprot.WriteMapBegin(thrift.STRING, thrift.LIST, len(v)); err != nil { - return thrift.PrependError("error writing map begin: ", err) - } - for k, v := range v { - if err := oprot.WriteString(string(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := oprot.WriteListBegin(thrift.MAP, len(v)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range v { - if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(v)); err != nil { - return thrift.PrependError("error writing map begin: ", err) - } - for k, v := range v { - if err := oprot.WriteString(string(k)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := oprot.WriteString(string(v)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - } - if err := oprot.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - } - if err := oprot.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) - } - } - if err := oprot.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:registry: ", p), err) } - return err + if err := oprot.WriteFieldBegin("registry", thrift.MAP, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:registry: ", p), err) + } + if err := oprot.WriteMapBegin(thrift.STRING, thrift.MAP, len(p.Registry)); err != nil { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range p.Registry { + if err := oprot.WriteString(string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + if err := oprot.WriteMapBegin(thrift.STRING, thrift.LIST, len(v)); err != nil { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range v { + if err := oprot.WriteString(string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + if err := oprot.WriteListBegin(thrift.MAP, len(v)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range v { + if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(v)); err != nil { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range v { + if err := oprot.WriteString(string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + if err := oprot.WriteString(string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) + } + } + if err := oprot.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + } + if err := oprot.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) + } + } + if err := oprot.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:registry: ", p), err) + } + return err } func (p *ExtensionManagerRegisterExtensionArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionManagerRegisterExtensionArgs(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionManagerRegisterExtensionArgs(%+v)", *p) } // Attributes: // - Success type ExtensionManagerRegisterExtensionResult struct { - Success *ExtensionStatus `thrift:"success,0" db:"success" json:"success,omitempty"` + Success *ExtensionStatus `thrift:"success,0" db:"success" json:"success,omitempty"` } func NewExtensionManagerRegisterExtensionResult() *ExtensionManagerRegisterExtensionResult { - return &ExtensionManagerRegisterExtensionResult{} + return &ExtensionManagerRegisterExtensionResult{} } var ExtensionManagerRegisterExtensionResult_Success_DEFAULT *ExtensionStatus + func (p *ExtensionManagerRegisterExtensionResult) GetSuccess() *ExtensionStatus { - if !p.IsSetSuccess() { - return ExtensionManagerRegisterExtensionResult_Success_DEFAULT - } -return p.Success + if !p.IsSetSuccess() { + return ExtensionManagerRegisterExtensionResult_Success_DEFAULT + } + return p.Success } func (p *ExtensionManagerRegisterExtensionResult) IsSetSuccess() bool { - return p.Success != nil + return p.Success != nil } func (p *ExtensionManagerRegisterExtensionResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 0: - if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ExtensionManagerRegisterExtensionResult) ReadField0(iprot thrift.TProtocol) error { - p.Success = &ExtensionStatus{} - if err := p.Success.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) - } - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.ReadField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ExtensionManagerRegisterExtensionResult) ReadField0(iprot thrift.TProtocol) error { + p.Success = &ExtensionStatus{} + if err := p.Success.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) + } + return nil } func (p *ExtensionManagerRegisterExtensionResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("registerExtension_result"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField0(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("registerExtension_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField0(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionManagerRegisterExtensionResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } - } - return err + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) + } + if err := p.Success.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err } func (p *ExtensionManagerRegisterExtensionResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionManagerRegisterExtensionResult(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionManagerRegisterExtensionResult(%+v)", *p) } // Attributes: // - UUID type ExtensionManagerDeregisterExtensionArgs struct { - UUID ExtensionRouteUUID `thrift:"uuid,1" db:"uuid" json:"uuid"` + UUID ExtensionRouteUUID `thrift:"uuid,1" db:"uuid" json:"uuid"` } func NewExtensionManagerDeregisterExtensionArgs() *ExtensionManagerDeregisterExtensionArgs { - return &ExtensionManagerDeregisterExtensionArgs{} + return &ExtensionManagerDeregisterExtensionArgs{} } - func (p *ExtensionManagerDeregisterExtensionArgs) GetUUID() ExtensionRouteUUID { - return p.UUID + return p.UUID } func (p *ExtensionManagerDeregisterExtensionArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 1: - if fieldTypeId == thrift.I64 { - if err := p.ReadField1(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ExtensionManagerDeregisterExtensionArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return thrift.PrependError("error reading field 1: ", err) -} else { - temp := ExtensionRouteUUID(v) - p.UUID = temp -} - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if err := p.ReadField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ExtensionManagerDeregisterExtensionArgs) ReadField1(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return thrift.PrependError("error reading field 1: ", err) + } else { + temp := ExtensionRouteUUID(v) + p.UUID = temp + } + return nil } func (p *ExtensionManagerDeregisterExtensionArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("deregisterExtension_args"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("deregisterExtension_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField1(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionManagerDeregisterExtensionArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("uuid", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:uuid: ", p), err) } - if err := oprot.WriteI64(int64(p.UUID)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.uuid (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:uuid: ", p), err) } - return err + if err := oprot.WriteFieldBegin("uuid", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:uuid: ", p), err) + } + if err := oprot.WriteI64(int64(p.UUID)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.uuid (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:uuid: ", p), err) + } + return err } func (p *ExtensionManagerDeregisterExtensionArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionManagerDeregisterExtensionArgs(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionManagerDeregisterExtensionArgs(%+v)", *p) } // Attributes: // - Success type ExtensionManagerDeregisterExtensionResult struct { - Success *ExtensionStatus `thrift:"success,0" db:"success" json:"success,omitempty"` + Success *ExtensionStatus `thrift:"success,0" db:"success" json:"success,omitempty"` } func NewExtensionManagerDeregisterExtensionResult() *ExtensionManagerDeregisterExtensionResult { - return &ExtensionManagerDeregisterExtensionResult{} + return &ExtensionManagerDeregisterExtensionResult{} } var ExtensionManagerDeregisterExtensionResult_Success_DEFAULT *ExtensionStatus + func (p *ExtensionManagerDeregisterExtensionResult) GetSuccess() *ExtensionStatus { - if !p.IsSetSuccess() { - return ExtensionManagerDeregisterExtensionResult_Success_DEFAULT - } -return p.Success + if !p.IsSetSuccess() { + return ExtensionManagerDeregisterExtensionResult_Success_DEFAULT + } + return p.Success } func (p *ExtensionManagerDeregisterExtensionResult) IsSetSuccess() bool { - return p.Success != nil + return p.Success != nil } func (p *ExtensionManagerDeregisterExtensionResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 0: - if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ExtensionManagerDeregisterExtensionResult) ReadField0(iprot thrift.TProtocol) error { - p.Success = &ExtensionStatus{} - if err := p.Success.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) - } - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.ReadField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ExtensionManagerDeregisterExtensionResult) ReadField0(iprot thrift.TProtocol) error { + p.Success = &ExtensionStatus{} + if err := p.Success.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) + } + return nil } func (p *ExtensionManagerDeregisterExtensionResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("deregisterExtension_result"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField0(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("deregisterExtension_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField0(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionManagerDeregisterExtensionResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } - } - return err + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) + } + if err := p.Success.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err } func (p *ExtensionManagerDeregisterExtensionResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionManagerDeregisterExtensionResult(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionManagerDeregisterExtensionResult(%+v)", *p) } // Attributes: // - Sql type ExtensionManagerQueryArgs struct { - Sql string `thrift:"sql,1" db:"sql" json:"sql"` + Sql string `thrift:"sql,1" db:"sql" json:"sql"` } func NewExtensionManagerQueryArgs() *ExtensionManagerQueryArgs { - return &ExtensionManagerQueryArgs{} + return &ExtensionManagerQueryArgs{} } - func (p *ExtensionManagerQueryArgs) GetSql() string { - return p.Sql + return p.Sql } func (p *ExtensionManagerQueryArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 1: - if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ExtensionManagerQueryArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 1: ", err) -} else { - p.Sql = v -} - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if err := p.ReadField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ExtensionManagerQueryArgs) ReadField1(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Sql = v + } + return nil } func (p *ExtensionManagerQueryArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("query_args"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("query_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField1(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionManagerQueryArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("sql", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sql: ", p), err) } - if err := oprot.WriteString(string(p.Sql)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.sql (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sql: ", p), err) } - return err + if err := oprot.WriteFieldBegin("sql", thrift.STRING, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sql: ", p), err) + } + if err := oprot.WriteString(string(p.Sql)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.sql (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sql: ", p), err) + } + return err } func (p *ExtensionManagerQueryArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionManagerQueryArgs(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionManagerQueryArgs(%+v)", *p) } // Attributes: // - Success type ExtensionManagerQueryResult struct { - Success *ExtensionResponse `thrift:"success,0" db:"success" json:"success,omitempty"` + Success *ExtensionResponse `thrift:"success,0" db:"success" json:"success,omitempty"` } func NewExtensionManagerQueryResult() *ExtensionManagerQueryResult { - return &ExtensionManagerQueryResult{} + return &ExtensionManagerQueryResult{} } var ExtensionManagerQueryResult_Success_DEFAULT *ExtensionResponse + func (p *ExtensionManagerQueryResult) GetSuccess() *ExtensionResponse { - if !p.IsSetSuccess() { - return ExtensionManagerQueryResult_Success_DEFAULT - } -return p.Success + if !p.IsSetSuccess() { + return ExtensionManagerQueryResult_Success_DEFAULT + } + return p.Success } func (p *ExtensionManagerQueryResult) IsSetSuccess() bool { - return p.Success != nil + return p.Success != nil } func (p *ExtensionManagerQueryResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 0: - if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ExtensionManagerQueryResult) ReadField0(iprot thrift.TProtocol) error { - p.Success = &ExtensionResponse{} - if err := p.Success.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) - } - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.ReadField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ExtensionManagerQueryResult) ReadField0(iprot thrift.TProtocol) error { + p.Success = &ExtensionResponse{} + if err := p.Success.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) + } + return nil } func (p *ExtensionManagerQueryResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("query_result"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField0(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("query_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField0(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionManagerQueryResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } - } - return err + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) + } + if err := p.Success.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err } func (p *ExtensionManagerQueryResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionManagerQueryResult(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionManagerQueryResult(%+v)", *p) } // Attributes: // - Sql type ExtensionManagerGetQueryColumnsArgs struct { - Sql string `thrift:"sql,1" db:"sql" json:"sql"` + Sql string `thrift:"sql,1" db:"sql" json:"sql"` } func NewExtensionManagerGetQueryColumnsArgs() *ExtensionManagerGetQueryColumnsArgs { - return &ExtensionManagerGetQueryColumnsArgs{} + return &ExtensionManagerGetQueryColumnsArgs{} } - func (p *ExtensionManagerGetQueryColumnsArgs) GetSql() string { - return p.Sql + return p.Sql } func (p *ExtensionManagerGetQueryColumnsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 1: - if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ExtensionManagerGetQueryColumnsArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return thrift.PrependError("error reading field 1: ", err) -} else { - p.Sql = v -} - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if err := p.ReadField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ExtensionManagerGetQueryColumnsArgs) ReadField1(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Sql = v + } + return nil } func (p *ExtensionManagerGetQueryColumnsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getQueryColumns_args"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("getQueryColumns_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField1(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionManagerGetQueryColumnsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("sql", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sql: ", p), err) } - if err := oprot.WriteString(string(p.Sql)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.sql (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sql: ", p), err) } - return err + if err := oprot.WriteFieldBegin("sql", thrift.STRING, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:sql: ", p), err) + } + if err := oprot.WriteString(string(p.Sql)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.sql (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:sql: ", p), err) + } + return err } func (p *ExtensionManagerGetQueryColumnsArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionManagerGetQueryColumnsArgs(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionManagerGetQueryColumnsArgs(%+v)", *p) } // Attributes: // - Success type ExtensionManagerGetQueryColumnsResult struct { - Success *ExtensionResponse `thrift:"success,0" db:"success" json:"success,omitempty"` + Success *ExtensionResponse `thrift:"success,0" db:"success" json:"success,omitempty"` } func NewExtensionManagerGetQueryColumnsResult() *ExtensionManagerGetQueryColumnsResult { - return &ExtensionManagerGetQueryColumnsResult{} + return &ExtensionManagerGetQueryColumnsResult{} } var ExtensionManagerGetQueryColumnsResult_Success_DEFAULT *ExtensionResponse + func (p *ExtensionManagerGetQueryColumnsResult) GetSuccess() *ExtensionResponse { - if !p.IsSetSuccess() { - return ExtensionManagerGetQueryColumnsResult_Success_DEFAULT - } -return p.Success + if !p.IsSetSuccess() { + return ExtensionManagerGetQueryColumnsResult_Success_DEFAULT + } + return p.Success } func (p *ExtensionManagerGetQueryColumnsResult) IsSetSuccess() bool { - return p.Success != nil + return p.Success != nil } func (p *ExtensionManagerGetQueryColumnsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { break; } - switch fieldId { - case 0: - if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ExtensionManagerGetQueryColumnsResult) ReadField0(iprot thrift.TProtocol) error { - p.Success = &ExtensionResponse{} - if err := p.Success.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) - } - return nil + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.ReadField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ExtensionManagerGetQueryColumnsResult) ReadField0(iprot thrift.TProtocol) error { + p.Success = &ExtensionResponse{} + if err := p.Success.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) + } + return nil } func (p *ExtensionManagerGetQueryColumnsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getQueryColumns_result"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } - if p != nil { - if err := p.writeField0(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { - return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { - return thrift.PrependError("write struct stop error: ", err) } - return nil + if err := oprot.WriteStructBegin("getQueryColumns_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if p != nil { + if err := p.writeField0(oprot); err != nil { + return err + } + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil } func (p *ExtensionManagerGetQueryColumnsResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } - } - return err + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) + } + if err := p.Success.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err } func (p *ExtensionManagerGetQueryColumnsResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ExtensionManagerGetQueryColumnsResult(%+v)", *p) + if p == nil { + return "" + } + return fmt.Sprintf("ExtensionManagerGetQueryColumnsResult(%+v)", *p) } - - diff --git a/mock/osquery.go b/mock/osquery.go deleted file mode 100644 index 3b0707e..0000000 --- a/mock/osquery.go +++ /dev/null @@ -1,113 +0,0 @@ -// Automatically generated by mockimpl. DO NOT EDIT! - -package mock - -import ( - "context" - - "github.com/kolide/osquery-go/gen/osquery" -) - -var _ osquery.ExtensionManager = (*ExtensionManager)(nil) - -type CloseFunc func() - -type PingFunc func(ctx context.Context) (*osquery.ExtensionStatus, error) - -type CallFunc func(ctx context.Context, registry string, item string, req osquery.ExtensionPluginRequest) (*osquery.ExtensionResponse, error) - -type ShutdownFunc func(ctx context.Context) error - -type ExtensionsFunc func(ctx context.Context) (osquery.InternalExtensionList, error) - -type RegisterExtensionFunc func(ctx context.Context, info *osquery.InternalExtensionInfo, registry osquery.ExtensionRegistry) (*osquery.ExtensionStatus, error) - -type DeregisterExtensionFunc func(ctx context.Context, uuid osquery.ExtensionRouteUUID) (*osquery.ExtensionStatus, error) - -type OptionsFunc func(ctx context.Context) (osquery.InternalOptionList, error) - -type QueryFunc func(ctx context.Context, sql string) (*osquery.ExtensionResponse, error) - -type GetQueryColumnsFunc func(ctx context.Context, sql string) (*osquery.ExtensionResponse, error) - -type ExtensionManager struct { - CloseFunc CloseFunc - CloseFuncInvoked bool - - PingFunc PingFunc - PingFuncInvoked bool - - CallFunc CallFunc - CallFuncInvoked bool - - ShutdownFunc ShutdownFunc - ShutdownFuncInvoked bool - - ExtensionsFunc ExtensionsFunc - ExtensionsFuncInvoked bool - - RegisterExtensionFunc RegisterExtensionFunc - RegisterExtensionFuncInvoked bool - - DeregisterExtensionFunc DeregisterExtensionFunc - DeregisterExtensionFuncInvoked bool - - OptionsFunc OptionsFunc - OptionsFuncInvoked bool - - QueryFunc QueryFunc - QueryFuncInvoked bool - - GetQueryColumnsFunc GetQueryColumnsFunc - GetQueryColumnsFuncInvoked bool -} - -func (m *ExtensionManager) Close() { - m.CloseFuncInvoked = true - m.CloseFunc() -} - -func (m *ExtensionManager) Ping(ctx context.Context) (*osquery.ExtensionStatus, error) { - m.PingFuncInvoked = true - return m.PingFunc(ctx) -} - -func (m *ExtensionManager) Call(ctx context.Context, registry string, item string, req osquery.ExtensionPluginRequest) (*osquery.ExtensionResponse, error) { - m.CallFuncInvoked = true - return m.CallFunc(ctx, registry, item, req) -} - -func (m *ExtensionManager) Shutdown(ctx context.Context) error { - m.ShutdownFuncInvoked = true - return m.ShutdownFunc(ctx) -} - -func (m *ExtensionManager) Extensions(ctx context.Context) (osquery.InternalExtensionList, error) { - m.ExtensionsFuncInvoked = true - return m.ExtensionsFunc(ctx) -} - -func (m *ExtensionManager) RegisterExtension(ctx context.Context, info *osquery.InternalExtensionInfo, registry osquery.ExtensionRegistry) (*osquery.ExtensionStatus, error) { - m.RegisterExtensionFuncInvoked = true - return m.RegisterExtensionFunc(ctx, info, registry) -} - -func (m *ExtensionManager) DeregisterExtension(ctx context.Context, uuid osquery.ExtensionRouteUUID) (*osquery.ExtensionStatus, error) { - m.DeregisterExtensionFuncInvoked = true - return m.DeregisterExtensionFunc(ctx, uuid) -} - -func (m *ExtensionManager) Options(ctx context.Context) (osquery.InternalOptionList, error) { - m.OptionsFuncInvoked = true - return m.OptionsFunc(ctx) -} - -func (m *ExtensionManager) Query(ctx context.Context, sql string) (*osquery.ExtensionResponse, error) { - m.QueryFuncInvoked = true - return m.QueryFunc(ctx, sql) -} - -func (m *ExtensionManager) GetQueryColumns(ctx context.Context, sql string) (*osquery.ExtensionResponse, error) { - m.GetQueryColumnsFuncInvoked = true - return m.GetQueryColumnsFunc(ctx, sql) -} diff --git a/server.go b/server.go index 7bb7900..a9c8773 100644 --- a/server.go +++ b/server.go @@ -204,20 +204,20 @@ func (s *ExtensionManagerServer) Run() error { }() err := <-errc - if err := s.Shutdown(context.Background()); err != nil { + if err := s.Shutdown(); err != nil { return err } return err } // Ping implements the basic health check. -func (s *ExtensionManagerServer) Ping(ctx context.Context) (*osquery.ExtensionStatus, error) { +func (s *ExtensionManagerServer) Ping() (*osquery.ExtensionStatus, error) { return &osquery.ExtensionStatus{Code: 0, Message: "OK"}, nil } // Call routes a call from the osquery process to the appropriate registered // plugin. -func (s *ExtensionManagerServer) Call(ctx context.Context, registry string, item string, request osquery.ExtensionPluginRequest) (*osquery.ExtensionResponse, error) { +func (s *ExtensionManagerServer) Call(registry string, item string, request osquery.ExtensionPluginRequest) (*osquery.ExtensionResponse, error) { subreg, ok := s.registry[registry] if !ok { return &osquery.ExtensionResponse{ @@ -243,7 +243,7 @@ func (s *ExtensionManagerServer) Call(ctx context.Context, registry string, item } // Shutdown stops the server and closes the listening socket. -func (s *ExtensionManagerServer) Shutdown(ctx context.Context) error { +func (s *ExtensionManagerServer) Shutdown() error { s.mutex.Lock() defer s.mutex.Unlock() if s.server != nil { diff --git a/server_test.go b/server_test.go index dbd5d11..db8b0bb 100644 --- a/server_test.go +++ b/server_test.go @@ -135,13 +135,13 @@ func testShutdownDeadlock(t *testing.T) { wait.Add(1) go func() { defer wait.Done() - client.Shutdown(context.Background()) + client.Shutdown() }() wait.Add(1) go func() { defer wait.Done() - err = server.Shutdown(context.Background()) + err = server.Shutdown() require.Nil(t, err) }() @@ -183,7 +183,7 @@ func TestShutdownBasic(t *testing.T) { }() server.waitStarted() - err = server.Shutdown(context.Background()) + err = server.Shutdown() require.NoError(t, err) // Either indicate successful shutdown, or fatal the test because it