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


C++ ErrorCode::IsSuccess方法代码示例

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


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

示例1: EndArbitrate

ErrorCode SharableProxy::EndArbitrate(
    AsyncOperationSPtr const & operation,
    SiteNode & /*siteNode*/,
    __out ArbitrationReplyBody & result)
{
    SharableProxy::AribtrateAsyncOperation *op = AsyncOperation::Get<SharableProxy::AribtrateAsyncOperation>(operation);
    ErrorCode error = op->End(operation);
    if (error.IsSuccess())
    {
        result = op->Result;
    }
    else
    {
        result = ArbitrationReplyBody(TimeSpan::MaxValue, false);
    }

    return error;
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:18,代码来源:SharableProxy.cpp

示例2: GetServicePackages

ErrorCode HostingQueryManager::GetServicePackages(
    Application2SPtr const & applicationEntry,
    wstring const & filterServiceManifestName,
    ActivityId const & activityId,
    __out vector<ServicePackage2SPtr> & servicePackages)
{
    VersionedApplicationSPtr versionApplication = applicationEntry->GetVersionedApplication();
    if (!versionApplication)
    {
        WriteInfo(
            TraceType,
            Root.TraceId,
            "{0}: GetVersionedApplication for ApplicationName {1} failed",
            activityId,
            applicationEntry->AppName);
        return ErrorCodeValue::ApplicationNotFound;
    }

    ErrorCode error;

    if (filterServiceManifestName.empty())
    {
        error = versionApplication->GetAllServicePackageInstances(servicePackages);
    }
    else
    {
        error = versionApplication->GetInstancesOfServicePackage(filterServiceManifestName, servicePackages);
    }

    if (!error.IsSuccess())
    {
        WriteInfo(
            TraceType,
            Root.TraceId,
            "{0}: GetServicePackages for ApplicationName {1} failed with error {2}",
            activityId,
            applicationEntry->AppName,
            error);
        return ReplaceErrorIf(error, ErrorCodeValue::ObjectClosed, ErrorCodeValue::ApplicationNotFound);
    }

    return ErrorCode::Success();
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:43,代码来源:HostingQueryManager.cpp

示例3: GetServiceLocationSequenceNumber

ErrorCode FileStoreServiceReplica::GetServiceLocationSequenceNumber(__out int64 & sequenceNumber)
{
    ErrorCode error;
    ManualResetEvent operationDone;

    propertyManagmentClient_->BeginGetPropertyMetadata(
        NamingUri(serviceName_),
        this->PartitionId.ToString(),
        FileStoreServiceConfig::GetConfig().NamingOperationTimeout,
        [this, &error, &operationDone, &sequenceNumber] (AsyncOperationSPtr const & operation)
    {
        NamePropertyMetadataResult metadataResult;
        error = propertyManagmentClient_->EndGetPropertyMetadata(operation, metadataResult);
        WriteInfo(
            TraceComponent,
            this->TraceId,
            "GetServiceLocationSequenceNumber: SequenceNumber:{0}, Error:{1}",            
            metadataResult.SequenceNumber,
            error);

        if(error.IsSuccess())
        {
            sequenceNumber = metadataResult.SequenceNumber;
        }
        else
        {
            // If the property is not found, then complete with success
            if(error.IsError(ErrorCodeValue::PropertyNotFound))
            {
                // -1 indicates that sequence check should not be done
                sequenceNumber = -1;
                error = ErrorCodeValue::Success;
            }
        }

        operationDone.Set();
    },
        this->CreateAsyncOperationRoot());

    operationDone.WaitOne();

    return error;
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:43,代码来源:FileStoreServiceReplica.cpp

示例4: GenerateNodeId

Common::ErrorCode DeployedApplicationEntityHealthInformation::GenerateNodeId()
{
    Federation::NodeId nodeId;
    ErrorCode error = Federation::NodeIdGenerator::GenerateFromString(nodeName_, nodeId);
    if (!error.IsSuccess())
    {
        Trace.WriteInfo(TraceSource, "Error generating NodeId from NodeName {0}: {1}", nodeName_, error);
        return error;
    }

    if (nodeId != nodeId_)
    {
        Trace.WriteInfo(TraceSource, "Generate NodeId from NodeName {0}: {1} (previous {2})", nodeName_, nodeId, nodeId_);
        nodeId_ = nodeId.IdValue;
        entityId_.clear();
    }

    return ErrorCode::Success();
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:19,代码来源:DeployedApplicationEntityHealthInformation.cpp

示例5: WriteInfo

 void EntreeService::ResolvePartitionAsyncOperation::CompleteOrRetry(
     AsyncOperationSPtr const & thisSPtr, 
     ErrorCode const & error)
 {
     if (error.IsSuccess() || !this->IsRetryable(error))
     {
         this->TryComplete(thisSPtr, error);
     }
     else
     {
         WriteInfo(
             TraceComponent,
             "{0}: resolve returned error {1}, retry (timeout left={2})",
             TraceId,
             error,
             this->RemainingTime);
         this->HandleRetryStart(thisSPtr);
     }
 }
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:19,代码来源:EntreeService.ResolvePartitionAsyncOperation.cpp

示例6: GetTransportBehaviors

ErrorCode UnreliableTransportHelper::GetTransportBehaviors(
    QueryArgumentMap const &,
    ActivityId const &,
    __out QueryResult & queryResult)
{
    vector <pair<wstring, wstring>> parameters;
    ErrorCode errorCode = GetTransportBehaviors(parameters);
    if (errorCode.IsSuccess())
    {
        vector<wstring> tranportBehaviors;
        tranportBehaviors.reserve(parameters.size());
        for (auto& behavior : parameters)
        {
            tranportBehaviors.emplace_back(behavior.first + L"=" + behavior.second);
        }
        queryResult = QueryResult(move(tranportBehaviors));
    }
    return errorCode;
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:19,代码来源:UnreliableTransportHelper.cpp

示例7: Prepare

ErrorCode LTSendBuffer::Prepare()
{
    sendingLength_ = 0;
    preparedBuffers_.resize(0);
#ifdef PLATFORM_UNIX
    firstBufferToSend_ = 0;
#endif

    StopwatchTime now = Stopwatch::Now();
    ErrorCode error;
    for (auto cur = messageQueue_.begin(); cur != messageQueue_.end(); ++cur)
    {
        // cap large sends
        if ((sendingLength_ >= sendBatchLimitInBytes_) || (preparedBuffers_.size() >= SendBatchBufferCountLimit))
        {
            break;
        }

        if (!cur->Message())
        {
            continue; // message had been dropped due to expiration
        }

        if (cur->HasExpired(now))
        {
            DropExpiredMessage(*cur);
            continue;
        }

        error = cur->PrepareForSending(*this);
        if (!error.IsSuccess())
        {
            //TcpConnection Send Method Acuires lock before calling Prepare on SendBuffer.
            connection_->Close_CallerHoldingLock(true,error);
            return error;
        }
    }

    perfCounters_->AverageTcpSendSizeBase.Increment();
    perfCounters_->AverageTcpSendSize.IncrementBy(sendingLength_);
    return error;
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:42,代码来源:LTSendBuffer.cpp

示例8: CompleteOrRetry

    void EntreeService::ResolvePartitionAsyncOperation::OnFMResolved(
        AsyncOperationSPtr const & asyncOperation,
        bool expectedCompletedSynchronously)
    {
        if (asyncOperation->CompletedSynchronously != expectedCompletedSynchronously)
        {
            return;
        }

        Reliability::ServiceTableEntry serviceTableEntry;
        GenerationNumber unused;
        ErrorCode error = Properties.Resolver.EndResolveFMService(asyncOperation, /*out*/serviceTableEntry, /*out*/unused);

        if (error.IsSuccess())
        {
            Reply = NamingMessage::GetResolvePartitionReply(serviceTableEntry);
        }

        CompleteOrRetry(asyncOperation->Parent, error);
    }
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:20,代码来源:EntreeService.ResolvePartitionAsyncOperation.cpp

示例9: TryComplete

void Replicator::ChangeRoleAsyncOperation::ScheduleOpenPrimaryAndUpdateEpoch(Common::AsyncOperationSPtr const & thisSPtr)
{
    ErrorCode error = primaryCopy_->Open();
    if (!error.IsSuccess())
    {
        TryComplete(thisSPtr, error);
    }
    else
    {
        auto inner = CreateAndStart<UpdateEpochAsyncOperation>(
            parent_,
            epoch_,
            [this](AsyncOperationSPtr const & asyncOperation)
            {
                this->FinishUpdatePrimaryEpoch(asyncOperation, false);
            },
            thisSPtr);
        FinishUpdatePrimaryEpoch(inner, true);
    }
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:20,代码来源:Replicator.ChangeRoleAsyncOperation.cpp

示例10: CreateFabricInfrastructureServiceAgent

HRESULT ComInfrastructureServiceAgentFactory::CreateFabricInfrastructureServiceAgent(
    /* [in] */ __RPC__in REFIID riid,
    /* [out, retval] */ __RPC__deref_out_opt void ** fabricInfrastructureServiceAgent)
{
    if (riid != IID_IFabricInfrastructureServiceAgent) { return ComUtility::OnPublicApiReturn(E_NOINTERFACE); }
    if (fabricInfrastructureServiceAgent == NULL) { return ComUtility::OnPublicApiReturn(E_POINTER); }

    IInfrastructureServiceAgentPtr agentPtr;
    ErrorCode error = impl_->CreateInfrastructureServiceAgent(agentPtr);

    if (!error.IsSuccess()) 
    {
        return ComUtility::OnPublicApiReturn(error.ToHResult());
    }

    ComPointer<IFabricInfrastructureServiceAgent> agentCPtr = WrapperFactory::create_com_wrapper(agentPtr);

    *fabricInfrastructureServiceAgent = agentCPtr.DetachNoRelease();

    return ComUtility::OnPublicApiReturn(S_OK);
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:21,代码来源:ComInfrastructureServiceAgentFactory.cpp

示例11: lock

ErrorCode Replicator::ChangeRoleAsyncOperation::CreateInitialSecondary()
{
    AcquireWriteLock lock(parent_.lock_);
    ASSERT_IF(
        parent_.primary_ || parent_.secondary_, 
        "{0}: The primary and secondary shouldn't exist when changing role to IDLE", 
        parent_.ToString());

    ErrorCode error;
    if (newRole_ == ::FABRIC_REPLICA_ROLE_ACTIVE_SECONDARY)
    {
        error = parent_.state_.TransitionToSecondaryActive();
    }
    else
    {
        error = parent_.state_.TransitionToSecondaryIdle();
    }

    if (!error.IsSuccess())
    {
        return error;
    }

    parent_.secondary_ = move(SecondaryReplicator::CreateSecondary(
        parent_.config_,
        parent_.perfCounters_,
        parent_.replicaId_,
        parent_.hasPersistedState_,
        parent_.endpointUniqueId_,
        parent_.stateProvider_,
        parent_.partition_,
        parent_.version_,
        parent_.transport_,
        parent_.partitionId_,
        parent_.healthClient_,
        parent_.apiMonitor_));

    return ErrorCode(Common::ErrorCodeValue::Success);
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:39,代码来源:Replicator.ChangeRoleAsyncOperation.cpp

示例12: if

void ServiceCache::DeleteServiceAsyncOperation::StartDeleteService(AsyncOperationSPtr const& thisSPtr)
{
    ErrorCode error = serviceCache_.GetLockedService(serviceName_, lockedServiceInfo_);
    if (!error.IsSuccess())
    {
        TryComplete(thisSPtr, error);
        return;
    }

    if (lockedServiceInfo_->IsDeleted)
    {
        TryComplete(thisSPtr, ErrorCodeValue::FMServiceDoesNotExist);
        return;
    }
    else if (lockedServiceInfo_->IsToBeDeleted)
    {
        if (lockedServiceInfo_->IsForceDelete || !isForce_) // Allow convert normal deletion to forceful one
        {
            lockedServiceInfo_->AddDeleteOperation(thisSPtr);
            lockedServiceInfo_.Release();
            return;
        }
    }
    else if (serviceInstance_ < lockedServiceInfo_->Instance)
    {
        TryComplete(thisSPtr, ErrorCodeValue::StaleRequest);
        return;
    }

    newServiceInfo_ = make_shared<ServiceInfo>(*lockedServiceInfo_);
    newServiceInfo_->IsToBeDeleted = true;
    newServiceInfo_->IsForceDelete = isForce_;
    newServiceInfo_->AddDeleteOperation(thisSPtr);

    serviceCache_.fmStore_.BeginUpdateData(
        *newServiceInfo_,
        [this](AsyncOperationSPtr const& updateOperation) { OnStoreUpdateCompleted(updateOperation); },
        thisSPtr);
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:39,代码来源:ServiceCache.DeleteServiceAsyncOperation.cpp

示例13: move

    void StoreService::ProcessUpdateServiceRequestAsyncOperation::OnUpdateServiceComplete(
        AsyncOperationSPtr const & operation,
        bool expectedCompletedSynchronously)
    {
        if (operation->CompletedSynchronously != expectedCompletedSynchronously)
        {
            return;
        }

        AsyncOperationSPtr const & thisSPtr = operation->Parent;

        ErrorCode error = UpdateServiceAtAuthorityAsyncOperation::End(operation);

        if (error.IsSuccess())
        {
            this->TryComplete(thisSPtr, move(validationError_));
        }
        else
        {
            this->CompleteOrScheduleRetry(thisSPtr, move(error),
                [this](AsyncOperationSPtr const & thisSPtr) { this->FinishUpdateService(thisSPtr); });
        }
    }
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:23,代码来源:StoreService.ProcessUpdateServiceRequestAsyncOperation.cpp

示例14: EndResolveNameLocation

    void StoreService::ProcessUpdateServiceRequestAsyncOperation::OnResolveNameOwnerComplete(
        Common::AsyncOperationSPtr const & operation,
        bool expectedCompletedSynchronously)
    {
        if (expectedCompletedSynchronously != operation->CompletedSynchronously)
        {
            return;
        }

        AsyncOperationSPtr const & thisSPtr = operation->Parent;

        ErrorCode error = EndResolveNameLocation(operation, nameOwnerLocation_);

        if (!error.IsSuccess())
        {
            this->CompleteOrScheduleRetry(thisSPtr, move(error),
                [this](AsyncOperationSPtr const & thisSPtr) { this->StartResolveNameOwner(thisSPtr); });
        }
        else
        {
            this->StartRequestToNameOwner(thisSPtr);
        }
    }
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:23,代码来源:StoreService.ProcessUpdateServiceRequestAsyncOperation.cpp

示例15: Invariant

ErrorCode LTSendBuffer::Frame::PrepareForSending(LTSendBuffer & sendBuffer)
{
    Invariant(!preparedForSending_);
    preparedForSending_ = true;

    ErrorCode error = EncryptIfNeeded(sendBuffer);
    if (!error.IsSuccess())
    {
        return error;
    }

    if (!encrypted_.empty())
    {
        Invariant(shouldEncrypt_);
        sendBuffer.preparedBuffers_.emplace_back(ConstBuffer(encrypted_.data(), encrypted_.size()));
        sendBuffer.sendingLength_ += encrypted_.size();
        return error;
    }

    // add frame header
    if (message_->Actor != Actor::SecurityContext)
    {
        sendBuffer.preparedBuffers_.emplace_back(ConstBuffer(&header_, sizeof(header_)));
        sendBuffer.sendingLength_ += sizeof(header_);
    }

    // add message body
    for (BufferIterator chunk = message_->BeginBodyChunks(); chunk != message_->EndBodyChunks(); ++chunk)
    {
        if (chunk->size() == 0) continue;

        sendBuffer.preparedBuffers_.emplace_back(ConstBuffer(chunk->cbegin(), chunk->size()));
        sendBuffer.sendingLength_ += chunk->size();
    }

    return error;
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:37,代码来源:LTSendBuffer.cpp


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