Skip to content

Commit

Permalink
tMEDIUM: API consolidation: remove support for multi-process
Browse files Browse the repository at this point in the history
  • Loading branch information
hdurand0710 committed Jun 3, 2024
1 parent 5c443c6 commit 3294605
Show file tree
Hide file tree
Showing 63 changed files with 618 additions and 1,605 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ if err != nil {

// runtime
// import runtime_options "github.com/haproxytech/client-native/v6/runtime/options"
nbproc := 8
ms := runtime_options.MasterSocket(masterSocket, nbproc)
ms := runtime_options.MasterSocket(masterSocket)
runtimeClient, err = runtime_api.New(ctx, ms)
if err != nil {
return nil, fmt.Errorf("error setting up runtime client: %s", err.Error())
Expand Down
5 changes: 0 additions & 5 deletions configuration/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,6 @@ func parseBindParams(bindOptions []params.BindOption) (b models.BindParams) { //
switch v.Name {
case "name":
b.Name = v.Value
case "process":
b.Process = v.Value
case "tcp-ut":
b.TCPUserTimeout = misc.ParseTimeout(v.Value)
case "crt":
Expand Down Expand Up @@ -413,9 +411,6 @@ func serializeBindParams(b models.BindParams, path string) (options []params.Bin
} else if path != "" {
options = append(options, &params.BindOptionValue{Name: "name", Value: path})
}
if b.Process != "" {
options = append(options, &params.BindOptionValue{Name: "process", Value: b.Process})
}
if b.SslCertificate != "" {
options = append(options, &params.BindOptionValue{Name: "crt", Value: b.SslCertificate})
}
Expand Down
29 changes: 0 additions & 29 deletions configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,6 @@ func (s *SectionParser) checkSpecialFields(fieldName string) (match bool, data i
return true, s.balance()
case "PersistRule":
return true, s.persistRule()
case "BindProcess":
return true, s.bindProcess()
case "Cookie":
return true, s.cookie()
case "HashType":
Expand Down Expand Up @@ -916,15 +914,6 @@ func (s *SectionParser) cookie() interface{} {
}
}

func (s *SectionParser) bindProcess() interface{} {
data, err := s.get("bind-process", false)
if err != nil {
return nil
}
d := data.(*types.BindProcess)
return d.Process
}

func (s *SectionParser) persistRule() interface{} {
data, err := s.get("persist", false)
if err != nil {
Expand Down Expand Up @@ -1575,8 +1564,6 @@ func (s *SectionObject) checkSpecialFields(fieldName string, field reflect.Value
return true, s.balance(field)
case "PersistRule":
return true, s.persistRule(field)
case "BindProcess":
return true, s.bindProcess(field)
case "Cookie":
return true, s.cookie(field)
case "HashType":
Expand Down Expand Up @@ -2272,22 +2259,6 @@ func (s *SectionObject) cookie(field reflect.Value) error {
return nil
}

func (s *SectionObject) bindProcess(field reflect.Value) error {
if s.Section == parser.Defaults || s.Section == parser.Frontends || s.Section == parser.Backends {
if valueIsNil(field) {
return s.set("bind-process", nil)
}
b := field.String()
d := &types.BindProcess{
Process: b,
}
if err := s.set("bind-process", d); err != nil {
return err
}
}
return nil
}

func (s *SectionObject) persistRule(field reflect.Value) error {
if s.Section == parser.Backends || s.Section == parser.Defaults {
if valueIsNil(field) {
Expand Down
21 changes: 0 additions & 21 deletions configuration/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,16 +352,6 @@ func ParseGlobalSection(p parser.Parser) (*models.Global, error) { //nolint:goco
mConn = maxConn.Value
}

var nbproc int64
data, err = p.Get(parser.Global, parser.GlobalSectionName, "nbproc")
if err == nil {
nbProcParser, ok := data.(*types.Int64C)
if !ok {
return nil, misc.CreateTypeAssertError("nbproc")
}
nbproc = nbProcParser.Value
}

var nbthread int64
data, err = p.Get(parser.Global, parser.GlobalSectionName, "nbthread")
if err == nil {
Expand Down Expand Up @@ -1163,7 +1153,6 @@ func ParseGlobalSection(p parser.Parser) (*models.Global, error) { //nolint:goco
DefaultPath: defaultPath,
MasterWorker: masterWorker,
Maxconn: mConn,
Nbproc: nbproc,
Nbthread: nbthread,
Pidfile: pidfile,
RuntimeAPIs: rAPIs,
Expand Down Expand Up @@ -1417,16 +1406,6 @@ func SerializeGlobalSection(p parser.Parser, data *models.Global) error { //noli
return err
}

pNbProc := &types.Int64C{
Value: data.Nbproc,
}
if data.Nbproc == 0 {
pNbProc = nil
}
if err := p.Set(parser.Global, parser.GlobalSectionName, "nbproc", pNbProc); err != nil {
return err
}

pNbthread := &types.Int64C{
Value: data.Nbthread,
}
Expand Down
21 changes: 0 additions & 21 deletions models/backend.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions models/backend_compare.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions models/backend_compare_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 0 additions & 21 deletions models/bind_params.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions models/bind_params_compare.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions models/bind_params_compare_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 0 additions & 21 deletions models/defaults.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions models/defaults_compare.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions models/defaults_compare_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3294605

Please sign in to comment.