// body of generic pruner loop
504650
func (w *PrunerWorker) Work(getPrunerConfig func(*config.Config) (time.Duration, uint)) error {
	modelConfigWatcher, err := w.config.Facade.WatchForModelConfigChanges()
	if err != nil {
		return errors.Trace(err)
	}
	err = w.catacomb.Add(modelConfigWatcher)
	if err != nil {
		return errors.Trace(err)
	}

	var (
		maxAge             time.Duration
		maxCollectionMB    uint
		modelConfigChanges = modelConfigWatcher.Changes()
		// We will also get an initial event, but need to ensure that event is
		// received before doing any pruning.
	)

	var timer clock.Timer
	var timerCh <-chan time.Time
	for {
		select {
		case <-w.catacomb.Dying():
			return w.catacomb.ErrDying()

		case _, ok := <-modelConfigChanges:
			if !ok {
				return errors.New("model configuration watcher closed")
			}
			modelConfig, err := w.config.Facade.ModelConfig()
			if err != nil {
				return errors.Annotate(err, "cannot load model configuration")
			}

			newMaxAge, newMaxCollectionMB := getPrunerConfig(modelConfig)

			if newMaxAge != maxAge || newMaxCollectionMB != maxCollectionMB {
				logger.Infof("status history config: max age: %v, max collection size %dM for %s (%s)",
					newMaxAge, newMaxCollectionMB, modelConfig.Name(), modelConfig.UUID())
				maxAge = newMaxAge
				maxCollectionMB = newMaxCollectionMB
			}
			if timer == nil {
				timer = w.config.Clock.NewTimer(w.config.PruneInterval)
				timerCh = timer.Chan()
			}

		case <-timerCh:
			err := w.config.Facade.Prune(maxAge, int(maxCollectionMB))
			if err != nil {
				return errors.Trace(err)
			}
			timer.Reset(w.config.PruneInterval)
		}
	}
}
595997
func (c *client) pruneDenyCache() {
	r := 0
	for subject := range c.mperms.dcache {
		delete(c.mperms.dcache, subject)
		if r++; r > pruneSize {
			break
		}
	}
}
290517
func printBody(r io.ReadCloser) {
	body, err := ioutil.ReadAll(r)
	bodyString := string(body)

	if err != nil {
		LoggingClient.Error(err.Error())
	}

	LoggingClient.Info(bodyString)
}
148262
func (s *PutMappingService) BodyString(mapping string) *PutMappingService {
	s.bodyString = mapping
	return s
}
1301562
func (s *IndicesShrinkService) BodyString(body string) *IndicesShrinkService {
	s.bodyString = body
	return s
}
798884
func (api *API) Prune(p params.StatusHistoryPruneArgs) error {
	if !api.authorizer.AuthController() {
		return common.ErrPerm
	}
	return state.PruneStatusHistory(api.st, p.MaxHistoryTime, p.MaxHistoryMB)
}
1188017
func pruneTaskGetReachableObjects(gitscanner *lfs.GitScanner, outObjectSet *tools.StringSet, errorChan chan error, waitg *sync.WaitGroup, sem *semaphore.Weighted) {
	defer waitg.Done()

	err := gitscanner.ScanAll(func(p *lfs.WrappedPointer, err error) {
		sem.Acquire(context.Background(), 1)
		defer sem.Release(1)

		if err != nil {
			errorChan <- err
			return
		}
		outObjectSet.Add(p.Oid)
	})

	if err != nil {
		errorChan <- err
	}
}
110405
func (s *CountService) BodyString(body string) *CountService {
	s.bodyString = body
	return s
}
901635
func (r *Response) BodyString(body string) *Response {
	r.BodyBuffer = []byte(body)
	return r
}
22574
func (w *Worker) Prune(ctx context.Context, ch chan client.UsageInfo, info ...client.PruneInfo) error {
	return w.CacheManager.Prune(ctx, ch, info...)
}
380283
func (s *ResourceState) prune() {
	s.Lock()
	defer s.Unlock()

	n := len(s.Deposed)
	for i := 0; i < n; i++ {
		inst := s.Deposed[i]
		if inst == nil || inst.ID == "" {
			copy(s.Deposed[i:], s.Deposed[i+1:])
			s.Deposed[n-1] = nil
			n--
			i--
		}
	}
	s.Deposed = s.Deposed[:n]

	s.Dependencies = uniqueStrings(s.Dependencies)
}
941221
func (r *Request) Body(data interface{}) *Request {
	switch t := data.(type) {
	case string:
		bf := bytes.NewBufferString(t)
		r.req.Body = ioutil.NopCloser(bf)
		r.req.ContentLength = int64(len(t))
	case []byte:
		bf := bytes.NewBuffer(t)
		r.req.Body = ioutil.NopCloser(bf)
		r.req.ContentLength = int64(len(t))
	}
	return r
}
250312
func (s *UpdateByQueryService) Body(body string) *UpdateByQueryService {
	s.body = body
	return s
}
826604
func (b *CreateIndexService) BodyString(body string) *CreateIndexService {
	b.bodyString = body
	return b
}
1071574
func (f *Request) Body(b io.Reader) *Request {
	f.body = b
	return f
}
1155436
func (s *IndicesRolloverService) BodyString(body string) *IndicesRolloverService {
	s.bodyString = body
	return s
}
1125324
func (w *WebService) BodyParameter(name, description string) *Parameter {
	return BodyParameter(name, description)
}