MCPcopy Index your code
hub / github.com/cortexproject/cortex / NewBasicService

Function NewBasicService

pkg/util/services/basic_service.go:81–90  ·  view source on GitHub ↗

NewBasicService returns service built from three functions (using BasicService).

(start StartingFn, run RunningFn, stop StoppingFn)

Source from the content-addressed store, hash-verified

79
80// NewBasicService returns service built from three functions (using BasicService).
81func NewBasicService(start StartingFn, run RunningFn, stop StoppingFn) *BasicService {
82 return &BasicService{
83 startFn: start,
84 runningFn: run,
85 stoppingFn: stop,
86 state: New,
87 runningWaitersCh: make(chan struct{}),
88 terminatedWaitersCh: make(chan struct{}),
89 }
90}
91
92// WithName sets service name, if service is still in New state, and returns service to allow
93// usage like NewBasicService(...).WithName("service name").

Callers 15

NewLifecyclerFunction · 0.92
NewBasicLifecyclerFunction · 0.92
NewKVInitServiceFunction · 0.92
NewKVFunction · 0.92
NewSchedulerFunction · 0.92
newStoreGatewayFunction · 0.92
NewFunction · 0.92
NewHATrackerFunction · 0.92
NewFunction · 0.92
newReplicatedStatesFunction · 0.92

Calls

no outgoing calls

Tested by 8

newServFunction · 0.68
newServiceListenerFunction · 0.68
serviceThatFailsToStartFunction · 0.68
newExampleServFunction · 0.68