Skip to content

Commit ebeaa35

Browse files
committed
refactor: rename StepOptions to stepOptions for consistency and update related function signatures
1 parent f01ca09 commit ebeaa35

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

dbos/workflow.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -938,8 +938,8 @@ type StepFunc func(ctx context.Context) (any, error)
938938
// Step represents a type-safe step function with a specific output type R.
939939
type Step[R any] func(ctx context.Context) (R, error)
940940

941-
// StepOptions holds the configuration for step execution using functional options pattern.
942-
type StepOptions struct {
941+
// stepOptions holds the configuration for step execution using functional options pattern.
942+
type stepOptions struct {
943943
maxRetries int // Maximum number of retry attempts (0 = no retries)
944944
backoffFactor float64 // Exponential backoff multiplier between retries (default: 2.0)
945945
baseInterval time.Duration // Initial delay between retries (default: 100ms)
@@ -949,7 +949,7 @@ type StepOptions struct {
949949
}
950950

951951
// setDefaults applies default values to stepOptions
952-
func (opts *StepOptions) setDefaults() {
952+
func (opts *stepOptions) setDefaults() {
953953
if opts.backoffFactor == 0 {
954954
opts.backoffFactor = _DEFAULT_STEP_BACKOFF_FACTOR
955955
}
@@ -962,12 +962,12 @@ func (opts *StepOptions) setDefaults() {
962962
}
963963

964964
// StepOption is a functional option for configuring step execution parameters.
965-
type StepOption func(*StepOptions)
965+
type StepOption func(*stepOptions)
966966

967967
// WithStepName sets a custom name for the step. If the step name has already been set
968968
// by a previous call to WithStepName, this option will be ignored
969969
func WithStepName(name string) StepOption {
970-
return func(opts *StepOptions) {
970+
return func(opts *stepOptions) {
971971
if opts.stepName == "" {
972972
opts.stepName = name
973973
}
@@ -977,7 +977,7 @@ func WithStepName(name string) StepOption {
977977
// WithStepMaxRetries sets the maximum number of retry attempts for the step.
978978
// A value of 0 means no retries (default behavior).
979979
func WithStepMaxRetries(maxRetries int) StepOption {
980-
return func(opts *StepOptions) {
980+
return func(opts *stepOptions) {
981981
opts.maxRetries = maxRetries
982982
}
983983
}
@@ -986,30 +986,30 @@ func WithStepMaxRetries(maxRetries int) StepOption {
986986
// The delay between retries is calculated as: BaseInterval * (BackoffFactor^(retry-1))
987987
// Default value is 2.0.
988988
func WithBackoffFactor(factor float64) StepOption {
989-
return func(opts *StepOptions) {
989+
return func(opts *stepOptions) {
990990
opts.backoffFactor = factor
991991
}
992992
}
993993

994994
// WithBaseInterval sets the initial delay between retries.
995995
// Default value is 100ms.
996996
func WithBaseInterval(interval time.Duration) StepOption {
997-
return func(opts *StepOptions) {
997+
return func(opts *stepOptions) {
998998
opts.baseInterval = interval
999999
}
10001000
}
10011001

10021002
// WithMaxInterval sets the maximum delay between retries.
10031003
// Default value is 5s.
10041004
func WithMaxInterval(interval time.Duration) StepOption {
1005-
return func(opts *StepOptions) {
1005+
return func(opts *stepOptions) {
10061006
opts.maxInterval = interval
10071007
}
10081008
}
10091009

10101010

10111011
func WithNextStepID(stepID int) StepOption {
1012-
return func(opts *StepOptions) {
1012+
return func(opts *stepOptions) {
10131013
opts.preGeneratedStepID = &stepID
10141014
}
10151015
}
@@ -1100,7 +1100,7 @@ func RunAsStep[R any](ctx DBOSContext, fn Step[R], opts ...StepOption) (R, error
11001100

11011101
func (c *dbosContext) RunAsStep(_ DBOSContext, fn StepFunc, opts ...StepOption) (any, error) {
11021102
// Process functional options
1103-
stepOpts := &StepOptions{}
1103+
stepOpts := &stepOptions{}
11041104
for _, opt := range opts {
11051105
opt(stepOpts)
11061106
}

0 commit comments

Comments
 (0)