// Cleanup removes all data from the registry
322319
func (r *PrevRevisions) Cleanup() {
	r.mu.Lock()
	defer r.mu.Unlock()

	r.revisions = make(map[string]datasync.KeyVal)
}
622426
func (d *Daemon) Cleanup() error {
	if d.PidFileName == "" {
		return nil
	}
	return os.Remove(d.PidFileName)
}
1331673
func cleanup(ctx context.Context, client *containerd.Client) error {
	containers, err := client.Containers(ctx)
	if err != nil {
		return err
	}
	for _, c := range containers {
		task, err := c.Task(ctx, nil)
		if err == nil {
			task.Delete(ctx, containerd.WithProcessKill)
		}
		if err := c.Delete(ctx, containerd.WithSnapshotCleanup); err != nil {
			if derr := c.Delete(ctx); derr == nil {
				continue
			}
			return err
		}
	}
	return nil
}
207311
func (st *Store) Cleanup() {
	st.db.Delete(&gormSession{tableName: st.opts.TableName}, "expires_at <= ?", gorm.NowFunc())
}
417835
func (mr *MockInstallerMockRecorder) Cleanup(arg0 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Cleanup", reflect.TypeOf((*MockInstaller)(nil).Cleanup), arg0)
}
1226184
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
	fqdn, _ := dns01.GetRecord(domain, keyAuth)

	err := d.login()
	if err != nil {
		return err
	}

	viewID, err := d.lookupViewID(d.config.DNSView)
	if err != nil {
		return err
	}

	parentID, name, err := d.lookupParentZoneID(viewID, fqdn)
	if err != nil {
		return err
	}

	queryArgs := map[string]string{
		"parentId": strconv.FormatUint(uint64(parentID), 10),
		"name":     name,
		"type":     txtType,
	}

	resp, err := d.sendRequest(http.MethodGet, "getEntityByName", nil, queryArgs)
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	var txtRec entityResponse
	err = json.NewDecoder(resp.Body).Decode(&txtRec)
	if err != nil {
		return fmt.Errorf("bluecat: %v", err)
	}
	queryArgs = map[string]string{
		"objectId": strconv.FormatUint(uint64(txtRec.ID), 10),
	}

	resp, err = d.sendRequest(http.MethodDelete, http.MethodDelete, nil, queryArgs)
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	err = d.deploy(parentID)
	if err != nil {
		return err
	}

	return d.logout()
}
494272
func (d *DeviceMapperDriver) Cleanup() error {
	glog.V(2).Infof("Cleanup() START")
	defer glog.V(2).Infof("Cleanup() END")
	if d.DeviceSet == nil {
		return nil
	}
	glog.V(1).Infof("Cleaning up devicemapper driver at %s", d.root)
	for _, volname := range d.List() {
		_, err := d.getVolume(volname, false)
		if err != nil {
			glog.V(1).Infof("Unable to get volume %s; skipping", volname)
			continue
		}
		if err := d.Release(volname); err != nil {
			return err
		}
	}
	return d.DeviceSet.Shutdown()
}
420365
func (db *PGStore) Cleanup(interval time.Duration) (chan<- struct{}, <-chan struct{}) {
	if interval <= 0 {
		interval = defaultInterval
	}

	quit, done := make(chan struct{}), make(chan struct{})
	go db.cleanup(interval, quit, done)
	return quit, done
}
1100254
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
	_, value := dns01.GetRecord(domain, keyAuth)

	records, err := d.getTxtRecords(domain)
	if err != nil {
		return fmt.Errorf("zoneee: %v", err)
	}

	var id string
	for _, record := range records {
		if record.Destination == value {
			id = record.ID
		}
	}

	if id == "" {
		return fmt.Errorf("zoneee: txt record does not exist for %v", value)
	}

	if err = d.removeTxtRecord(domain, id); err != nil {
		return fmt.Errorf("zoneee: %v", err)
	}

	return nil
}
1055070
func (s *ProviderServer) CleanUp(domain, token, keyAuth string) error {
	if s.listener == nil {
		return nil
	}

	// Server was created, close it.
	if err := s.listener.Close(); err != nil && err != http.ErrServerClosed {
		return err
	}

	return nil
}
621467
func (c *DefaultCleaner) Cleanup(config *api.Config) {
	if config.PreserveWorkingDir {
		glog.V(2).Infof("Temporary directory %q will be saved, not deleted", config.WorkingDir)
	} else {
		glog.V(2).Infof("Removing temporary directory %s", config.WorkingDir)
		if err := c.fs.RemoveDirectory(config.WorkingDir); err != nil {
			glog.Warningf("Error removing temporary directory %q: %v", config.WorkingDir, err)
		}
	}
	if config.LayeredBuild {
		// config.LayeredBuild is true only when layered build was finished successfully.
		// Also in this case config.BuilderImage contains name of the new just built image,
		// not the original one that was specified by the user.
		glog.V(2).Infof("Removing temporary image %s", config.BuilderImage)
		if err := c.docker.RemoveImage(config.BuilderImage); err != nil {
			glog.Warningf("Error removing temporary image %s: %v", config.BuilderImage, err)
		}
	}
}
115266
func (o *Organizer) Cleanup(f func()) {
	o.cleanup = append(o.cleanup, f)
}
381628
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
	fqdn, _ := dns01.GetRecord(domain, keyAuth)

	authZone, err := dns01.FindZoneByFqdn(fqdn)
	if err != nil {
		return fmt.Errorf("cloudflare: %v", err)
	}

	zoneID, err := d.client.ZoneIDByName(dns01.UnFqdn(authZone))
	if err != nil {
		return fmt.Errorf("cloudflare: failed to find zone %s: %v", authZone, err)
	}

	dnsRecord := cloudflare.DNSRecord{
		Type: "TXT",
		Name: dns01.UnFqdn(fqdn),
	}

	records, err := d.client.DNSRecords(zoneID, dnsRecord)
	if err != nil {
		return fmt.Errorf("cloudflare: failed to find TXT records: %v", err)
	}

	for _, record := range records {
		err = d.client.DeleteDNSRecord(zoneID, record.ID)
		if err != nil {
			log.Printf("cloudflare: failed to delete TXT record: %v", err)
		}
	}

	return nil
}
197206
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
	fqdn, _ := dns01.GetRecord(domain, keyAuth)

	zone, err := d.getHostedZone(fqdn)
	if err != nil {
		return fmt.Errorf("googlecloud: %v", err)
	}

	records, err := d.findTxtRecords(zone, fqdn)
	if err != nil {
		return fmt.Errorf("googlecloud: %v", err)
	}

	if len(records) == 0 {
		return nil
	}

	_, err = d.client.Changes.Create(d.config.Project, zone, &dns.Change{Deletions: records}).Do()
	if err != nil {
		return fmt.Errorf("googlecloud: %v", err)
	}
	return nil
}
440270
func (s *sentDownloadState) cleanup(folder string) []protocol.FileDownloadProgressUpdate {
	fs, ok := s.folderStates[folder]
	if ok {
		updates := fs.destroy()
		delete(s.folderStates, folder)
		return updates
	}
	return nil
}
445782
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
	fqdn, _ := dns01.GetRecord(domain, keyAuth)

	info, err := d.client.GetDomainInformation(fqdn)
	if err != nil {
		return err
	}

	record, err := d.client.FindTxtRecord(info.ID, fqdn)
	if err != nil {
		return err
	}

	return d.client.RemoveTxtRecord(record.RecordID, info.ID)
}
732000
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
	zone, err := d.getZones(domain)
	if err != nil {
		return fmt.Errorf("stackpath: %v", err)
	}

	fqdn, _ := dns01.GetRecord(domain, keyAuth)
	parts := strings.Split(fqdn, ".")

	records, err := d.getZoneRecords(parts[0], zone)
	if err != nil {
		return err
	}

	for _, record := range records {
		err = d.deleteZoneRecord(zone, record)
		if err != nil {
			log.Printf("stackpath: failed to delete TXT record: %v", err)
		}
	}

	return nil
}