// Unlink removes a large object from the database.
616
func (o *LargeObjects) Unlink(oid pgtype.OID) error {
	_, err := o.fp.CallFn("lo_unlink", []fpArg{fpIntArg(int32(oid))})
	return err
}
15998
func Unset(key string) error {
	var i int
	var part string
	configs.Lock()
	defer configs.Unlock()
	data := configs.data
	m := make(map[interface{}]interface{}, len(data))
	for k, v := range data {
		m[k] = v
	}
	root := m
	parts := strings.Split(key, ":")
	for i, part = range parts {
		if item, ok := m[part]; ok {
			if nm, ok := item.(map[interface{}]interface{}); ok && i < len(parts)-1 {
				m = nm
			} else {
				break
			}
		} else {
			return ErrKeyNotFound{Key: key}
		}
	}
	delete(m, part)
	configs.store(root)
	return nil
}
29799
func (k *Store) Remove(key string) {
	k.mu.Lock()
	defer k.mu.Unlock()

	delete(k.db, key)
	k.logChange(removeOperation, key, nil)
}
165699
func (m *DescriptionManager) Remove(globalid string) error {
	return m.collection.Remove(bson.M{"globalid": globalid})
}
1170410
func (db *DB) Close() error {
	db.mu.Lock()
	if db.closed { // Make DB.Close idempotent
		db.mu.Unlock()
		return nil
	}
	close(db.openerCh)
	var err error
	fns := make([]func() error, 0, len(db.freeConn))
	for _, dc := range db.freeConn {
		fns = append(fns, dc.closeDBLocked())
	}
	db.freeConn = nil
	db.closed = true
	for _, req := range db.connRequests {
		close(req)
	}
	db.mu.Unlock()
	for _, fn := range fns {
		err1 := fn()
		if err1 != nil {
			err = err1
		}
	}
	return err
}
944848
func (env *Environment) RemoveLinks() {
	env.Links = nil
	for _, p := range env.Pipelines {
		p.RemoveLinks()
	}
	for _, a := range env.Agents {
		a.RemoveLinks()
	}
}
495921
func (dbGorp *DbGorp) Close() (err error) {
	if dbGorp.Map.Db != nil {
		err = dbGorp.Map.Db.Close()
	}
	return
}
889137
func (m *linkMechanismManager) DeleteLink(context *LinkManagerContext) error {
	link := new(LinkManagerContext)

	lldriver, err := m.Driver()
	if err != nil {
		return nil
	}

	update := func(fn func() error) error {
		return m.BaseMechanismManager.Update(
			LinkModel, link, fn,
		)
	}

	alter := func(port LinkPort) error {
		// Attempting to delete link layer address from
		// uncofigured port is okay, so skip such port.
		addr, err := lldriver.Addr(port.Port)
		if err != nil {
			log.ErrorLog("link/DELETE_LINK",
				"Link layer address is not assigned to port: ", err)
			return nil
		}

		// Remove association from the driver
		defer lldriver.DeleteAddr(port.Port)

		// Forward event to activated mechanisms
		err = m.do(func(llmech LinkMechanism) error {
			return llmech.DeleteLinkPreCommit(&LinkContext{
				Addr:   addr,
				Port:   port.Port,
				Driver: lldriver,
			})
		})

		if err != nil {
			log.ErrorLog("link/DELETE_LINK",
				"Failed to delete link configuration: ", err)
		}

		return err
	}

	m.lock.RLock()
	defer m.lock.RUnlock()

	return update(func() error {
		for _, port := range context.Ports {
			if err := alter(port); err != nil {
				log.ErrorLog("link/DELETE_LINK",
					"Link delete pre-commit failed: ", err)
				return err
			}

			// Update link layer port configuration.
			link.DelPort(port)
		}

		err = m.do(func(llmech LinkMechanism) error {
			return llmech.DeleteLinkPostCommit()
		})

		if err != nil {
			log.ErrorLog("link/DELETE_LINK",
				"Link delete post-commit failed: ", err)
		}

		return nil
	})
}
798316
func (q *LinkedBlockingDeque) unlinkLast() interface{} {
	l := q.last
	if l == nil {
		return nil
	}
	p := l.prev
	item := l.item
	l.item = nil
	l.prev = l // help GC
	q.last = p
	if p == nil {
		q.first = nil
	} else {
		p.next = nil
	}
	q.count = q.count - 1
	q.notFull.Signal()
	return item
}
449805
func (bs *blobStore) link(ctx context.Context, path string, dgst digest.Digest) error {
	// The contents of the "link" file are the exact string contents of the
	// digest, which is specified in that package.
	return bs.driver.PutContent(ctx, path, []byte(dgst))
}
257108
func (b *boundManager) Unpin(leaseName string, entity string) error {
	return errors.Trace(b.pinOp(leaseName, entity, b.manager.unpins))
}
523193
func (clnt *Clnt) Unmount() {
	clnt.Lock()
	clnt.err = &Error{"connection closed", EIO}
	clnt.conn.Close()
	clnt.Unlock()
}
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
}
351267
func (db *FSDB) DeleteNoLock(key []byte) {
	key = escapeKey(key)
	path := db.nameToPath(key)
	err := remove(path)
	if os.IsNotExist(err) {
		return
	} else if err != nil {
		panic(errors.Wrapf(err, "Removing key %s (0x%X)", string(key), key))
	}
}
460707
func (m *Map) Unpin() error {
	path, err := m.Path()
	if err != nil {
		return err
	}

	return os.RemoveAll(path)
}
1347463
func (ldb *LevelDb) Close() (err error) {
	err = ldb.DB.Close()
	// Hide the closer error.
	_ = ldb.closer.Close()
	return err
}
1210100
func (l *linkIndex) link(parent, child *container.Container, alias string) {
	l.mu.Lock()

	if l.idx[parent] == nil {
		l.idx[parent] = make(map[string]*container.Container)
	}
	l.idx[parent][alias] = child
	if l.childIdx[child] == nil {
		l.childIdx[child] = make(map[*container.Container]map[string]struct{})
	}
	if l.childIdx[child][parent] == nil {
		l.childIdx[child][parent] = make(map[string]struct{})
	}
	l.childIdx[child][parent][alias] = struct{}{}

	l.mu.Unlock()
}