ErrorCode FileStoreServiceReplica::RegisterServiceLocation(int64 const sequenceNumber) { ErrorCode error; ManualResetEvent operationDone; // make a copy of the serialized data vector<BYTE> serializedData = serializedInfo_; NamingUri serviceName(this->serviceName_); NamePropertyOperationBatch propertyOperationBatch(serviceName); if(sequenceNumber > 0) { propertyOperationBatch.AddCheckSequenceOperation(this->PartitionId.ToString(), sequenceNumber); } else { propertyOperationBatch.AddCheckExistenceOperation(this->PartitionId.ToString(), false); } propertyOperationBatch.AddPutPropertyOperation(this->PartitionId.ToString(), move(serializedData), FABRIC_PROPERTY_TYPE_BINARY); propertyManagmentClient_->BeginSubmitPropertyBatch( move(propertyOperationBatch), FileStoreServiceConfig::GetConfig().NamingOperationTimeout, [this, &error, &operationDone] (AsyncOperationSPtr const & operation) { IPropertyBatchResultPtr result; error = propertyManagmentClient_->EndSubmitPropertyBatch(operation, result); if(error.IsSuccess()) { error = result->GetError(); } WriteInfo( TraceComponent, this->TraceId, "RegisterServiceLocation: Error:{0}", error); operationDone.Set(); }, this->CreateAsyncOperationRoot()); operationDone.WaitOne(); return error; }
template <bool ManualReset> void AsyncWaitHandleSetBeforeWait() { AsyncWaitHandle<ManualReset> asyncWaitHandle(true); AutoResetEvent resultEvent(false); asyncWaitHandle.BeginWaitOne( TimeSpan::MaxValue, [&asyncWaitHandle, &resultEvent] (AsyncOperationSPtr const & op) { ErrorCode result = asyncWaitHandle.EndWaitOne(op); VERIFY_IS_TRUE(result.IsSuccess()); resultEvent.Set(); }, AsyncOperationSPtr()); BOOST_REQUIRE(resultEvent.WaitOne(TimeSpan::FromSeconds(60))); }
/** * The a particular socket's connection failed * This function will call all substreams disconnected methods */ template <class ErrorCode> void hostDisconnectedCallback(const ASIOSocketWrapper* whichSocket, const ErrorCode &error) { unsigned int which=0; for (std::vector<ASIOSocketWrapper>::iterator i=mSockets.begin(),ie=mSockets.end(); i!=ie; ++i,++which) { if (&*i==whichSocket) break; } hostDisconnectedCallback(which==mSockets.size()?0:which,error.message()); }
ErrorCode ReportUpgradeHealthAsyncOperation::EndAcceptRequest(AsyncOperationSPtr const & operation) { ErrorCode error = this->Replica.EndAcceptReportUpgradeHealth(operation); // Upgrade context may be enqueued if (error.IsError(ErrorCodeValue::CMRequestAlreadyProcessing)) { error = ErrorCodeValue::Success; } if (error.IsSuccess()) { this->TryComplete(operation->Parent, error); } return error; }
ByteArray ConnectorMySQL::Call(const ByteArray &command, ErrorCode &error_code) { if (IsConnected()) { mysql_real_query(&mysql_, command.data(), command.size()); int error = mysql_errno(&mysql_); if (error != 0) { error_code.SetError(error, mysql_error(&mysql_)); return ByteArray(); } ByteArray bytes; MYSQL_RES *sql_result = mysql_store_result(&mysql_); if (sql_result != nullptr) { mysql_stuff::Serialize(sql_result, &bytes); mysql_free_result(sql_result); } else { ProcedureMySQL procedure(command); if (procedure.HasVariable()) { ByteArray query_variable = procedure.QueryVariableValue(); mysql_real_query(&mysql_, query_variable.data(), query_variable.size()); int error = mysql_errno(&mysql_); if (error != 0) { error_code.SetError(error, mysql_error(&mysql_)); return ByteArray(); } MYSQL_RES *sql_result = mysql_store_result(&mysql_); mysql_stuff::Serialize(sql_result, &bytes); mysql_free_result(sql_result); } } return bytes; } else { throw NotConnected(); } }
void RequestReceiverContext::Reject(ErrorCode const & error, ActivityId const & activityId) { ErrorCode rejectError; if (error.IsError(ErrorCodeValue::RoutingNodeDoesNotMatchFault)) { rejectError = ErrorCodeValue::RoutingError; } else if (error.IsError(ErrorCodeValue::P2PNodeDoesNotMatchFault)) { rejectError = ErrorCodeValue::P2PError; } else { rejectError = error; } InternalReject(rejectError, activityId); }
ErrorCode HostingQueryManager::ReplaceErrorIf(ErrorCode actualError, ErrorCodeValue::Enum compareWithError, ErrorCodeValue::Enum changeToError) { if (actualError.IsError(compareWithError)) { return changeToError; } return actualError; }
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; }
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(); }
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; }
ErrorCode SharableProxy::AribtrateAsyncOperation::ProcessRequest(Store::ILocalStore::TransactionSPtr const & trans) { ErrorCode error = PreventDeadlock(trans); if (!error.IsSuccess()) { WriteWarning(TraceFailure, "{0} failed to get lock for {1}: {2}", voteId_, *this, error); return error; } DateTime now; error = GetProxyTime(now); if (!error.IsSuccess()) { WriteWarning(TraceFailure, "{0} failed to get time for {1}: {2}", voteId_, *this, error); return error; } DateTime expireTime = now + ttl_; RecordVector monitorRecords(monitor_.InstanceId); error = GetRecords(trans, monitor_, monitorRecords); if (!error.IsSuccess()) { WriteWarning(TraceFailure, "{0} failed to get monitor record for {1}: {2}", voteId_, *this, error); return error; } RecordVector subjectRecords(subject_.InstanceId); error = GetRecords(trans, subject_, subjectRecords); if (!error.IsSuccess()) { WriteWarning(TraceFailure, "{0} failed to get subject record for {1}: {2}", voteId_, *this, error); return error; } result_ = ProcessRequest(monitorRecords, subjectRecords, expireTime); error = StoreRecords(trans, monitor_, monitorRecords); if (!error.IsSuccess()) { WriteWarning(TraceFailure, "{0} failed to save monitor record for {1}: {2}", voteId_, *this, error); return error; } error = StoreRecords(trans, subject_, subjectRecords); if (!error.IsSuccess()) { WriteWarning(TraceFailure, "{0} failed to save subject record for {1}: {2}", voteId_, *this, error); } return error; }
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(); }
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; }
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; }
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); }
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); } }
void PlacementAndLoadBalancingUnitTest::GetClusterLoadMetricInformation( Reliability::LoadBalancingComponent::PlacementAndLoadBalancing & plb, ServiceModel::LoadMetricInformation& loadMetricInfo, std::wstring metricName) { ServiceModel::ClusterLoadInformationQueryResult queryResult; ErrorCode result = plb.GetClusterLoadInformationQueryResult(queryResult); VERIFY_ARE_EQUAL(ErrorCodeValue::Success, result.ReadValue()); for (auto itMetric = queryResult.LoadMetric.begin(); itMetric != queryResult.LoadMetric.end(); ++itMetric) { if (itMetric->Name == metricName) { loadMetricInfo = *itMetric; return; } } VERIFY_FAIL(L"Metric is not present in the result, fail the test"); }
ErrorCode SharableProxy::AribtrateAsyncOperation::GetRecords( Store::ILocalStore::TransactionSPtr const & trans, LeaseWrapper::LeaseAgentInstance const & instance, RecordVector & records) { ILocalStore::EnumerationSPtr enumPtr; ErrorCode error = store_->CreateEnumerationByTypeAndKey(trans, ArbitrationRecordType, instance.Id, enumPtr); if (error.IsSuccess()) { error = enumPtr->MoveNext(); } if (error.IsSuccess()) { vector<byte> bytes; bytes.reserve(4096); if (!(error = enumPtr->CurrentValue(bytes)).IsSuccess()) { return error; } error = FabricSerializer::Deserialize(records, static_cast<ULONG>(bytes.size()), bytes.data()); if (error.IsSuccess()) { records.PostRead(); if (records.Instance < instance.InstanceId) { records.Reset(instance.InstanceId); } } } else if (error.IsError(ErrorCodeValue::EnumerationCompleted)) { error = ErrorCode::Success(); } return error; }
virtual bool onAcceptable(ErrorCode* ec) { ErrorCode tmpec; for (;;) { tmpec.reset(); struct sockaddr_storage ss; socklen_t socklen = sizeof(ss); int new_fd = ::accept(fd(), (struct sockaddr*)&ss, &socklen); if (-1 == new_fd) break; if (0 == socklen) { SocketHelper::closeSocket(new_fd, &tmpec); continue; } SockAddr addr((struct sockaddr*)&ss, socklen); if (addr.getType() == AF_UNIX) { if (!checkUnixDomain(addr)) { SocketHelper::closeSocket(new_fd, &tmpec); continue; } } try { onAccept(new_fd, addr); } catch (...) { } } return true; }
ErrorCode ApplicationManifestDescription::WriteDefaultServices(XmlWriterUPtr const & xmlWriter) { if (this->DefaultServices.empty()) { return ErrorCodeValue::Success; } ErrorCode er = xmlWriter->WriteStartElement(*SchemaNames::Element_DefaultServices, L"", *SchemaNames::Namespace); if (!er.IsSuccess()) { return er; } for (auto i = 0; i < DefaultServices.size(); i++) { er = (DefaultServices[i]).WriteToXml(xmlWriter); if (!er.IsSuccess()) { return er; } } return xmlWriter->WriteEndElement(); }
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); }
void PlacementAndLoadBalancingUnitTest::GetNodeLoadMetricInformation( Reliability::LoadBalancingComponent::PlacementAndLoadBalancing & plb, ServiceModel::NodeLoadMetricInformation& nodeLoadMetricInfo, int nodeIndex, std::wstring const& metricName) { ServiceModel::NodeLoadInformationQueryResult queryResult; ErrorCode retValue = plb.GetNodeLoadInformationQueryResult(CreateNodeId(nodeIndex), queryResult); VERIFY_ARE_EQUAL(ErrorCodeValue::Success, retValue.ReadValue()); for (auto itMetric = queryResult.NodeLoadMetricInformation.begin(); itMetric != queryResult.NodeLoadMetricInformation.end(); ++itMetric) { if (itMetric->Name == metricName) { nodeLoadMetricInfo = *itMetric; return; } } VERIFY_FAIL(L"Metric is not present in the result, fail the test"); }
ErrorCode PackageSharingPolicyDescription::WriteToXml(XmlWriterUPtr const & xmlWriter) { //PackageSharingPolicy> ErrorCode er = xmlWriter->WriteStartElement(*SchemaNames::Element_PackageSharingPolicy, L"", *SchemaNames::Namespace); if (!er.IsSuccess()) { return er; } er = xmlWriter->WriteAttribute(*SchemaNames::Attribute_PackageRef, this->PackageRef); if (!er.IsSuccess()) { return er; } er = xmlWriter->WriteAttribute(*SchemaNames::Attribute_Scope, PackageSharingPolicyTypeScope::EnumToString(this->Scope)); if (!er.IsSuccess()) { return er; } //</PackageSharingPolicy> return xmlWriter->WriteEndElement(); }
Common::ErrorCode SecurityAccessPolicyDescription::WriteToXml(XmlWriterUPtr const & xmlWriter) { //SecurityAccessPolicy ErrorCode er = xmlWriter->WriteStartElement(*SchemaNames::Element_SecurityAccessPolicy, L"", *SchemaNames::Namespace); if (!er.IsSuccess()) { return er; } er = xmlWriter->WriteAttribute(*SchemaNames::Attribute_ResourceRef, this->ResourceRef); if (!er.IsSuccess()) { return er; } er = xmlWriter->WriteAttribute(*SchemaNames::Attribute_PrincipalRef, this->PrincipalRef); if (!er.IsSuccess()) { return er; } er = xmlWriter->WriteAttribute(*SchemaNames::Attribute_GrantRights, GrantAccessType::ToString(this->Rights)); if (!er.IsSuccess()) { return er; } er = xmlWriter->WriteAttribute(*SchemaNames::Attribute_ResourceType, SecurityAccessPolicyTypeResourceType::ToString(this->ResourceType)); if (!er.IsSuccess()) { return er; } //</SecurityAccessPolicy> return xmlWriter->WriteEndElement(); }
ErrorCode ApplicationHealthPolicy::WriteToXml(XmlWriterUPtr const & xmlWriter) { //<HealthPolicy> ErrorCode er = xmlWriter->WriteStartElement(*SchemaNames::Element_HealthPolicy, L"", *SchemaNames::Namespace); if (!er.IsSuccess()) { return er; } er = xmlWriter->WriteBooleanAttribute(*SchemaNames::Attribute_ConsiderWarningAsError, this->ConsiderWarningAsError); if (!er.IsSuccess()) { return er; } er = xmlWriter->WriteNumericAttribute(*SchemaNames::Attribute_MaxPercentUnhealthyDeployedApplications, this->MaxPercentUnhealthyDeployedApplications); if (!er.IsSuccess()) { return er; } er = this->DefaultServiceTypeHealthPolicy.WriteToXml(xmlWriter, true); if (!er.IsSuccess()) { return er; } for (ServiceTypeHealthPolicyMap::iterator it = ServiceTypeHealthPolicies.begin(); it != ServiceTypeHealthPolicies.end(); ++it) { er = (*it).second.WriteToXml(xmlWriter, false, (*it).first); if (!er.IsSuccess()) { return er; } } //</HealthPolicy> return xmlWriter->WriteEndElement(); }
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); }
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); }
ErrorCode SharableProxy::GetVoteOwnerData(ILocalStore::TransactionSPtr const & trans, VoteOwnerData &ownerData, _int64 & operationLSN) { ILocalStore::EnumerationSPtr owners; ErrorCode error = store_->CreateEnumerationByTypeAndKey(trans, VoteOwnerType, L"", owners); if (error.IsSuccess()) { error = owners->MoveNext(); } if (!error.IsSuccess()) { return error; } vector<byte> value; if (!(error = owners->CurrentValue(value)).IsSuccess()) { return error; } error = owners->CurrentOperationLSN(operationLSN); if (!error.IsSuccess()) { return error; } error = FabricSerializer::Deserialize(ownerData, static_cast<ULONG>(value.size()), value.data()); if (error.IsSuccess()) { VoteProxyEventSource::Events->VoteOwnerDataRead( ownerData.Id, ownerData.ExpiryTime, ownerData.GlobalTicketExpiryTime, ownerData.SuperTicketExpiryTime); } return error; }
ErrorCode SharableProxy::AribtrateAsyncOperation::ProcessRequest() { ILocalStore::TransactionSPtr transPtr; ErrorCode result = store_->CreateTransaction(transPtr); if (!result.IsSuccess()) { return result; } result = ProcessRequest(transPtr); if (result.IsSuccess()) { result = transPtr->Commit(); } else { transPtr->Rollback(); } return result; }
shared_ptr<FailoverManagerStore> FailoverManagerStoreTest::InitializeStore( wstring ownerId, bool shouldPass, bool existingStore, Common::Guid const & partitionId, ::FABRIC_REPLICA_ID replicaId, Common::ComponentRoot const & root, const wstring storeType) { UNREFERENCED_PARAMETER(ownerId); UNREFERENCED_PARAMETER(shouldPass); if (storeType == L"ESENT") { auto replicatedStore = Store::KeyValueStoreReplica::CreateForUnitTests( partitionId, replicaId, Store::EseLocalStoreSettings(GetEseFilename(), GetEseDirectory()), root); ErrorCode error = replicatedStore->InitializeLocalStoreForUnittests(existingStore); shared_ptr<FailoverManagerStore> store = make_shared<FailoverManagerStore>(move(replicatedStore)); if (shouldPass) { VERIFY_ARE_EQUAL(ErrorCodeValue::Success, error.ReadValue(), L"store.Open did not return success"); return store; } else { VERIFY_ARE_NOT_EQUAL(ErrorCodeValue::Success, error.ReadValue(), L"store.Open returned success"); return nullptr; } } Common::Assert::CodingError("StoreType not found in properties"); }