controller_impl.go ×4

Frontier kind: Code frontier

unlabeled · c_dcf334b4add8

35 tests · 3017 LOC · 136 files · introduces 0 tests · 45 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
5 ranges45 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
400 ranges3017 lines · 136 files · Browse complete extent
All tests (intent)
35 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 45 introduced LOC across 5 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/shard/controller_impl.go 32 introduced LOC · 4 ranges

Open complete file

75 hostInfoProvider membership.HostInfoProvider,
76 contextFactory ContextFactory,
77 > ) *ControllerImpl { controller_impl.go
78 > hostIdentity := hostInfoProvider.HostInfo().Identity()
79 > contextTaggedLogger := log.With(logger, tag.ComponentShardController, tag.Address(hostIdentity))
80 > taggedMetricsHandler := metricsHandler.WithTags(metrics.OperationTag(metrics.HistoryShardControllerScope))
81 >
82 > ownership := newOwnership(
83 > config,
84 > historyServiceResolver,
85 > hostInfoProvider,
86 > contextTaggedLogger,
87 > taggedMetricsHandler,
88 > )
89 >
90 > c := &ControllerImpl{
91 > config: config,
92 > contextFactory: contextFactory,
93 > contextTaggedLogger: contextTaggedLogger,
94 > historyShards: make(map[int32]historyi.ControllableContext),
95 > hostInfoProvider: hostInfoProvider,
96 > ownership: ownership,
97 > taggedMetricsHandler: taggedMetricsHandler,
98 > shardCountSubscriptions: map[*shardCountSubscription]struct{}{},
99 > initialShardsAcquired: future.NewFuture[struct{}](),
100 > }
101 > c.lingerState.shards = make(map[historyi.ControllableContext]struct{})
102 > return c
103 > }
104
105 func (c *ControllerImpl) Start() {
228 // if necessary. If a shard context is created, it will initialize in the background.
229 // This function won't block on rangeid lease acquisition.
230 > func (c *ControllerImpl) getOrCreateShardContext(shardID int32) (historyi.ControllableContext, error) { controller_impl.go
231 > if err := c.validateShardId(shardID); err != nil {
232 return nil, err
233 }
544 }
545
546 > func (c *ControllerImpl) validateShardId(shardID int32) error { controller_impl.go
547 > if shardID <= 0 {
548 return invalidShardIdLowerBound
549 }
550 > if shardID > c.config.NumberOfShards { controller_impl.go
551 return invalidShardIdUpperBound
552 }
go.temporal.io/server/service/history/shard/ownership.go 13 introduced LOC · 1 range

Open complete file

44 logger log.Logger,
45 metricsHandler metrics.Handler,
46 > ) *ownership { ownership.go
47 > hostIdentity := hostInfoProvider.HostInfo().Identity()
48 > logger = log.With(logger, tag.ComponentShardController, tag.Address(hostIdentity))
49 > return &ownership{
50 > acquireCh: make(chan struct{}, 1),
51 > config: config,
52 > historyServiceResolver: historyServiceResolver,
53 > hostInfoProvider: hostInfoProvider,
54 > logger: logger,
55 > membershipUpdateCh: make(chan *membership.ChangedEvent, 1),
56 > metricsHandler: metricsHandler,
57 > }
58 > }
59
60 func (o *ownership) start(controller *ControllerImpl) {