MCPcopy
hub / github.com/grafana/dskit / ServiceContext

Method ServiceContext

services/basic_service.go:277–284  ·  view source on GitHub ↗

ServiceContext returns context that this service uses internally for controlling its lifecycle. It is the same context that is passed to Starting and Running functions, and is based on context passed to the service via StartAsync. Before service enters Starting state, there is no context. This cont

()

Source from the content-addressed store, hash-verified

275//
276// This is not part of Service interface, and clients of the Service should not use it.
277func (b *BasicService) ServiceContext() context.Context {
278 s := b.State()
279 if s == New {
280 return nil
281 }
282 // no need for locking, as we have checked the state.
283 return b.serviceContext
284}
285
286// AwaitRunning is part of Service interface.
287func (b *BasicService) AwaitRunning(ctx context.Context) error {

Callers 4

runOnLifecyclerLoopMethod · 0.80
sendToLifecyclerLoopMethod · 0.80
runMethod · 0.80
SendMethod · 0.80

Calls 1

StateMethod · 0.95

Tested by 1

SendMethod · 0.64