当前位置: 首页>>代码示例>>C++>>正文


C++ Transaction::ActivationTransaction方法代码示例

本文整理汇总了C++中Transaction::ActivationTransaction方法的典型用法代码示例。如果您正苦于以下问题:C++ Transaction::ActivationTransaction方法的具体用法?C++ Transaction::ActivationTransaction怎么用?C++ Transaction::ActivationTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transaction的用法示例。


在下文中一共展示了Transaction::ActivationTransaction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

status_t
BPackageManager::ClientInstallationInterface::CommitTransaction(
	Transaction& transaction, BCommitTransactionResult& _result)
{
	return fDaemonClient.CommitTransaction(transaction.ActivationTransaction(),
		_result);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:7,代码来源:PackageManager.cpp

示例2:

status_t
PackageManager::PrepareTransaction(Transaction& transaction)
{
	Volume* volume = fRoot->GetVolume(transaction.Repository().Location());
	if (volume == NULL)
		return B_BAD_VALUE;

	return volume->CreateTransaction(transaction.Repository().Location(),
		transaction.ActivationTransaction(),
		transaction.TransactionDirectory());
}
开发者ID:orangejua,项目名称:haiku,代码行数:11,代码来源:PackageManager.cpp

示例3: bad_alloc

void
BPackageManager::_PreparePackageChanges(
	InstalledRepository& installationRepository)
{
	if (!installationRepository.HasChanges())
		return;

	PackageList& packagesToActivate
		= installationRepository.PackagesToActivate();
	PackageList& packagesToDeactivate
		= installationRepository.PackagesToDeactivate();

	// create the transaction
	Transaction* transaction = new Transaction(installationRepository);
	if (!fTransactions.AddItem(transaction)) {
		delete transaction;
		throw std::bad_alloc();
	}

	status_t error = fInstallationInterface->PrepareTransaction(*transaction);
	if (error != B_OK)
		DIE(error, "failed to create transaction");

	// download the new packages and prepare the transaction
	for (int32 i = 0; BSolverPackage* package = packagesToActivate.ItemAt(i);
		i++) {
		// get package URL and target entry

		BString fileName(package->Info().FileName());
		if (fileName.IsEmpty())
			throw std::bad_alloc();

		BEntry entry;
		error = entry.SetTo(&transaction->TransactionDirectory(), fileName);
		if (error != B_OK)
			DIE(error, "failed to create package entry");

		RemoteRepository* remoteRepository
			= dynamic_cast<RemoteRepository*>(package->Repository());
		if (remoteRepository != NULL) {
			// download the package
			BString url = remoteRepository->Config().PackagesURL();
			url << '/' << fileName;

			status_t error = DownloadPackage(url, entry,
				package->Info().Checksum());
			if (error != B_OK)
				DIE(error, "failed to download package");
		} else if (package->Repository() != &installationRepository) {
			// clone the existing package
			LocalRepository* localRepository
				= dynamic_cast<LocalRepository*>(package->Repository());
			if (localRepository == NULL) {
				DIE("internal error: repository %s is not a local repository",
					package->Repository()->Name().String());
			}
			_ClonePackageFile(localRepository, package, entry);
		}

		// add package to transaction
		if (!transaction->ActivationTransaction().AddPackageToActivate(
				fileName)) {
			throw std::bad_alloc();
		}
	}

	for (int32 i = 0; BSolverPackage* package = packagesToDeactivate.ItemAt(i);
		i++) {
		// add package to transaction
		if (!transaction->ActivationTransaction().AddPackageToDeactivate(
				package->Info().FileName())) {
			throw std::bad_alloc();
		}
	}
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:75,代码来源:PackageManager.cpp


注:本文中的Transaction::ActivationTransaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。