// pruneEntry does not report errors, only log them
169519
func (p *LinuxResourcePool) pruneEntry(id string) {
	pLog := p.logger.Session("prune", lager.Data{"id": id})

	pLog.Info("prune")

	err := p.releaseSystemResources(pLog, id)
	if err != nil {
		pLog.Error("release-system-resources-error", err)
	}

	pLog.Info("end of prune")
}
24591
func (l *localLocker) removeEntryIfExists(nlrip nameLockRequesterInfoPair) {
	// Check if entry is still in map (could have been removed altogether by 'concurrent' (R)Unlock of last entry)
	if lri, ok := l.lockMap[nlrip.name]; ok {
		if !l.removeEntry(nlrip.name, nlrip.lri.UID, &lri) {
			// Remove failed, in case it is a:
			if nlrip.lri.Writer {
				// Writer: this should never happen as the whole (mapped) entry should have been deleted
				reqInfo := (&logger.ReqInfo{}).AppendTags("name", nlrip.name)
				reqInfo.AppendTags("uid", nlrip.lri.UID)
				ctx := logger.SetReqInfo(context.Background(), reqInfo)
				logger.LogIf(ctx, errors.New("Lock maintenance failed to remove entry for write lock (should never happen)"))
			} // Reader: this can happen if multiple read locks were active and
			// the one we are looking for has been released concurrently (so it is fine).
		} // Removal went okay, all is fine.
	}
}
863111
func (a *Account) pruneAutoExpireResponseMaps() {
	defer func() {
		a.mu.Lock()
		a.pruning = false
		a.mu.Unlock()
	}()

	a.mu.RLock()
	ttl := int64(a.maxaettl/time.Second) + 1
	a.mu.RUnlock()

	for {
		sis := a.autoExpireResponseMaps()

		// Check ttl items.
		now := time.Now().Unix()
		for i, si := range sis {
			if now-si.ts >= ttl {
				a.removeServiceImport(si.from)
			} else {
				sis = sis[i:]
				break
			}
		}

		a.mu.RLock()
		numOver := int(a.nae - a.maxnae)
		a.mu.RUnlock()

		if numOver <= 0 {
			return
		} else if numOver >= len(sis) {
			numOver = len(sis) - 1
		}
		// These are in sorted order, remove at least numOver
		for _, si := range sis[:numOver] {
			a.removeServiceImport(si.from)
		}
	}
}
1192904
func findEntry(t *gitobj.Tree, name string) int {
	for i, entry := range t.Entries {
		if entry.Name == name {
			return i
		}
	}

	return -1
}
1079749
func (c *Client) ForEachLogEntry(ctx context.Context, k []byte, opts platform.FindOptions, fn func([]byte, time.Time) error) error {
	return c.db.View(func(tx *bolt.Tx) error {
		return c.forEachLogEntry(ctx, tx, k, opts, fn)
	})
}
1077475
func (s *StaticSource) NextLogEntry() (le *logpb.LogEntry, err error) {
	// Pop the next entry, mutating s.
	if len(*s) > 0 {
		le, *s = (*s)[0], (*s)[1:]
	}
	if len(*s) == 0 {
		err = io.EOF
	}
	return
}
868842
func (dd *DirData) RemoveEntry(ctx context.Context, name string) (
	unrefs []BlockInfo, err error) {
	topBlock, err := dd.GetTopBlock(ctx, BlockWrite)
	if err != nil {
		return nil, err
	}

	off := StringOffset(name)
	ptr, parentBlocks, block, _, _, _, err := dd.tree.getBlockAtOffset(
		ctx, topBlock, &off, BlockWrite)
	if err != nil {
		return nil, err
	}
	dblock := block.(*DirBlock)

	if _, exists := dblock.Children[name]; !exists {
		// Nothing to do.
		return nil, nil
	}
	delete(dblock.Children, name)

	// For now, just leave the block empty, at its current place in
	// the tree.  TODO: remove empty blocks all the way up the tree
	// and shift parent pointers around as needed.
	return dd.processModifiedBlock(ctx, ptr, parentBlocks, dblock)
}
207683
func (m *LocalDatasetShardsManagerInMemory) purgeExpiredEntries() {
	for {
		func() {
			m.Lock()
			cutoverLimit := time.Now().Add(-24 * time.Hour)
			var oldShardNames []string
			for name, tc := range m.name2Channel {
				if tc.lastWriteAt.Before(cutoverLimit) {
					oldShardNames = append(oldShardNames, name)
				}
			}
			for _, name := range oldShardNames {
				m.doDelete(name)
			}
			m.Unlock()
			time.Sleep(1 * time.Hour)
		}()
	}
}
22574
func (w *Worker) Prune(ctx context.Context, ch chan client.UsageInfo, info ...client.PruneInfo) error {
	return w.CacheManager.Prune(ctx, ch, info...)
}
1340045
func (p *pruner) Prune(deleter DeploymentDeleter) error {
	deployments, err := p.resolver.Resolve()
	if err != nil {
		return err
	}
	for _, deployment := range deployments {
		if err := deleter.DeleteDeployment(deployment); err != nil {
			return err
		}
	}
	return nil
}
170784
func (c *CacheStorage) DeleteEntry(cacheId string, request string) (*gcdmessage.ChromeResponse, error) {
	var v CacheStorageDeleteEntryParams
	v.CacheId = cacheId
	v.Request = request
	return c.DeleteEntryWithParams(&v)
}
319670
func fileLineEntry() *logrus.Entry {
	_, file, line, ok := runtime.Caller(2)
	if !ok {
		file = "<???>"
		line = 1
	} else {
		slash := strings.LastIndex(file, "/")
		if slash >= 0 {
			file = file[slash+1:]
		}
	}
	return logger.WithFields(logrus.Fields{
		"file": file,
		"line": line,
	})
}
955673
func (rl *ReqLog) AddEntry(rle *ReqLogEntry) {
	rl.lock.Lock()
	defer rl.lock.Unlock()

	rl.nextID++
	rl.Requests = append(rl.Requests, rle)

	if rle == nil || !rle.Active {
		rl.maybeCleanup()
	}
}
199957
func (cache *RelationCache) Prune(memberNames []string) {
	newMembers := SettingsMap{}
	for _, memberName := range memberNames {
		newMembers[memberName] = cache.members[memberName]
	}
	cache.members = newMembers
	cache.others = SettingsMap{}
}
782222
func (c Caches) Prune() (int, error) {
	counter := 0
	for k, cache := range c {
		err := afero.Walk(cache.Fs, "", func(name string, info os.FileInfo, err error) error {
			if info == nil {
				return nil
			}

			name = cleanID(name)

			if info.IsDir() {
				f, err := cache.Fs.Open(name)
				if err != nil {
					// This cache dir may not exist.
					return nil
				}
				defer f.Close()
				_, err = f.Readdirnames(1)
				if err == io.EOF {
					// Empty dir.
					return cache.Fs.Remove(name)
				}

				return nil
			}

			shouldRemove := cache.isExpired(info.ModTime())

			if !shouldRemove && len(cache.nlocker.seen) > 0 {
				// Remove it if it's not been touched/used in the last build.
				_, seen := cache.nlocker.seen[name]
				shouldRemove = !seen
			}

			if shouldRemove {
				err := cache.Fs.Remove(name)
				if err == nil {
					counter++
				}
				return err
			}

			return nil
		})

		if err != nil {
			return counter, errors.Wrapf(err, "failed to prune cache %q", k)
		}

	}

	return counter, nil
}
807010
func (c *Client) PruneContainers(opts PruneContainersOptions) (*PruneContainersResults, error) {
	path := "/containers/prune?" + queryString(opts)
	resp, err := c.do("POST", path, doOptions{context: opts.Context})
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	var results PruneContainersResults
	if err := json.NewDecoder(resp.Body).Decode(&results); err != nil {
		return nil, err
	}
	return &results, nil
}
964892
func (s *Store) Prune(ctx context.Context, prefix string) error {
	prefix = s.prefix + prefix
	out.Debug(ctx, "consul.Prune(%s)", prefix)
	return s.Delete(ctx, prefix)
}