// remove removes all operating systems pending removal from the database, clearing pending removals.
// No-op unless computeChanges was called first. Idempotent until computeChanges is called again.
420023
func (t *OSesTable) remove(c context.Context) error {
	// Avoid using the database connection to prepare unnecessary statements.
	if len(t.removals) == 0 {
		return nil
	}

	db := database.Get(c)
	stmt, err := db.PrepareContext(c, `
		DELETE FROM oses
		WHERE id = ?
	`)
	if err != nil {
		return errors.Annotate(err, "failed to prepare statement").Err()
	}
	defer stmt.Close()

	// Remove each operating system from the table. It's more efficient to update the slice of
	// operating systems once at the end rather than for each removal, so use a defer.
	removed := make(map[int64]struct{}, len(t.removals))
	defer func() {
		var oses []*OS
		for _, os := range t.current {
			if _, ok := removed[os.Id]; !ok {
				oses = append(oses, os)
			}
		}
		t.current = oses
	}()
	for len(t.removals) > 0 {
		os := t.removals[0]
		if _, err := stmt.ExecContext(c, os.Id); err != nil {
			// Defer ensures the slice of operating systems is updated even if we exit early.
			return errors.Annotate(err, "failed to remove operating system %q", os.Name).Err()
		}
		removed[os.Id] = struct{}{}
		t.removals = t.removals[1:]
		logging.Infof(c, "Removed operating system %q", os.Name)
	}
	return nil
}
146836
func (kv *KeyValue) Remove() error {
	// Remove the table
	_, err := kv.host.db.Exec("DROP TABLE " + kv.table)
	return err
}
1274877
func (rl *List) Remove() error {
	conn := rl.pool.Get(rl.dbindex)
	_, err := conn.Do("DEL", rl.id)
	return err
}
1170598
func (c *Container) Remove(ctx context.Context) error {
	if c.Engine == nil {
		return ErrNilEngine
	}
	return c.Engine.VirtualizationRemove(ctx, c.ID, true, true)
}
520679
func Remove(name string) error {
	err := os.Remove(name)
	if err != nil {
		return errors.Wrapf(err, "failed to remove %q", name)
	}

	return nil
}
465012
func (windows *windowsRecord) Remove() (string, error) {
	removeAction := "Removing " + windows.description + ":"

	m, err := mgr.Connect()
	if err != nil {
		return removeAction + failed, getWindowsError(err)
	}
	defer m.Disconnect()
	s, err := m.OpenService(windows.name)
	if err != nil {
		return removeAction + failed, getWindowsError(err)
	}
	defer s.Close()
	err = s.Delete()
	if err != nil {
		return removeAction + failed, getWindowsError(err)
	}

	return removeAction + " completed.", nil
}
44159
func remove(args [][]byte, txn *mdb.Txn) ([]byte, error) {
	dbName := string(args[0])
	dbi, err := txn.DBIOpen(&dbName, mdb.CREATE) // create if not exists
	if err != nil {
		txn.Abort()
		return nil, err
	}
	err = txn.Del(dbi, args[1], nil)
	if err != nil {
		txn.Abort()
		return nil, err
	}
	return nil, txn.Commit()
}
556589
func (rs *Set) Remove() error {
	conn := rs.pool.Get(rs.dbindex)
	_, err := conn.Do("DEL", rs.id)
	return err
}
8565
func (t *txLookup) Remove(hash common.Hash) {
	t.lock.Lock()
	defer t.lock.Unlock()

	delete(t.all, hash)
}
406288
func (c *modelStateCollection) Remove(query interface{}) error {
	return c.WriteCollection.Remove(c.mungeQuery(query))
}
737180
func (s *Set) Remove(key interface{}) (ok bool) {
	_, ok = s.skiplist.Delete(key)
	return ok
}
1186296
func (t *SwitchesTable) remove(c context.Context) error {
	// Avoid using the database connection to prepare unnecessary statements.
	if len(t.removals) == 0 {
		return nil
	}

	db := database.Get(c)
	stmt, err := db.PrepareContext(c, `
		DELETE FROM switches
		WHERE id = ?
	`)
	if err != nil {
		return errors.Annotate(err, "failed to prepare statement").Err()
	}
	defer stmt.Close()

	// Remove each switch from the table. It's more efficient to update the slice of
	// switches once at the end rather than for each removal, so use a defer.
	removed := make(map[int64]struct{}, len(t.removals))
	defer func() {
		var switches []*Switch
		for _, s := range t.current {
			if _, ok := removed[s.Id]; !ok {
				switches = append(switches, s)
			}
		}
		t.current = switches
	}()
	for len(t.removals) > 0 {
		s := t.removals[0]
		if _, err := stmt.ExecContext(c, s.Id); err != nil {
			// Defer ensures the slice of switches is updated even if we exit early.
			return errors.Annotate(err, "failed to remove switch %q", s.Name).Err()
		}
		removed[s.Id] = struct{}{}
		t.removals = t.removals[1:]
		logging.Infof(c, "Removed switch %q", s.Name)
	}
	return nil
}
1313706
func (t *IPsTable) remove(c context.Context) error {
	// Avoid using the database connection to prepare unnecessary statements.
	if len(t.removals) == 0 {
		return nil
	}

	db := database.Get(c)
	stmt, err := db.PrepareContext(c, `
		DELETE FROM ips
		WHERE id = ?
	`)
	if err != nil {
		return errors.Annotate(err, "failed to prepare statement").Err()
	}
	defer stmt.Close()

	// Remove each IP address from the table. It's more efficient to update the slice of
	// IP addresses once at the end rather than for each removal, so use a defer.
	removed := make(map[int64]struct{}, len(t.removals))
	defer func() {
		var ips []*IP
		for _, ip := range t.current {
			if _, ok := removed[ip.Id]; !ok {
				ips = append(ips, ip)
			}
		}
		t.current = ips
	}()
	for len(t.removals) > 0 {
		ip := t.removals[0]
		if _, err := stmt.ExecContext(c, ip.Id); err != nil {
			// Defer ensures the slice of IP addresses is updated even if we exit early.
			return errors.Annotate(err, "failed to remove IP address %q", ip.IPv4).Err()
		}
		removed[ip.Id] = struct{}{}
		t.removals = t.removals[1:]
		logging.Infof(c, "Removed IP address %q", ip.IPv4)
	}
	return nil
}
163972
func Remove(h Interface, i int) (v interface{}) {
	n := h.Len() - 1
	if n != i {
		h.Swap(n, i)
		shuffleDown(h, i, n)
		shuffleUp(h, i)
	}
	return h.Pop()
}
530682
func (c *Config) Remove(key string) (value interface{}, ok bool) {
	return c.values.Remove(c.NewKey(key))
}
975532
func (d *Driver) Remove(id string) error {
	if d.ostreeRepo != "" {
		// Ignore errors, we don't want to fail if the ostree branch doesn't exist,
		ostree.DeleteOSTree(d.ostreeRepo, id)
	}
	return system.EnsureRemoveAll(d.dir(id))
}
242729
func (s *session) Remove(table ReadonlyTable) error {
	action, err := s.remove(table.TableMeta(), table.Key())
	if err != nil {
		return s.catch("Remove: "+action, err)
	}
	return nil
}