// delete session file
503330
func (s *FilesystemStore) erase(session *Session) error {
	filename := filepath.Join(s.path, "session_"+session.ID)

	fileMutex.RLock()
	defer fileMutex.RUnlock()

	err := os.Remove(filename)
	return err
}
895417
func (h *Handler) deleteSession(w http.ResponseWriter, r *http.Request, _ httprouter.Params, ctx *SessionContext) (interface{}, error) {
	err := h.logout(w, ctx)
	if err != nil {
		return nil, trace.Wrap(err)
	}

	return ok(), nil
}
130759
func (s Session) Del(key string) {
	sessionJsonMap := s.getSessionJsonMap()
	delete(sessionJsonMap, key)
	delete(s, key)
}
507657
func Delete() error {
	filename := locateSettingsFile()

	if _, err := os.Stat(filename); err != nil {
		if os.IsNotExist(err) {
			return nil
		}

		return err
	}

	if err := os.Remove(filename); err != nil {
		return err
	}

	return nil
}
422755
func (d *DiskStorer) Del(key string) error {
	if !validKey(key) {
		return errNoSession{}
	}

	filePath := path.Join(d.folderPath, key)

	d.mut.Lock()
	defer d.mut.Unlock()

	_, err := os.Stat(filePath)
	if os.IsNotExist(err) {
		return nil
	} else if err != nil {
		return errors.Wrapf(err, "unable to stat session file: %s", filePath)
	}

	return os.Remove(filePath)
}
1202006
func (s *Session) Destroy(ctx context.Context) error {
	sd := s.getSessionDataFromContext(ctx)

	sd.mu.Lock()
	defer sd.mu.Unlock()

	err := s.Store.Delete(sd.token)
	if err != nil {
		return err
	}

	sd.status = Destroyed

	// Reset everything else to defaults.
	sd.token = ""
	sd.Deadline = time.Now().Add(s.Lifetime).UTC()
	for key := range sd.Values {
		delete(sd.Values, key)
	}

	return nil
}
338286
func (s *blockStore) deleteFile(fileNum uint32) error {
	filePath := blockFilePath(s.basePath, fileNum)
	if err := os.Remove(filePath); err != nil {
		return makeDbErr(database.ErrDriverSpecific, err.Error(), err)
	}

	return nil
}
774644
func clearSession(sid string, isForce bool) {
	var toRemove []string
	if sid == "all" {
		toRemove = getSessionIDs()
	} else {
		toRemove = append(toRemove, sid)
	}
	for _, sid := range toRemove {
		session, err := loadSessionV8(sid)
		if !isForce {
			fatalIf(err.Trace(sid), "Unable to load session `"+sid+"`. Use --force flag to remove obsolete session files.")

			fatalIf(session.Delete().Trace(sid), "Unable to remove session `"+sid+"`. Use --force flag to remove obsolete session files.")

			printMsg(clearSessionMessage{Status: "success", SessionID: sid})
			continue
		}
		// Forced removal of a session.
		forceClear(sid, session)
	}
	return
}
86245
func (c *Client) DeleteSession(namespace, id string) error {
	if namespace == "" {
		return trace.BadParameter(MissingNamespaceError)
	}
	_, err := c.Delete(c.Endpoint("namespaces", namespace, "sessions", id))
	return trace.Wrap(err)
}
350934
func (s *Session) Destroy() {
	s.MaxAge = -1
	s.Expires = time.Now()
	s.data = make(map[interface{}]interface{})
	s.isDirty = true
}
1169231
func (s *SessionStatsCollector) Delete() {
	s.Lock()
	defer s.Unlock()
	s.deleted = true
}
180800
func (c *Connection) Delete(path string) error {
	c.RLock()
	defer c.RUnlock()
	if err := c.isClosed(); err != nil {
		return err
	}
	return c.delete(path)
}
160115
func (c *DbClient) DeleteFile(path string) {
	c.Lock()
	defer c.Unlock()

	delete(c.db, path)
}
316622
func RemoveUser(file, user string) error {
	passwords, err := ParseHtpasswdFile(file)
	if err != nil {
		return err
	}
	_, ok := passwords[user]
	if !ok {
		return ErrNotExist
	}
	delete(passwords, user)
	return passwords.WriteToFile(file)
}
782095
func (m *Module) DestroySession(rw http.ResponseWriter, req *http.Request) {
	session, err := m.getSessionFromRequest(req)
	if session == nil {
		return
	} else if err != nil {
		// TODO: log error
		return
	}

	m.RevocationStore.Revoke(session.SessionID, m.revocationTrackDuration)
	http.SetCookie(rw, &http.Cookie{
		Name:     m.CookieName,
		MaxAge:   -1,
		HttpOnly: true,
		Expires:  time.Now().Add(-time.Hour),
		Value:    "deleted",
		Path:     "/",
		Domain:   m.CookieDomain,
		Secure:   m.SecureCookie,
	})
}
294434
func (c *Client) Delete(path string) error {
	pconn, err := c.getIdleConn()
	if err != nil {
		return err
	}

	defer c.returnConn(pconn)

	return pconn.sendCommandExpected(replyFileActionOkay, "DELE %s", path)
}
1015036
func (s *session) destroy(e error) {
	s.closeOnce.Do(func() {
		if nerr, ok := e.(net.Error); ok && nerr.Timeout() {
			s.logger.Errorf("Destroying session %s: %s", s.destConnID, e)
		} else {
			s.logger.Errorf("Destroying session %s with error: %s", s.destConnID, e)
		}
		s.sessionRunner.Remove(s.srcConnID)
		s.closeChan <- closeError{err: e, sendClose: false, remote: false}
	})
}