This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch feature-triple
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/feature-triple by this push:
     new a8c2132cc feat: update API for unification (#2453)
a8c2132cc is described below

commit a8c2132cc5dc724e86bf72ffad521737c2998a6d
Author: Scout Wang <[email protected]>
AuthorDate: Wed Oct 18 14:55:53 2023 +0800

    feat: update API for unification (#2453)
---
 client/options.go                                    | 10 +++++-----
 graceful_shutdown/options.go                         |  2 +-
 protocol/triple/internal/server/cmd_server/main.go   |  2 +-
 .../internal/server/cmd_server_with_registry/main.go |  4 ++--
 server/options.go                                    | 20 ++++++++++----------
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/client/options.go b/client/options.go
index 2b88f5790..c4ee1130f 100644
--- a/client/options.go
+++ b/client/options.go
@@ -131,7 +131,7 @@ func (cliOpts *ClientOptions) init(opts ...ClientOption) 
error {
        ref.RegistryIDs = commonCfg.TranslateIds(ref.RegistryIDs)
 
        // init graceful_shutdown
-       
graceful_shutdown.Init(graceful_shutdown.WithShutdown_Config(cliOpts.Shutdown))
+       
graceful_shutdown.Init(graceful_shutdown.SetShutdown_Config(cliOpts.Shutdown))
 
        return commonCfg.Verify(cliOpts)
 }
@@ -415,15 +415,15 @@ func newDefaultCallOptions() *CallOptions {
 }
 
 // WithCallRequestTimeout the maximum waiting time for one specific call, only 
works for 'tri' and 'dubbo' protocol
-func WithCallRequestTimeout(timeout string) CallOption {
+func WithCallRequestTimeout(timeout time.Duration) CallOption {
        return func(opts *CallOptions) {
-               opts.RequestTimeout = timeout
+               opts.RequestTimeout = timeout.String()
        }
 }
 
 // WithCallRetries the maximum retry times on request failure for one specific 
call, only works for 'tri' and 'dubbo' protocol
-func WithCallRetries(retries string) CallOption {
+func WithCallRetries(retries int) CallOption {
        return func(opts *CallOptions) {
-               opts.Retries = retries
+               opts.Retries = strconv.Itoa(retries)
        }
 }
diff --git a/graceful_shutdown/options.go b/graceful_shutdown/options.go
index f6d01aad3..aacb9e869 100644
--- a/graceful_shutdown/options.go
+++ b/graceful_shutdown/options.go
@@ -92,7 +92,7 @@ func WithRejectRequest() Option {
 
 // ---------- For framework ----------
 
-func WithShutdown_Config(cfg *global.ShutdownConfig) Option {
+func SetShutdown_Config(cfg *global.ShutdownConfig) Option {
        return func(opts *Options) {
                opts.Shutdown = cfg
        }
diff --git a/protocol/triple/internal/server/cmd_server/main.go 
b/protocol/triple/internal/server/cmd_server/main.go
index 37756445f..c32e85403 100644
--- a/protocol/triple/internal/server/cmd_server/main.go
+++ b/protocol/triple/internal/server/cmd_server/main.go
@@ -27,7 +27,7 @@ import (
 
 func main() {
        srv, err := server.NewServer(
-               server.WithServer_Protocol(
+               server.WithServerProtocol(
                        protocol.WithTriple(),
                        protocol.WithPort(20000),
                ),
diff --git a/protocol/triple/internal/server/cmd_server_with_registry/main.go 
b/protocol/triple/internal/server/cmd_server_with_registry/main.go
index 92651b076..67058124d 100644
--- a/protocol/triple/internal/server/cmd_server_with_registry/main.go
+++ b/protocol/triple/internal/server/cmd_server_with_registry/main.go
@@ -28,11 +28,11 @@ import (
 
 func main() {
        srv, err := server.NewServer(
-               server.WithServer_Registry(
+               server.WithServerRegistry(
                        registry.WithZookeeper(),
                        registry.WithAddress("127.0.0.1:2181"),
                ),
-               server.WithServer_Protocol(
+               server.WithServerProtocol(
                        protocol.WithTriple(),
                        protocol.WithPort(20000),
                ),
diff --git a/server/options.go b/server/options.go
index 83d78ebc2..2d4004626 100644
--- a/server/options.go
+++ b/server/options.go
@@ -105,7 +105,7 @@ func (srvOpts *ServerOptions) init(opts ...ServerOption) 
error {
        }
 
        // init graceful_shutdown
-       
graceful_shutdown.Init(graceful_shutdown.WithShutdown_Config(srvOpts.Shutdown))
+       
graceful_shutdown.Init(graceful_shutdown.SetShutdown_Config(srvOpts.Shutdown))
 
        return nil
 }
@@ -115,20 +115,20 @@ type ServerOption func(*ServerOptions)
 // ---------- For user ----------
 
 // todo(DMwangnima): change Filter Option like Cluster and LoadBalance
-func WithServer_Filter(filter string) ServerOption {
+func WithServerFilter(filter string) ServerOption {
        return func(opts *ServerOptions) {
                opts.Provider.Filter = filter
        }
 }
 
 // todo(DMwangnima): think about a more ideal configuration style
-func WithServer_RegistryIDs(registryIDs []string) ServerOption {
+func WithServerRegistryIDs(registryIDs []string) ServerOption {
        return func(opts *ServerOptions) {
                opts.Provider.RegistryIDs = registryIDs
        }
 }
 
-func WithServer_Registry(opts ...registry.Option) ServerOption {
+func WithServerRegistry(opts ...registry.Option) ServerOption {
        regOpts := registry.NewOptions(opts...)
 
        return func(srvOpts *ServerOptions) {
@@ -140,13 +140,13 @@ func WithServer_Registry(opts ...registry.Option) 
ServerOption {
 }
 
 // todo(DMwangnima): think about a more ideal configuration style
-func WithServer_ProtocolIDs(protocolIDs []string) ServerOption {
+func WithServerProtocolIDs(protocolIDs []string) ServerOption {
        return func(opts *ServerOptions) {
                opts.Provider.ProtocolIDs = protocolIDs
        }
 }
 
-func WithServer_Protocol(opts ...protocol.Option) ServerOption {
+func WithServerProtocol(opts ...protocol.Option) ServerOption {
        proOpts := protocol.NewOptions(opts...)
 
        return func(srvOpts *ServerOptions) {
@@ -157,7 +157,7 @@ func WithServer_Protocol(opts ...protocol.Option) 
ServerOption {
        }
 }
 
-func WithServer_TracingKey(tracingKey string) ServerOption {
+func WithServerTracingKey(tracingKey string) ServerOption {
        return func(opts *ServerOptions) {
                opts.Provider.TracingKey = tracingKey
        }
@@ -165,19 +165,19 @@ func WithServer_TracingKey(tracingKey string) 
ServerOption {
 
 // todo(DMwangnima): this configuration would be used by filter/hystrix
 // think about a more ideal way to configure
-func WithServer_FilterConf(conf interface{}) ServerOption {
+func WithServerFilterConf(conf interface{}) ServerOption {
        return func(opts *ServerOptions) {
                opts.Provider.FilterConf = conf
        }
 }
 
-func WithServer_AdaptiveService() ServerOption {
+func WithServerAdaptiveService() ServerOption {
        return func(opts *ServerOptions) {
                opts.Provider.AdaptiveService = true
        }
 }
 
-func WithServer_AdaptiveServiceVerbose() ServerOption {
+func WithServerAdaptiveServiceVerbose() ServerOption {
        return func(opts *ServerOptions) {
                opts.Provider.AdaptiveServiceVerbose = true
        }

Reply via email to