303
}
304
305
>
func (s *SliceImpl) ShrinkScope() int {
slice.go
306
>
s.stateSanityCheck()
307
>
308
>
tasksCompleted := s.shrinkRange()
309
>
s.shrinkPredicate()
310
>
311
>
// shrinkRange shrinks the executableTracker, which may remove tracked pending executables. Set the
312
>
// pending task count to reflect that.
313
>
s.monitor.SetSlicePendingTaskCount(s, len(s.pendingExecutables))
314
>
315
>
return tasksCompleted
316
>
}
317
318
>
func (s *SliceImpl) shrinkRange() int {
slice.go
319
>
minPendingTaskKey, tasksCompleted := s.shrink()
320
>
321
>
minIteratorKey := tasks.MaximumKey
322
>
if len(s.iterators) != 0 {
323
minIteratorKey = s.iterators[0].Range().InclusiveMin
324
}
325
326
// pick min key for tasks in memory and in persistence
327
>
newRangeMin := tasks.MinKey(minPendingTaskKey, minIteratorKey)
slice.go
328
>
329
>
// no pending task in memory and in persistence
330
>
if newRangeMin == tasks.MaximumKey {
331
newRangeMin = s.scope.Range.ExclusiveMax
332
}
333
334
>
s.scope.Range.InclusiveMin = newRangeMin
slice.go
335
>
336
>
return tasksCompleted
337
}
338
339
>
func (s *SliceImpl) shrinkPredicate() {
slice.go
340
>
if len(s.iterators) != 0 {
341
// predicate can't be updated if there're still
342
// tasks in persistence, as we don't know if those