// clearDeadProjects calls deleteProject for all projects in the datastore
// that are not in liveProjects.
770803
func clearDeadProjects(c context.Context, liveProjects stringset.Set) error {
	var allProjects []*Project
	projectQ := datastore.NewQuery("Project").KeysOnly(true)
	if err := datastore.GetAll(c, projectQ, &allProjects); err != nil {
		return err
	}
	return parallel.WorkPool(10, func(work chan<- func() error) {
		for _, p := range allProjects {
			p := p
			if !liveProjects.Has(p.Name) {
				work <- func() error {
					logging.Warningf(c, "deleting project %s", p.Name)
					return deleteProject(c, p.Name)
				}
			}
		}
	})
}
411660
func (w *Window) ClearAll() {
	xproto.ClearArea(w.X.Conn(), false, w.Id, 0, 0, 0, 0)
}
450046
func (c *Client) DeleteAccountFromProject(p *DeleteAccountFromProjectParameter) (*Result, error) {
	obj, err := c.Request("deleteAccountFromProject", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*Result), err
}
789073
func (s *Store) Clear() {
	s.Lock()
	defer s.Unlock()

	if s.protected {
		return
	}

	for _, savedFuture := range s.store {
		savedFuture.Cancel()
	}

	s.store = make(map[packet.ID]*Future)
}
1353929
func (c *FakeAppProjects) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewDeleteAction(appprojectsResource, c.ns, name), &v1alpha1.AppProject{})

	return err
}
497750
func (h *Handle) Clear() {
	h.mu.Lock()
	h.StatsCache.Store(StatsCache{})
	h.mu.lastVersion = 0
	for len(h.ddlEventCh) > 0 {
		<-h.ddlEventCh
	}
	h.feedback = h.feedback[:0]
	h.mu.ctx.GetSessionVars().InitChunkSize = 1
	h.mu.ctx.GetSessionVars().MaxChunkSize = 32
	h.listHead = &SessionStatsCollector{mapper: make(tableDeltaMap), rateMap: make(errorRateDeltaMap)}
	h.globalMap = make(tableDeltaMap)
	h.mu.rateMap = make(errorRateDeltaMap)
	h.mu.Unlock()
}
662246
func (ac *AddressCache) Clear(addrs []string) (numCleared int) {
	if addrs == nil {
		return ac.ClearAll()
	}
	if len(addrs) == 0 {
		return
	}
	ac.mtx.Lock()
	defer ac.mtx.Unlock()
	for i := range addrs {
		delete(ac.a, addrs[i])
		numCleared++
	}
	return
}
582574
func (this *MemoryStore) Clear() error {
	this.l.Lock()
	defer this.l.Unlock()
	this.newMap()
	return nil
}
365919
func Projects(ids []uint64) []*Project {
	var projects []*Project
	for _, elem := range ids {
		project, _ := NewProject(elem)
		projects = append(projects, project)
	}
	return projects
}
1338338
func (s *ListProjectsOutput) SetProjects(v []*ProjectSummary) *ListProjectsOutput {
	s.Projects = v
	return s
}
733153
func (p *Project) Clean() error {
	p.Log.Debugf("cleaning %d functions", len(p.Functions))

	for _, fn := range p.Functions {
		if err := fn.Clean(); err != nil {
			return fmt.Errorf("function %s: %s", fn.Name, err)
		}
	}

	return nil
}
1084246
func (s *FeatureFlagSet) Clear() {
	s.Lock()
	defer s.Unlock()
	s.features = make(map[Feature]*featureSlot)
}
1034389
func (mm *MessageManager) clearRemovedHandlers() {
	for messageType, handlerList := range mm.handlersToRemove {
		for _, handlerID := range handlerList {
			mm.removeHandler(messageType, handlerID)
		}
	}
	mm.handlersToRemove = make(map[string][]MessageHandlerId)
}
401989
func (api *API) ApplicationsDelete(apps Applications) (err error) {
	ids := make([]string, len(apps))
	for i, app := range apps {
		ids[i] = app.ApplicationId
	}

	err = api.ApplicationsDeleteByIds(ids)
	if err == nil {
		for i := range apps {
			apps[i].ApplicationId = ""
		}
	}
	return
}
317249
func (proxier *Proxier) OnEndpointsDelete(endpoints *v1.Endpoints) {
	proxier.OnEndpointsUpdate(endpoints, nil)
}
734811
func (e *engineImpl) GetAllProjects(c context.Context) ([]string, error) {
	q := ds.NewQuery("Job").
		Eq("Enabled", true).
		Project("ProjectID").
		Distinct(true)
	entities := []Job{}
	if err := ds.GetAll(c, q, &entities); err != nil {
		return nil, transient.Tag.Apply(err)
	}
	// Filter out duplicates, sort.
	projects := stringset.New(len(entities))
	for _, ent := range entities {
		projects.Add(ent.ProjectID)
	}
	out := projects.ToSlice()
	sort.Strings(out)
	return out, nil
}
873130
func (c *Client) DeleteProject(projectName string) (result ResultModel, err error) {

	requestUrl := c.GetUrl("projects", "", projectName)
	requestPath := GetRequestPath("projects", "", projectName)

	responseResult, err := c.GetResponseJson("DELETE", requestUrl, requestPath, "")

	if err != nil {
		return result, err
	}

	err = json.Unmarshal([]byte(responseResult), &result)

	return result, err

}