Alanxtl commented on code in PR #3642:
URL: https://github.com/apache/dubbo-go/pull/3642#discussion_r3763151901


##########
client/options.go:
##########
@@ -777,74 +951,104 @@ func WithKeepAliveTimeout(keepAliveTimeout 
time.Duration) ClientOption {
 
 // ========== LoadBalance Strategy ==========
 
+// WithClientLoadBalanceConsistentHashing keeps calls with the same configured 
argument values
+// on the same provider while the provider set remains stable. Use it for 
cache or session
+// affinity shared by most references on this client.
 func WithClientLoadBalanceConsistentHashing() ClientOption {
        return func(opts *ClientOptions) {
                opts.overallReference.Loadbalance = 
constant.LoadBalanceKeyConsistentHashing
        }
 }
 
+// WithClientLoadBalanceLeastActive favors providers with the fewest in-flight 
requests and
+// uses effective weight to resolve ties. Use it when call durations vary and 
busy providers
+// should receive less new work.
 func WithClientLoadBalanceLeastActive() ClientOption {
        return func(opts *ClientOptions) {
                opts.overallReference.Loadbalance = 
constant.LoadBalanceKeyLeastActive
        }
 }
 
+// WithClientLoadBalanceRandom chooses providers randomly in proportion to 
effective weight.
+// It is a low-overhead general default for statistically even traffic.
 func WithClientLoadBalanceRandom() ClientOption {
        return func(opts *ClientOptions) {
                opts.overallReference.Loadbalance = 
constant.LoadBalanceKeyRandom
        }
 }
 
+// WithClientLoadBalanceRoundRobin distributes calls using smooth weighted 
round robin. Use it
+// when request costs are similar and predictable instance shares are useful.
 func WithClientLoadBalanceRoundRobin() ClientOption {
        return func(opts *ClientOptions) {
                opts.overallReference.Loadbalance = 
constant.LoadBalanceKeyRoundRobin
        }
 }
 
+// WithClientLoadBalanceP2C samples two providers and chooses the one with 
more recorded
+// remaining capacity. Use it with WithClientClusterAdaptiveService for 
adaptive providers.
 func WithClientLoadBalanceP2C() ClientOption {
        return func(opts *ClientOptions) {
                opts.overallReference.Loadbalance = constant.LoadBalanceKeyP2C
        }
 }
 
+// WithClientLoadBalance selects a registered load-balancing extension as the 
client default.
+// Use it for domain-specific placement rules; a reference-level option 
overrides it.
 func WithClientLoadBalance(lb string) ClientOption {
        return func(opts *ClientOptions) {
                opts.overallReference.Loadbalance = lb
        }
 }
 
+// WithClientRetries sets the default number of additional attempts after the 
initial call for
+// retry-capable strategies. Use retries only for idempotent operations 
because another provider
+// may repeat the work. A reference-level or call-level value takes precedence.
 func WithClientRetries(retries int) ClientOption {
        return func(opts *ClientOptions) {
                opts.overallReference.Retries = strconv.Itoa(retries)
        }
 }
 
-// is this needed?

Review Comment:
   这个以todo的形式保留



##########
client/options.go:
##########
@@ -384,13 +472,16 @@ func WithGenericType(genericType string) ReferenceOption {
        }
 }
 
+// WithSticky keeps selecting the previously chosen provider while it remains 
available,
+// reducing provider churn but potentially weakening load distribution. Use it 
for providers
+// that keep session-local state and prefer consistent hashing when a stable 
key is available.
 func WithSticky() ReferenceOption {
        return func(opts *ReferenceOptions) {
                opts.Reference.Sticky = true
        }
 }
 
-// TODO: remove this function after old triple removed

Review Comment:
   keep this todo



##########
server/options.go:
##########
@@ -350,20 +460,27 @@ func WithServerParam(k, v string) ServerOption {
        }
 }
 
-// todo(DMwangnima): change Filter Option like Cluster and LoadBalance
+// WithServerFilter selects the comma-separated provider filter chain applied 
to incoming calls
+// by default, in execution order. Use it for shared middleware such as 
authentication, metrics,
+// or custom validation. A service-level WithFilter replaces this chain.
 func WithServerFilter(filter string) ServerOption {
        return func(opts *ServerOptions) {
                opts.Provider.Filter = filter
        }
 }
 
-// todo(DMwangnima): think about a more ideal configuration style

Review Comment:
   keep todo



##########
client/options.go:
##########
@@ -777,74 +951,104 @@ func WithKeepAliveTimeout(keepAliveTimeout 
time.Duration) ClientOption {
 
 // ========== LoadBalance Strategy ==========
 
+// WithClientLoadBalanceConsistentHashing keeps calls with the same configured 
argument values
+// on the same provider while the provider set remains stable. Use it for 
cache or session
+// affinity shared by most references on this client.
 func WithClientLoadBalanceConsistentHashing() ClientOption {
        return func(opts *ClientOptions) {
                opts.overallReference.Loadbalance = 
constant.LoadBalanceKeyConsistentHashing
        }
 }
 
+// WithClientLoadBalanceLeastActive favors providers with the fewest in-flight 
requests and
+// uses effective weight to resolve ties. Use it when call durations vary and 
busy providers
+// should receive less new work.
 func WithClientLoadBalanceLeastActive() ClientOption {
        return func(opts *ClientOptions) {
                opts.overallReference.Loadbalance = 
constant.LoadBalanceKeyLeastActive
        }
 }
 
+// WithClientLoadBalanceRandom chooses providers randomly in proportion to 
effective weight.
+// It is a low-overhead general default for statistically even traffic.
 func WithClientLoadBalanceRandom() ClientOption {
        return func(opts *ClientOptions) {
                opts.overallReference.Loadbalance = 
constant.LoadBalanceKeyRandom
        }
 }
 
+// WithClientLoadBalanceRoundRobin distributes calls using smooth weighted 
round robin. Use it
+// when request costs are similar and predictable instance shares are useful.
 func WithClientLoadBalanceRoundRobin() ClientOption {
        return func(opts *ClientOptions) {
                opts.overallReference.Loadbalance = 
constant.LoadBalanceKeyRoundRobin
        }
 }
 
+// WithClientLoadBalanceP2C samples two providers and chooses the one with 
more recorded
+// remaining capacity. Use it with WithClientClusterAdaptiveService for 
adaptive providers.
 func WithClientLoadBalanceP2C() ClientOption {
        return func(opts *ClientOptions) {
                opts.overallReference.Loadbalance = constant.LoadBalanceKeyP2C
        }
 }
 
+// WithClientLoadBalance selects a registered load-balancing extension as the 
client default.
+// Use it for domain-specific placement rules; a reference-level option 
overrides it.
 func WithClientLoadBalance(lb string) ClientOption {
        return func(opts *ClientOptions) {
                opts.overallReference.Loadbalance = lb
        }
 }
 
+// WithClientRetries sets the default number of additional attempts after the 
initial call for
+// retry-capable strategies. Use retries only for idempotent operations 
because another provider
+// may repeat the work. A reference-level or call-level value takes precedence.
 func WithClientRetries(retries int) ClientOption {
        return func(opts *ClientOptions) {
                opts.overallReference.Retries = strconv.Itoa(retries)
        }
 }
 
-// is this needed?
+// WithClientGroup restricts references to providers in this group by default. 
A mismatched
+// group produces no providers. Use it when this client should consume one 
logical deployment,
+// such as a tenant or environment; WithGroup overrides it for one reference.
 func WithClientGroup(group string) ClientOption {
        return func(opts *ClientOptions) {
                opts.overallReference.Group = group
        }
 }
 
-// is this needed?

Review Comment:
   ditto



##########
server/options.go:
##########
@@ -901,13 +1173,16 @@ func WithParam(k, v string) ServiceOption {
        }
 }
 
+// WithOpenAPIGroup places this service's generated operations in the supplied 
OpenAPI group,
+// allowing related services to be presented together in generated API 
documentation. Use the
+// same group for APIs that should appear as one logical section to 
documentation consumers.
 func WithOpenAPIGroup(group string) ServiceOption {
        return func(opts *ServiceOptions) {
                opts.openapiGroup = group
        }
 }
 
-// TODO: remove when config package is removed

Review Comment:
   ditto



##########
server/options.go:
##########
@@ -350,20 +460,27 @@ func WithServerParam(k, v string) ServerOption {
        }
 }
 
-// todo(DMwangnima): change Filter Option like Cluster and LoadBalance

Review Comment:
   keep todo



##########
server/options.go:
##########
@@ -616,7 +766,9 @@ func WithInterface(interfaceName string) ServiceOption {
        }
 }
 
-// todo(DMwangnima): think about a more ideal configuration style

Review Comment:
   ditto



##########
server/options.go:
##########
@@ -375,13 +492,29 @@ func WithServerRegistry(opts ...registry.Option) 
ServerOption {
        }
 }
 
-// todo(DMwangnima): think about a more ideal configuration style

Review Comment:
   ditto



##########
server/options.go:
##########
@@ -625,14 +777,18 @@ func WithRegistryIDs(registryIDs []string) ServiceOption {
        }
 }
 
-// todo(DMwangnima): change Filter Option like Cluster and LoadBalance
+// WithFilter selects the comma-separated provider filter chain applied to 
incoming calls for
+// this service, in execution order. Use it to add service-specific middleware 
such as "auth"
+// or a custom validator. It replaces the server-level default filter chain.
 func WithFilter(filter string) ServiceOption {
        return func(cfg *ServiceOptions) {
                cfg.Service.Filter = filter
        }
 }
 
-// todo(DMwangnima): think about a more ideal configuration style

Review Comment:
   ditto



##########
server/options.go:
##########
@@ -625,14 +777,18 @@ func WithRegistryIDs(registryIDs []string) ServiceOption {
        }
 }
 
-// todo(DMwangnima): change Filter Option like Cluster and LoadBalance

Review Comment:
   ditto



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to