Skip to content

Commit

Permalink
improve fn comments
Browse files Browse the repository at this point in the history
  • Loading branch information
flowerinthenight committed Nov 22, 2024
1 parent 5a12819 commit f512a1f
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions hedge.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ type withDuration int64

func (w withDuration) Apply(op *Op) { op.lockTimeout = int64(w) }

// WithDuration sets Op's internal spindle object's lease duration.
// Defaults to 30s when not set. Minimum value is 2s.
// WithDuration sets Op's internal spindle object's lease duration in milliseconds.
// Defaults to 30000ms (30s) when not set. Minimum value is 2000ms (2s).
func WithDuration(v int64) Option { return withDuration(v) }

type withGroupSyncInterval time.Duration
Expand Down Expand Up @@ -141,15 +141,6 @@ func WithBroadcastHandler(d interface{}, h FnMsgHandler) Option {
return withBroadcastHandler{d, h}
}

type withLogger struct{ l *log.Logger }

func (w withLogger) Apply(op *Op) { op.logger = w.l }

// WithLogger sets Op's logger object. Can be silenced by setting v to:
//
// log.New(ioutil.Discard, "", 0)
func WithLogger(v *log.Logger) Option { return withLogger{v} }

type withGrpcHostPort string

func (w withGrpcHostPort) Apply(op *Op) { op.grpcHostPort = string(w) }
Expand Down Expand Up @@ -201,6 +192,15 @@ func WithBroadcastStreamChannels(in chan *StreamMessage, out chan *StreamMessage
return withBroadcastStreamChannels{in, out}
}

type withLogger struct{ l *log.Logger }

func (w withLogger) Apply(op *Op) { op.logger = w.l }

// WithLogger sets Op's logger object. Can be silenced by setting v to:
//
// log.New(ioutil.Discard, "", 0)
func WithLogger(v *log.Logger) Option { return withLogger{v} }

// Op is our main instance for hedge operations.
type Op struct {
hostPort string // this instance's id; address:port
Expand Down

0 comments on commit f512a1f

Please sign in to comment.