queue_base.go ×6

Frontier kind: Code frontier

unlabeled · c_e70ab8d031d2

29 tests · 3473 LOC · 161 files · introduces 0 tests · 71 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges71 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
485 ranges3473 lines · 161 files · Browse complete extent
All tests (intent)
29 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.

3 files ranked by introduced lines: 71 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/queues/queue_base.go 61 introduced LOC · 6 ranges

Open complete file

116 logger log.Logger,
117 metricsHandler metrics.Handler,
118 > ) *queueBase { queue_base.go
119 > var readerScopes map[int64][]Scope
120 > var exclusiveReaderHighWatermark tasks.Key
121 > if persistenceState, ok := shard.GetQueueState(category); ok {
122 queueState := FromPersistenceQueueState(persistenceState)
123
124 readerScopes = queueState.readerScopes
125 exclusiveReaderHighWatermark = queueState.exclusiveReaderHighWatermark
126 > } else { queue_base.go
127 ackLevel := tasks.NewKey(tasks.DefaultFireTime, 0)
128 if category.Type() == tasks.CategoryTypeImmediate {
134 }
135
136 > monitor := newMonitor(category.Type(), shard.GetTimeSource(), &options.MonitorOptions) queue_base.go
137 > readerRateLimiter := newShardReaderRateLimiter(
138 > options.MaxPollRPS,
139 > hostReaderRateLimiter,
140 > int64(options.MaxReaderCount()),
141 > )
142 > readerInitializer := func(readerID int64, slices []Slice) Reader {
143 readerOptions := options.ReaderOptions // make a copy
144 if readerID != DefaultReaderId {
176 }
177
178 > exclusiveDeletionHighWatermark := exclusiveReaderHighWatermark queue_base.go
179 > readerGroup := NewReaderGroup(readerInitializer)
180 > for readerID, scopes := range readerScopes {
181 if len(scopes) == 0 {
182 continue
192 }
193
194 > mitigator := newMitigator(readerGroup, monitor, logger, metricsHandler, options.MaxReaderCount, grouper) queue_base.go
195 >
196 > return &queueBase{
197 > shard: shard,
198 >
199 > status: common.DaemonStatusInitialized,
200 > shutdownCh: make(chan struct{}),
201 >
202 > category: category,
203 > options: options,
204 > scheduler: scheduler,
205 > rescheduler: rescheduler,
206 > timeSource: shard.GetTimeSource(),
207 > monitor: monitor,
208 > mitigator: mitigator,
209 > grouper: grouper,
210 > logger: logger,
211 > metricsHandler: metricsHandler,
212 >
213 > paginationFnProvider: paginationFnProvider,
214 > executableFactory: executableFactory,
215 >
216 > lastRangeID: -1, // start from an invalid rangeID
217 > exclusiveDeletionHighWatermark: exclusiveDeletionHighWatermark,
218 > nonReadableScope: NewScope(
219 > NewRange(exclusiveReaderHighWatermark, tasks.MaximumKey),
220 > predicates.Universal[tasks.Task](),
221 > ),
222 > readerRateLimiter: readerRateLimiter,
223 > readerGroup: readerGroup,
224 >
225 > // pollTimer and checkpointTimer are initialized on Start()
226 > checkpointRetrier: backoff.NewRetrier(
227 > createCheckpointRetryPolicy(),
228 > clock.NewRealTimeSource(),
229 > ),
230 >
231 > alertCh: monitor.AlertCh(),
232 > }
233 }
234
446 }
447
448 > func createCheckpointRetryPolicy() backoff.RetryPolicy { queue_base.go
449 > policy := backoff.NewExponentialRetryPolicy(100 * time.Millisecond).
450 > WithMaximumInterval(5 * time.Second).
451 > WithExpirationInterval(backoff.NoInterval)
452 >
453 > return policy
454 > }
455
456 func newQueueIOContext() (context.Context, context.CancelFunc) {
go.temporal.io/server/service/history/shard/context_impl.go 6 introduced LOC · 1 range

Open complete file

358 func (s *ContextImpl) GetQueueState(
359 category tasks.Category,
360 > ) (*persistencespb.QueueState, bool) { context_impl.go
361 > s.rLock()
362 > defer s.rUnlock()
363 >
364 > queueState, ok := s.shardInfo.QueueStates[int32(category.ID())]
365 > if !ok {
366 return nil, false
367 }
go.temporal.io/server/service/history/queues/reader_quotas.go 4 introduced LOC · 1 range

Open complete file

41 hostReaderRateLimiter quotas.RequestRateLimiter,
42 maxReaders int64,
43 > ) quotas.RequestRateLimiter { reader_quotas.go
44 > return quotas.NewMultiRequestRateLimiter(
45 > NewReaderPriorityRateLimiter(
46 > func() float64 { return float64(shardMaxPollRPS()) },
47 maxReaders,
48 ),