Skip to content

Commit a2e7b21

Browse files
committed
fix some comments
Signed-off-by: cui fliter <[email protected]>
1 parent 7b454db commit a2e7b21

File tree

8 files changed

+27
-28
lines changed

8 files changed

+27
-28
lines changed

api/api.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func WithAttachment(key interface{}, value interface{}) EntryOption {
117117
}
118118
}
119119

120-
// WithAttachment set the resource entry with the given k-v pairs
120+
// WithAttachments set the resource entry with the given k-v pairs
121121
func WithAttachments(data map[interface{}]interface{}) EntryOption {
122122
return func(opts *EntryOptions) {
123123
if opts.attachments == nil {

core/base/slot_chain.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func NewSlotChain() *SlotChain {
110110
}
111111
}
112112

113-
// Get a EntryContext from EntryContext ctxPool, if ctxPool doesn't have enough EntryContext then new one.
113+
// Get an EntryContext from EntryContext ctxPool, if ctxPool doesn't have enough EntryContext then new one.
114114
func (sc *SlotChain) GetPooledContext() *EntryContext {
115115
ctx := sc.ctxPool.Get().(*EntryContext)
116116
ctx.startTime = util.CurrentTimeMillis()

core/circuitbreaker/circuit_breaker.go

+17-18
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,19 @@ import (
2626
"github.com/pkg/errors"
2727
)
2828

29+
// Circuit Breaker State Machine:
2930
//
30-
// Circuit Breaker State Machine:
31-
//
32-
// switch to open based on rule
33-
// +-----------------------------------------------------------------------+
34-
// | |
35-
// | v
36-
// +----------------+ +----------------+ Probe +----------------+
37-
// | | | |<----------------| |
38-
// | | Probe succeed | | | |
39-
// | Closed |<------------------| HalfOpen | | Open |
40-
// | | | | Probe failed | |
41-
// | | | +---------------->| |
42-
// +----------------+ +----------------+ +----------------+
31+
// switch to open based on rule
32+
// +-----------------------------------------------------------------------+
33+
// | |
34+
// | v
35+
// +----------------+ +----------------+ Probe +----------------+
36+
// | | | |<----------------| |
37+
// | | Probe succeed | | | |
38+
// | Closed |<------------------| HalfOpen | | Open |
39+
// | | | | Probe failed | |
40+
// | | | +---------------->| |
41+
// +----------------+ +----------------+ +----------------+
4342
type State int32
4443

4544
const (
@@ -126,7 +125,7 @@ type CircuitBreaker interface {
126125
OnRequestComplete(rtt uint64, err error)
127126
}
128127

129-
//================================= circuitBreakerBase ====================================
128+
// ================================= circuitBreakerBase ====================================
130129
// circuitBreakerBase encompasses the common fields of circuit breaker.
131130
type circuitBreakerBase struct {
132131
rule *Rule
@@ -230,7 +229,7 @@ func (b *circuitBreakerBase) fromHalfOpenToOpen(snapshot interface{}) bool {
230229
return false
231230
}
232231

233-
// fromHalfOpenToOpen updates circuit breaker state machine from half-open to closed
232+
// fromHalfOpenToClosed updates circuit breaker state machine from half-open to closed
234233
// Return true only if current goroutine successfully accomplished the transformation.
235234
func (b *circuitBreakerBase) fromHalfOpenToClosed() bool {
236235
if b.state.cas(HalfOpen, Closed) {
@@ -245,7 +244,7 @@ func (b *circuitBreakerBase) fromHalfOpenToClosed() bool {
245244
return false
246245
}
247246

248-
//================================= slowRtCircuitBreaker ====================================
247+
// ================================= slowRtCircuitBreaker ====================================
249248
type slowRtCircuitBreaker struct {
250249
circuitBreakerBase
251250
stat *slowRequestLeapArray
@@ -437,7 +436,7 @@ func (s *slowRequestLeapArray) allCounter() []*slowRequestCounter {
437436
return ret
438437
}
439438

440-
//================================= errorRatioCircuitBreaker ====================================
439+
// ================================= errorRatioCircuitBreaker ====================================
441440
type errorRatioCircuitBreaker struct {
442441
circuitBreakerBase
443442
minRequestAmount uint64
@@ -622,7 +621,7 @@ func (s *errorCounterLeapArray) allCounter() []*errorCounter {
622621
return ret
623622
}
624623

625-
//================================= errorCountCircuitBreaker ====================================
624+
// ================================= errorCountCircuitBreaker ====================================
626625
type errorCountCircuitBreaker struct {
627626
circuitBreakerBase
628627
minRequestAmount uint64

core/system_metric/sys_metric_stat.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func init() {
7878
metric_exporter.Register(processMemoryGauge)
7979
}
8080

81-
// getMemoryStat returns the current machine's memory statistic
81+
// getTotalMemorySize returns the current machine's memory statistic
8282
func getTotalMemorySize() (total uint64) {
8383
stat, err := mem.VirtualMemory()
8484
if err != nil {

ext/datasource/hotspot_rule_converter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (s *SpecificValue) String() string {
9393
return fmt.Sprintf("SpecificValue: [ValKind: %+v, ValStr: %s]", s.ValKind, s.ValStr)
9494
}
9595

96-
// arseSpecificItems parses the SpecificValue as real value.
96+
// parseSpecificItems parses the SpecificValue as real value.
9797
func parseSpecificItems(source []SpecificValue) map[interface{}]int64 {
9898
ret := make(map[interface{}]int64, len(source))
9999
if len(source) == 0 {

pkg/adapters/micro/options.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ type (
2626
}
2727
)
2828

29-
// WithUnaryClientResourceExtractor sets the resource extractor of unary client request.
29+
// WithClientResourceExtractor sets the resource extractor of unary client request.
3030
// The second string parameter is the full method name of current invocation.
3131
func WithClientResourceExtractor(fn func(context.Context, client.Request) string) Option {
3232
return func(opts *options) {
3333
opts.clientResourceExtract = fn
3434
}
3535
}
3636

37-
// WithUnaryServerResourceExtractor sets the resource extractor of unary server request.
37+
// WithServerResourceExtractor sets the resource extractor of unary server request.
3838
func WithServerResourceExtractor(fn func(context.Context, server.Request) string) Option {
3939
return func(opts *options) {
4040
opts.serverResourceExtract = fn
@@ -55,15 +55,15 @@ func WithStreamServerResourceExtractor(fn func(server.Stream) string) Option {
5555
}
5656
}
5757

58-
// WithUnaryClientBlockFallback sets the block fallback handler of unary client request.
58+
// WithClientBlockFallback sets the block fallback handler of unary client request.
5959
// The second string parameter is the full method name of current invocation.
6060
func WithClientBlockFallback(fn func(context.Context, client.Request, *base.BlockError) error) Option {
6161
return func(opts *options) {
6262
opts.clientBlockFallback = fn
6363
}
6464
}
6565

66-
// WithUnaryServerBlockFallback sets the block fallback handler of unary server request.
66+
// WithServerBlockFallback sets the block fallback handler of unary server request.
6767
func WithServerBlockFallback(fn func(context.Context, server.Request, *base.BlockError) error) Option {
6868
return func(opts *options) {
6969
opts.serverBlockFallback = fn

pkg/datasource/k8s/controllers/hotspotrules_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func (r *HotspotRulesReconciler) assembleHotspotRules(rs *datasourcev1.HotspotRu
151151
return ret
152152
}
153153

154-
// arseSpecificItems parses the SpecificValue as real value.
154+
// parseSpecificItems parses the SpecificValue as real value.
155155
func parseSpecificItems(source []datasourcev1.SpecificValue) map[interface{}]int64 {
156156
ret := make(map[interface{}]int64)
157157
if len(source) == 0 {

util/time.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ func CurrentClock() Clock {
255255
return currentClock.Load().(*clockWrapper).clock
256256
}
257257

258-
// SetClock sets the ticker creator used by util package.
258+
// SetTickerCreator sets the ticker creator used by util package.
259259
// In general, no need to set it. It is usually used for testing.
260260
func SetTickerCreator(tc TickerCreator) {
261261
currentTickerCreator.Store(&tickerCreatorWrapper{tc})

0 commit comments

Comments
 (0)