// Destroy destroys the backup engine info instance.
975636
func (b *BackupEngineInfo) Destroy() {
	C.rocksdb_backup_engine_info_destroy(b.c)
	b.c = nil
}
635566
func (a *StorageAPIv3) Destroy(args params.Entities) (params.ErrorResults, error) {
	v4Args := params.RemoveStorage{
		Storage: make([]params.RemoveStorageInstance, len(args.Entities)),
	}
	for i, arg := range args.Entities {
		v4Args.Storage[i] = params.RemoveStorageInstance{
			Tag: arg.Tag,
			// The v3 behaviour was to detach the storage
			// at the same time as marking the storage Dying.
			DestroyAttachments: true,
			DestroyStorage:     true,
		}
	}
	return a.remove(v4Args)
}
306513
func (self *RateLimiter) Destroy() {
	C.rocksdb_ratelimiter_destroy(self.c)
	self.c = nil
}
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}
	})
}
244837
func (im *Image) Destroy() {
	if im.Pixmap != 0 {
		xproto.FreePixmap(im.X.Conn(), im.Pixmap)
		im.Pixmap = 0
	}
}
891838
func (a *Application) Destroy() (err error) {
	defer func() {
		logger.Tracef("Application(%s).Destroy() => %v", a.doc.Name, err)
		if err == nil {
			// This is a white lie; the document might actually be removed.
			a.doc.Life = Dying
		}
	}()
	return a.st.ApplyOperation(a.DestroyOperation())
}
594542
func (env *environ) Destroy(ctx callcontext.ProviderCallContext) error {
	return env.withSession(ctx, func(env *sessionEnviron) error {
		return env.Destroy(ctx)
	})
}
100221
func (m *MachinesClient) Destroy(ctx context.Context, machineID *identity.ID) error {
	return m.client.RoundTrip(ctx, "DELETE", "/machines/"+machineID.String(), nil, nil, nil)
}
691491
func (self *SimpleSessionManager) Destroy(id string) error {
	ch := make(chan *SessionReturn)

	pkt := &sessionPacket{
		op:        _SESSION_OP_DEL,
		sessionId: id,
		ret:       ch,
	}
	self.out <- pkt
	_ = <-ch
	close(ch)

	return nil
}
291808
func (opts *ReadOptions) Destroy() {
	C.rocksdb_readoptions_destroy(opts.c)
	opts.c = nil
}
357704
func (m *IntelRdtManager) Destroy() error {
	m.mu.Lock()
	defer m.mu.Unlock()
	if err := os.RemoveAll(m.GetPath()); err != nil {
		return err
	}
	m.Path = ""
	return nil
}
511160
func (vm *VM) Destroy() error {
	// Set up the authorizer
	tok, err := getServicePrincipalToken(&vm.Creds, azure.PublicCloud.ResourceManagerEndpoint)
	if err != nil {
		return err
	}
	authorizer := autorest.NewBearerAuthorizer(tok)

	// Delete the VM
	virtualMachinesClient := compute.NewVirtualMachinesClient(vm.Creds.SubscriptionID)
	virtualMachinesClient.Authorizer = authorizer

	_, errc := virtualMachinesClient.Delete(vm.ResourceGroup, vm.Name, nil)
	if err := <-errc; err != nil {
		return err
	}

	// Make sure VM is deleted
	deleted := false
	for i := 0; i < actionTimeout; i++ {
		_, err := vm.GetState()
		if err != nil {
			if strings.Contains(err.Error(), `Code="ResourceNotFound"`) ||
				strings.Contains(err.Error(), `Code="NotFound"`) {
				deleted = true
				break
			}
			return err
		}

		time.Sleep(1 * time.Second)
	}

	if !deleted {
		return ErrActionTimeout
	}

	var errors []error
	// Delete the files of this VM
	err = vm.deleteVMFiles(authorizer)
	if err != nil {
		errors = append(errors, err)
	}

	// Delete the network interface of this VM
	err = vm.deleteNic(authorizer)
	if err != nil {
		errors = append(errors, err)
	} else {
		// Delete the public IP of this VM
		err = vm.deletePublicIP(authorizer)
		if err != nil {
			errors = append(errors, err)
		}
	}

	// Delete the deployed arm template
	err = vm.deleteDeployment(authorizer)
	if err != nil {
		errors = append(errors, err)
	}

	// Return all the errors
	var returnedErr error
	if len(errors) > 0 {
		for i, err := range errors {
			if i == 0 {
				returnedErr = err
				continue
			}

			returnedErr = fmt.Errorf("%s, %s", returnedErr, err)
		}
	}

	return returnedErr
}
1137188
func (_class NetworkClass) Destroy(sessionID SessionRef, self NetworkRef) (_err error) {
	_method := "network.destroy"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertNetworkRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_, _err =  _class.client.APICall(_method, _sessionIDArg, _selfArg)
	return
}
1078448
func (c *Charm) Destroy() error {
	buildTxn := func(_ int) ([]txn.Op, error) {
		ops, err := charmDestroyOps(c.st, c.doc.URL)
		if IsNotAlive(err) {
			return nil, jujutxn.ErrNoOperations
		} else if err != nil {
			return nil, errors.Trace(err)
		}
		return ops, nil
	}
	if err := c.st.db().Run(buildTxn); err != nil {
		return errors.Trace(err)
	}
	c.doc.Life = Dying
	return nil
}
929710
func (s *Semaphore) Destroy() error {
	// Hold the lock as we try to acquire
	s.l.Lock()
	defer s.l.Unlock()

	// Check if we already hold the semaphore
	if s.isHeld {
		return ErrSemaphoreHeld
	}

	// List for the semaphore
	kv := s.c.KV()
	pairs, _, err := kv.List(s.opts.Prefix, nil)
	if err != nil {
		return fmt.Errorf("failed to read prefix: %v", err)
	}

	// Find the lock pair, bail if it doesn't exist
	lockPair := s.findLock(pairs)
	if lockPair.ModifyIndex == 0 {
		return nil
	}
	if lockPair.Flags != SemaphoreFlagValue {
		return ErrSemaphoreConflict
	}

	// Decode the lock
	lock, err := s.decodeLock(lockPair)
	if err != nil {
		return err
	}

	// Prune the dead holders
	s.pruneDeadHolders(lock, pairs)

	// Check if there are any holders
	if len(lock.Holders) > 0 {
		return ErrSemaphoreInUse
	}

	// Attempt the delete
	didRemove, _, err := kv.DeleteCAS(lockPair, nil)
	if err != nil {
		return fmt.Errorf("failed to remove semaphore: %v", err)
	}
	if !didRemove {
		return ErrSemaphoreInUse
	}
	return nil
}
298323
func (_class CrashdumpClass) Destroy(sessionID SessionRef, self CrashdumpRef) (_err error) {
	_method := "crashdump.destroy"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertCrashdumpRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_, _err =  _class.client.APICall(_method, _sessionIDArg, _selfArg)
	return
}
779468
func (vm *VM) Destroy() error {
	s, err := vm.getService()
	if err != nil {
		return err
	}

	return s.delete()
}