MCPcopy Create free account
hub / github.com/cortexproject/cortex / WithName

Method WithName

pkg/util/services/basic_service.go:94–105  ·  view source on GitHub ↗

WithName sets service name, if service is still in New state, and returns service to allow usage like NewBasicService(...).WithName("service name").

(name string)

Source from the content-addressed store, hash-verified

92// WithName sets service name, if service is still in New state, and returns service to allow
93// usage like NewBasicService(...).WithName("service name").
94func (b *BasicService) WithName(name string) *BasicService {
95 // Hold lock to make sure state doesn't change while setting service name.
96 b.stateMu.Lock()
97 defer b.stateMu.Unlock()
98
99 if b.state != New {
100 return b
101 }
102
103 b.serviceName = name
104 return b
105}
106
107func (b *BasicService) ServiceName() string {
108 b.stateMu.RLock()

Callers 11

NewLifecyclerFunction · 0.80
NewPoolFunction · 0.80
NewKVInitServiceFunction · 0.80
NewRequestQueueFunction · 0.80
convertUserMethod · 0.80
convertBlockToParquetFunction · 0.80
TestServiceNameFunction · 0.80

Calls

no outgoing calls

Tested by 3

convertBlockToParquetFunction · 0.64
TestServiceNameFunction · 0.64