internal static ActorReminderData Deserialize(byte[] reminderDataBytes) { if ((reminderDataBytes == null) || (reminderDataBytes.Length == 0)) { return(null); } using (var stream = new MemoryStream(reminderDataBytes)) { using (var reader = new BinaryReader(stream, DataEncoding)) { var dataVersion = reader.ReadUInt16(); ReleaseAssert.AssertIfNot(dataVersion >= DataVersionOne, "Invalid data version: {0}", dataVersion); if (reader.ReadByte() == BinaryReaderWriterExtensions.NullPrefixByte) { return(null); } return(new ActorReminderData( reader.ReadActorId(), reader.ReadString(DataEncoding), reader.ReadTimeSpan(), reader.ReadTimeSpan(), reader.ReadByteArray(), reader.ReadTimeSpan() )); } } }
internal static unsafe ContainerActivationArgs CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, "ContainerActivationArgs.CreateFromNative() has null pointer."); var nativeArgs = *((NativeTypes.FABRIC_CONTAINER_ACTIVATION_ARGS *)nativePtr); var containerActivationArgs = new ContainerActivationArgs { IsUserLocalSystem = NativeTypes.FromBOOLEAN(nativeArgs.IsUserLocalSystem), AppHostId = NativeTypes.FromNativeString(nativeArgs.AppHostId), NodeId = NativeTypes.FromNativeString(nativeArgs.NodeId), ContainerDescription = ContainerDescription.CreateFromNative(nativeArgs.ContainerDescription), ProcessDescription = ProcessDescription.CreateFromNative(nativeArgs.ProcessDescription), FabricBinPath = NativeTypes.FromNativeString(nativeArgs.FabricBinPath), GatewayIpAddress = NativeTypes.FromNativeString(nativeArgs.GatewayIpAddress) }; if (nativeArgs.Reserved != null) { var nativeArgsEx1 = *((NativeTypes.FABRIC_CONTAINER_ACTIVATION_ARGS_EX1 *)nativeArgs.Reserved); containerActivationArgs.GatewayIpAddresses = NativeTypes.FromNativeStringList(nativeArgsEx1.GatewayIpAddresses); } return(containerActivationArgs); }
OnLogicalLogClose(LogicalLog ToClose, CancellationToken cancellationToken) { await _Lock.WaitUntilSetAsync(cancellationToken).ConfigureAwait(false); try { PhysicalLog handleOwner = null; ReleaseAssert.AssertIfNot(_Logs.TryGetValue(ToClose.OwnerId, out handleOwner), "_Logs index is inconsistent"); if (await handleOwner.OnCloseLogicalLog(ToClose, cancellationToken).ConfigureAwait(false)) { // last handle or logical log closed on the PhysicalLog, removed from this index _Logs.Remove(ToClose.OwnerId); if ((_Handles.Count == 0) && (_Logs.Count == 0)) { var m = _AppDomainPhysLogManager; _AppDomainPhysLogManager = null; await m.CloseAsync(cancellationToken).ConfigureAwait(false); } } } finally { _Lock.Set(); } }
public bool ProcessLatestNode(PaasNodeStatusInfo latestNode) { ReleaseAssert.AssertIfNot( this.Node.NodeName.Equals(latestNode.NodeName), "Existing NodeName {0} does not match new name {1}", this.Node.NodeName, latestNode.NodeName); if (!this.Node.Equals(latestNode)) { var oldNode = this.Node; this.Node = latestNode; this.Node.IntentionInstance++; this.IsProcessedByWRP = false; Trace.WriteInfo( TraceType, "Updating NodeStatus. Old: {0}, Updated: {1}", oldNode, this.Node); return(true); } return(false); }
unsafe private NativeRuntime.IFabricOperationData CreateNativeOperationData(IOperationData data, uint[] sizes) { NativeRuntime.IFabricOperationData operationData = null; using (var pin = new PinBlittable(sizes)) { operationData = this.operationDataFactory.CreateOperationData(pin.AddrOfPinnedObject(), (uint)sizes.Length); } // get a pointer to the memory that native code allocated in the operation data it created for us uint countAllocatedByNative; IntPtr nativeBuffersRaw = operationData.GetData(out countAllocatedByNative); ReleaseAssert.AssertIfNot(countAllocatedByNative == (uint)sizes.Length, StringResources.Error_BufferNumberMismatach); NativeTypes.FABRIC_OPERATION_DATA_BUFFER *nativeBuffers = (NativeTypes.FABRIC_OPERATION_DATA_BUFFER *)nativeBuffersRaw; // copy the data into the buffers allocated by native int index = 0; foreach (var item in data) { NativeTypes.FABRIC_OPERATION_DATA_BUFFER *nativeBuffer = nativeBuffers + index; ReleaseAssert.AssertIfNot(nativeBuffer->BufferSize == sizes[index], string.Format(CultureInfo.CurrentCulture, StringResources.Error_BufferAllocationSizeMismatch_Formatted, index, nativeBuffer->BufferSize, sizes[index])); Marshal.Copy(item.Array, item.Offset, nativeBuffer->Buffer, item.Count); index++; } return(operationData); }
Buffer(uint blockMetadataSize, uint maxBlockSize, long streamLocation, long opNumber, Guid StreamId) { this._AllocationReportedToGC = maxBlockSize + (uint)KLogicalLogInformation.FixedMetadataSize; AddGCMemoryPressure(this._AllocationReportedToGC); this._MetadataSize = blockMetadataSize; NativeLog.CreateSimpleKIoBuffer((uint)KLogicalLogInformation.FixedMetadataSize, out this._MetadataKIoBuffer); // // Allocate the write KIoBuffer to be the full block size requested by the caller despite the fact that some // data will live in the metadata portion. Consider the fact that when the block is completely full, there will be some // amount of data in the metadata and then the data portion will be full as well except for a gap at the end of the block // which is the size of the data in the metadata portion. When rounding up we will need this last block despite it not being // completely full. // NativeLog.CreateSimpleKIoBuffer((uint)(maxBlockSize), out this._PageAlignedKIoBuffer); NativeLog.CreateEmptyKIoBuffer(out this._CombinedKIoBuffer); this._CombinedKIoBuffer.AddIoBufferReference(this._MetadataKIoBuffer, 0, (uint)KLogicalLogInformation.FixedMetadataSize); this._CombinedKIoBuffer.AddIoBufferReference( this._PageAlignedKIoBuffer, 0, (uint)(maxBlockSize - KLogicalLogInformation.FixedMetadataSize)); this._CombinedBufferStream = new KIoBufferStream(this._CombinedKIoBuffer, (uint)blockMetadataSize); NativeLog.CreateEmptyKIoBuffer(out this._PageAlignedKIoBufferView); unsafe { KLogicalLogInformation.MetadataBlockHeader *mdHdr = null; mdHdr = (KLogicalLogInformation.MetadataBlockHeader *) this._CombinedBufferStream.GetBufferPointer(); this._MetadataBlockHeader = mdHdr; ReleaseAssert.AssertIfNot( this._CombinedBufferStream.Skip((uint)sizeof(KLogicalLogInformation.MetadataBlockHeader)), "Unexpected Skip failure"); this._StreamBlockHeader = (KLogicalLogInformation.StreamBlockHeader *) this._CombinedBufferStream.GetBufferPointer(); mdHdr->OffsetToStreamHeader = this._CombinedBufferStream.GetPosition(); // Position the stream at 1st byte of user record ReleaseAssert.AssertIfNot( this._CombinedBufferStream.Skip((uint)sizeof(KLogicalLogInformation.StreamBlockHeader)), "Unexpected Skip failure"); this._StreamBlockHeader->Signature = KLogicalLogInformation.StreamBlockHeader.Sig; this._StreamBlockHeader->StreamOffsetPlusOne = streamLocation + 1; this._StreamBlockHeader->HighestOperationId = opNumber; this._StreamBlockHeader->StreamId = StreamId; this._StreamBlockHeader->HeaderCRC64 = 0; this._StreamBlockHeader->DataCRC64 = 0; this._StreamBlockHeader->DataSize = 0; this._StreamBlockHeader->Reserved = 0; this._OffsetToData = mdHdr->OffsetToStreamHeader + (uint)sizeof(KLogicalLogInformation.StreamBlockHeader); } }
OnCloseLogicalLog(LogicalLog toClose, CancellationToken cancellationToken) { await this._PhysicalLogLock.WaitUntilSetAsync(cancellationToken).ConfigureAwait(false); try { LogicalLogInfo llInfo; if (this._LogicalLogs.TryGetValue(toClose.Id, out llInfo) == false) { ReleaseAssert.Failfast("toClose missing from _LogicalLogs"); } await llInfo.UnderlyingStream.CloseAsync(cancellationToken).ConfigureAwait(false); ReleaseAssert.AssertIfNot(this._LogicalLogs.Remove(toClose.Id), "handle missing from _LogicalLogs"); if ((this._PhysicalLogHandles.Count == 0) && (this._LogicalLogs.Count == 0)) { await this._Container.CloseAsync(cancellationToken).ConfigureAwait(false); this.IsOpen = false; return(true); // Indicate p.log was closed } return(false); } finally { this._PhysicalLogLock.Set(); } }
internal static unsafe ProcessDebugParameters CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, "ProcessDebugParameters.CreateFromNative() has null pointer."); var nativeParameters = *((NativeTypes.FABRIC_PROCESS_DEBUG_PARAMETERS *)nativePtr); var debugParams = new ProcessDebugParameters { ExePath = NativeTypes.FromNativeString(nativeParameters.ExePath), Arguments = NativeTypes.FromNativeString(nativeParameters.Arguments), LockFile = NativeTypes.FromNativeString(nativeParameters.LockFile), WorkingFolder = NativeTypes.FromNativeString(nativeParameters.WorkingFolder), DebugParametersFile = NativeTypes.FromNativeString(nativeParameters.DebugParametersFile), EnvVars = NativeTypes.FromNativeStringPairList(nativeParameters.EnvVars), ContainerEntryPoints = NativeTypes.FromNativeStringList(nativeParameters.ContainerEntryPoints), ContainerMountedVolumes = NativeTypes.FromNativeStringList(nativeParameters.ContainerMountedVolumes), ContainerEnvironmentBlock = NativeTypes.FromNativeStringList(nativeParameters.ContainerEnvironmentBlock) }; if (nativeParameters.Reserved != null) { var nativeParametersx1 = *((NativeTypes.FABRIC_PROCESS_DEBUG_PARAMETERS_EX1 *)nativeParameters.Reserved); debugParams.ContainerLabels = NativeTypes.FromNativeStringList(nativeParametersx1.ContainerLabels); } return(debugParams); }
internal static unsafe ResourceGovernancePolicyDescription CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot( nativePtr != IntPtr.Zero, "ResourceGovernancePolicyDescription.CreateFromNative() has null pointer."); var nativeDescription = *((NativeTypes.FABRIC_RESOURCE_GOVERNANCE_POLICY_DESCRIPTION *)nativePtr); var resourceGovPolicyDesc = new ResourceGovernancePolicyDescription { CodePackageRef = NativeTypes.FromNativeString(nativeDescription.CodePackageRef), MemoryInMB = nativeDescription.MemoryInMB, MemorySwapInMB = nativeDescription.MemorySwapInMB, MemoryReservationInMB = nativeDescription.MemoryReservationInMB, CpuShares = nativeDescription.CpuShares, CpuPercent = nativeDescription.CpuPercent, MaximumIOps = nativeDescription.MaximumIOps, MaximumIOBytesps = nativeDescription.MaximumIOBytesps, BlockIOWeight = nativeDescription.BlockIOWeight, CpusetCpus = NativeTypes.FromNativeString(nativeDescription.CpusetCpus), NanoCpus = nativeDescription.NanoCpus, CpuQuota = nativeDescription.CpuQuota }; if (nativeDescription.Reserved != null) { var nativeParametersEx1 = *((NativeTypes.FABRIC_RESOURCE_GOVERNANCE_POLICY_DESCRIPTION_EX1 *)nativeDescription.Reserved); resourceGovPolicyDesc.DiskQuotaInMB = nativeParametersEx1.DiskQuotaInMB; resourceGovPolicyDesc.KernelMemoryInMB = nativeParametersEx1.KernelMemoryInMB; resourceGovPolicyDesc.ShmSizeInMB = nativeParametersEx1.ShmSizeInMB; } return(resourceGovPolicyDesc); }
internal static unsafe ServiceCorrelationDescription CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, StringResources.Error_NullNativePointer); ServiceCorrelationDescription correlation = new ServiceCorrelationDescription(); NativeTypes.FABRIC_SERVICE_CORRELATION_DESCRIPTION *casted = (NativeTypes.FABRIC_SERVICE_CORRELATION_DESCRIPTION *)nativePtr; correlation.ServiceName = NativeTypes.FromNativeUri(casted->ServiceName); switch (casted->Scheme) { case NativeTypes.FABRIC_SERVICE_CORRELATION_SCHEME.FABRIC_SERVICE_CORRELATION_SCHEME_AFFINITY: correlation.Scheme = ServiceCorrelationScheme.Affinity; break; case NativeTypes.FABRIC_SERVICE_CORRELATION_SCHEME.FABRIC_SERVICE_CORRELATION_SCHEME_ALIGNED_AFFINITY: correlation.Scheme = ServiceCorrelationScheme.AlignedAffinity; break; case NativeTypes.FABRIC_SERVICE_CORRELATION_SCHEME.FABRIC_SERVICE_CORRELATION_SCHEME_NONALIGNED_AFFINITY: correlation.Scheme = ServiceCorrelationScheme.NonAlignedAffinity; break; default: AppTrace.TraceSource.WriteError("ServiceCorrelationDescription.CreateFromNative", "Invalid service correlation scheme {0}", casted->Scheme); ReleaseAssert.Failfast(string.Format(CultureInfo.CurrentCulture, StringResources.Error_InvalidServiceCorrelationScheme_Formatted, casted->Scheme)); break; } return(correlation); }
public NodeEntity GetUpNodeToFault(Guid activityId = default(Guid)) { // Say, we have three node types: FrontEnd (3 nodes), Application (3 nodes), and BackEnd (5 nodes). // If we include only FrontEnd node type in the NodeTypeInclusionFilter // then 3 (this.FaultReadyLiveNodesCount) < 8 (this.MinLiveNodesCount) and no NodeRestart faults happen. // The leftside of the following inequality (>) should include all currently alive nodes, hence the addition of liveExcludedNodesCount. if (this.FaultReadyLiveNodesCount + this.LiveExcludedNodesCount > this.MinLiveNodesCount) { bool selectSeedNode = false; if (this.FaultReadyLiveSeedNodesCount + this.LiveExcludedSeedNodesCount > this.MinLiveSeedNodesCount) { selectSeedNode = this.random.NextDouble() < (this.SeedNodesCount / (double)this.ClusterNodesCount); } var chosenListOfFaultReadyNodes = this.GetSortedListNodesInfo(selectSeedNode, true /*UpNodes*/).Where(kvp => kvp.Value == true /*IsAvailableToFault*/).ToList(); if (chosenListOfFaultReadyNodes.Any()) { var chosenNode = this.GetRandomFrom(chosenListOfFaultReadyNodes); ReleaseAssert.AssertIfNot(chosenNode.Value, "Should not have chosen in transition node"); var clusterNode = this.ClusterNodes.FirstOrDefault(n => n.CurrentNodeInfo.NodeName == chosenNode.Key); ReleaseAssert.AssertIf(clusterNode == null, "Cluster node with name {0} should exist in local structure", chosenNode.Key); return(clusterNode); } } return(null); }
internal static unsafe ServicePlacementPolicyDescription CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, StringResources.Error_NullNativePointer); NativeTypes.FABRIC_SERVICE_PLACEMENT_POLICY_DESCRIPTION *casted = (NativeTypes.FABRIC_SERVICE_PLACEMENT_POLICY_DESCRIPTION *)nativePtr; switch (casted->Type) { case NativeTypes.FABRIC_PLACEMENT_POLICY_TYPE.FABRIC_PLACEMENT_POLICY_INVALID_DOMAIN: return(ServicePlacementInvalidDomainPolicyDescription.CreateFromNative(casted->Value)); case NativeTypes.FABRIC_PLACEMENT_POLICY_TYPE.FABRIC_PLACEMENT_POLICY_REQUIRED_DOMAIN: return(ServicePlacementRequiredDomainPolicyDescription.CreateFromNative(casted->Value)); case NativeTypes.FABRIC_PLACEMENT_POLICY_TYPE.FABRIC_PLACEMENT_POLICY_PREFERRED_PRIMARY_DOMAIN: return(ServicePlacementPreferPrimaryDomainPolicyDescription.CreateFromNative(casted->Value)); case NativeTypes.FABRIC_PLACEMENT_POLICY_TYPE.FABRIC_PLACEMENT_POLICY_REQUIRED_DOMAIN_DISTRIBUTION: return(ServicePlacementRequireDomainDistributionPolicyDescription.CreateFromNative(casted->Value)); case NativeTypes.FABRIC_PLACEMENT_POLICY_TYPE.FABRIC_PLACEMENT_POLICY_NONPARTIALLY_PLACE_SERVICE: return(ServicePlacementNonPartiallyPlaceServicePolicyDescription.CreateFromNative(casted->Value)); default: AppTrace.TraceSource.WriteError("ServicePlacementPolicyDescription.CreateFromNative", "Invalid placement policy type {0}", casted->Type); break; } return(null); }
OnCloseHandle(Handle toClose, CancellationToken cancellationToken) { await this._PhysicalLogLock.WaitUntilSetAsync(cancellationToken).ConfigureAwait(false); try { ReleaseAssert.AssertIfNot(this._PhysicalLogHandles.Remove(toClose.Id), "handle missing from _HandlesPL"); if ((this._PhysicalLogHandles.Count == 0) && (this._LogicalLogs.Count == 0)) { try { await this._Container.CloseAsync(cancellationToken).ConfigureAwait(false); } catch (Exception ex) { // // An exception is ok and shouldn't cause a failure // AppTrace.TraceSource.WriteInfo( "LogicalLog", "PhysicalLogClose: Exception {0}", ex.ToString()); } this.IsOpen = false; return(true); // Indicate last handle was closed } return(false); } finally { this._PhysicalLogLock.Set(); } }
internal static unsafe ContainerImageDescription CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, "ContainerImageDescription.CreateFromNative() has null pointer."); var nativeDescription = *((NativeTypes.FABRIC_CONTAINER_IMAGE_DESCRIPTION *)nativePtr); return(CreateFromNative(nativeDescription)); }
internal static unsafe ContainerDescription CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, "ContainerActivationArgs.CreateFromNative() has null pointer."); var nativeDescription = *((NativeTypes.FABRIC_CONTAINER_DESCRIPTION *)nativePtr); var containerDescription = new ContainerDescription { ApplicationName = NativeTypes.FromNativeString(nativeDescription.ApplicationName), ServiceName = NativeTypes.FromNativeString(nativeDescription.ServiceName), ApplicationId = NativeTypes.FromNativeString(nativeDescription.ApplicationId), ContainerName = NativeTypes.FromNativeString(nativeDescription.ContainerName), DeploymentFolder = NativeTypes.FromNativeString(nativeDescription.DeploymentFolder), NodeWorkFolder = NativeTypes.FromNativeString(nativeDescription.NodeWorkFolder), EntryPoint = NativeTypes.FromNativeString(nativeDescription.EntryPoint), HostName = NativeTypes.FromNativeString(nativeDescription.HostName), GroupContainerName = NativeTypes.FromNativeString(nativeDescription.GroupContainerName), IsolationMode = InteropHelpers.FromNativeContainerIsolationMode(nativeDescription.IsolationMode), PortBindings = NativeTypes.FromNativeStringPairList(nativeDescription.PortBindings), LogConfig = ContainerLogConfigDescription.CreateFromNative(nativeDescription.LogConfig), Volumes = ContainerVolumeDescription.CreateFromNative(nativeDescription.Volumes), DnsServers = NativeTypes.FromNativeStringList(nativeDescription.DnsServers), SecurityOptions = NativeTypes.FromNativeStringList(nativeDescription.SecurityOptions), RepositoryCredential = RepositoryCredentialDescription.CreateFromNative(nativeDescription.RepositoryCredential), HealthConfig = ContainerHealthConfigDescription.CreateFromNative(nativeDescription.HealthConfig), AutoRemove = NativeTypes.FromBOOLEAN(nativeDescription.AutoRemove), RunInteractive = NativeTypes.FromBOOLEAN(nativeDescription.RunInteractive), IsContainerRoot = NativeTypes.FromBOOLEAN(nativeDescription.IsContainerRoot), CodePackageName = NativeTypes.FromNativeString(nativeDescription.CodePackageName), ServicePackageActivationId = NativeTypes.FromNativeString(nativeDescription.ServicePackageActivationId), PartitionId = NativeTypes.FromNativeString(nativeDescription.PartitionId), }; if (nativeDescription.Reserved != null) { var nativeContainerDescriptionEx1 = *((NativeTypes.FABRIC_CONTAINER_DESCRIPTION_EX1 *)nativeDescription.Reserved); containerDescription.UseDefaultRepositoryCredentials = NativeTypes.FromBOOLEAN(nativeContainerDescriptionEx1.UseDefaultRepositoryCredentials); containerDescription.Labels = ContainerLabelDescription.CreateFromNative(nativeContainerDescriptionEx1.Labels); containerDescription.RemoveServiceFabricRuntimeAccess = NativeTypes.FromBOOLEAN(nativeContainerDescriptionEx1.RemoveServiceFabricRuntimeAccess); containerDescription.BindMounts = NativeTypes.FromNativeStringPairList(nativeContainerDescriptionEx1.BindMounts); if (nativeContainerDescriptionEx1.Reserved != null) { var nativeContainerDescriptionEx2 = *((NativeTypes.FABRIC_CONTAINER_DESCRIPTION_EX2 *)nativeContainerDescriptionEx1.Reserved); containerDescription.UseTokenAuthenticationCredentials = NativeTypes.FromBOOLEAN(nativeContainerDescriptionEx2.UseTokenAuthenticationCredentials); if (nativeContainerDescriptionEx2.Reserved != null) { var nativeContainerDescriptionEx3 = *((NativeTypes.FABRIC_CONTAINER_DESCRIPTION_EX3 *)nativeContainerDescriptionEx2.Reserved); containerDescription.ContainerNetworkConfig = ContainerNetworkConfigDescription.CreateFromNative(nativeContainerDescriptionEx3.ContainerNetworkConfigDescription); } } } return(containerDescription); }
public void OnChange(NativeClient.IFabricServiceManagementClient source, Int64 handlerId, NativeClient.IFabricResolvedServicePartitionResult partition, int error) { ReleaseAssert.AssertIfNot( object.ReferenceEquals(source, this.client.NativePropertyClient), "object.ReferenceEquals(source, this.client.NativePropertyClient)"); ServicePartitionResolutionChange args = ServicePartitionResolutionChange.FromNative(partition, error); this.callback(this.client, handlerId, args); }
internal static new unsafe ServicePlacementRequireDomainDistributionPolicyDescription CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, StringResources.Error_NullNativePointer); NativeTypes.FABRIC_PLACEMENT_POLICY_REQUIRED_DOMAIN_DISTRIBUTION_DESCRIPTION *casted = (NativeTypes.FABRIC_PLACEMENT_POLICY_REQUIRED_DOMAIN_DISTRIBUTION_DESCRIPTION *)nativePtr; var policy = new ServicePlacementRequireDomainDistributionPolicyDescription(); return(policy); }
internal static new unsafe ServicePlacementNonPartiallyPlaceServicePolicyDescription CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, StringResources.Error_NullNativePointer); NativeTypes.FABRIC_PLACEMENT_POLICY_NONPARTIALLY_PLACE_SERVICE_DESCRIPTION *CASTED = (NativeTypes.FABRIC_PLACEMENT_POLICY_NONPARTIALLY_PLACE_SERVICE_DESCRIPTION *)nativePtr; var policy = new ServicePlacementNonPartiallyPlaceServicePolicyDescription(); return(policy); }
public FabricValidatorBlackbird(ClusterManifestType clusterManifest, List <InfrastructureNodeType> infrastructureInformation, WindowsFabricSettings windowsFabricSettings) : base(clusterManifest, infrastructureInformation, windowsFabricSettings) { ReleaseAssert.AssertIf(clusterManifest == null, "clusterManifest should be non-null"); ReleaseAssert.AssertIfNot( clusterManifest.Infrastructure.Item is ClusterManifestTypeInfrastructureBlackbird, "Only ClusterManifestTypeInfrastructureBlackbird is supported by ServerDeployer"); this.IsScaleMin = infrastructureInformation != null && FabricValidatorUtility.IsNodeListScaleMin(this.infrastructureInformation); }
internal static new unsafe ServicePlacementPreferPrimaryDomainPolicyDescription CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, StringResources.Error_NullNativePointer); NativeTypes.FABRIC_PLACEMENT_POLICY_PREFERRED_PRIMARY_DOMAIN_DESCRIPTION *casted = (NativeTypes.FABRIC_PLACEMENT_POLICY_PREFERRED_PRIMARY_DOMAIN_DESCRIPTION *)nativePtr; var policy = new ServicePlacementPreferPrimaryDomainPolicyDescription(); policy.DomainName = NativeTypes.FromNativeString(casted->PreferredPrimaryFaultDomain); return(policy); }
internal static unsafe SecurityCredentials CreateFromNative(NativeRuntime.IFabricSecurityCredentialsResult securityCredentialsResult) { ReleaseAssert.AssertIfNot(securityCredentialsResult != null, string.Format(CultureInfo.CurrentCulture, StringResources.Error_NativeDataNull_Formatted, "SecurityCredentials")); ReleaseAssert.AssertIfNot(securityCredentialsResult.get_SecurityCredentials() != IntPtr.Zero, string.Format(CultureInfo.CurrentCulture, StringResources.Error_NativeDataNull_Formatted, "SecurityCredentialsResult.get_SecurityCredentials()")); NativeTypes.FABRIC_SECURITY_CREDENTIALS *nativeCredentials = (NativeTypes.FABRIC_SECURITY_CREDENTIALS *)securityCredentialsResult.get_SecurityCredentials(); SecurityCredentials managedCredentials = CreateFromNative(nativeCredentials); GC.KeepAlive(securityCredentialsResult); return(managedCredentials); }
internal static unsafe ContainerHealthConfigDescription CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, "ContainerActivationArgs.CreateFromNative() has null pointer."); var nativeDescription = *((NativeTypes.FABRIC_CONTAINER_HEALTH_CONFIG_DESCRIPTION *)nativePtr); return(new ContainerHealthConfigDescription { IncludeDockerHealthStatusInSystemHealthReport = NativeTypes.FromBOOLEAN(nativeDescription.IncludeDockerHealthStatusInSystemHealthReport), RestartContainerOnUnhealthyDockerHealthStatus = NativeTypes.FromBOOLEAN(nativeDescription.RestartContainerOnUnhealthyDockerHealthStatus) }); }
internal static unsafe UniformInt64RangePartitionSchemeDescription CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, StringResources.Error_NullNativePointer); NativeTypes.FABRIC_UNIFORM_INT64_RANGE_PARTITION_DESCRIPTION *casted = (NativeTypes.FABRIC_UNIFORM_INT64_RANGE_PARTITION_DESCRIPTION *)nativePtr; return(new UniformInt64RangePartitionSchemeDescription { HighKey = casted->HighKey, LowKey = casted->LowKey, PartitionCount = casted->PartitionCount, }); }
internal static unsafe ContainerLogConfigDescription CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot( nativePtr != IntPtr.Zero, "ContainerLogConfigDescription.CreateFromNative() has null pointer."); var nativeDescription = *((NativeTypes.FABRIC_CONTAINER_LOG_CONFIG_DESCRIPTION *)nativePtr); return(new ContainerLogConfigDescription { Driver = NativeTypes.FromNativeString(nativeDescription.Driver), DriverOpts = ContainerDriverOptionDescription.CreateFromNativeList(nativeDescription.DriverOpts) }); }
private async Task CompleteAndPersistBaselineStateAsync(StandAloneCluster cluster, CancellationToken cancellationToken) { /* For standalone scenarios, baseline upgrade is performed automatically by CM when cluster bootstraps. * No need to perform an upgrade again. Persist state and return. */ UpgradeOrchestrationTrace.TraceSource.WriteInfo(TraceType, "Baseline upgrade detected. Skipping actual upgrade and simply persisting state."); cluster.ClusterUpgradeCompleted(); ReleaseAssert.AssertIfNot(cluster.Pending == null, "cluster.Pending is not null after baseline upgrade completed. Investigate why cluster.Pending is not null."); UpgradeOrchestrationTrace.TraceSource.WriteInfo(TraceType, "State machine reports no pending upgrade. Status is reset."); cluster.Reset(); await this.storeManager.PersistClusterResourceAsync(Constants.ClusterReliableDictionaryKey, cluster, cancellationToken) .ConfigureAwait(false); }
internal static new unsafe NodeStartDescription CreateFromNative(IntPtr nativeRaw) { ReleaseAssert.AssertIfNot(nativeRaw != IntPtr.Zero, StringResources.Error_NullNativePointer); NativeTypes.FABRIC_NODE_START_DESCRIPTION native = *(NativeTypes.FABRIC_NODE_START_DESCRIPTION *)nativeRaw; Guid operationId = native.OperationId; string nodeName = NativeTypes.FromNativeString(native.NodeName); BigInteger nodeInstanceId = new BigInteger(native.NodeInstanceId); NodeStartDescription description = new NodeStartDescription(operationId, nodeName, nodeInstanceId); return(description); }
public static NativeClient.IFabricServicePartitionResolutionChangeHandler ToNative(FabricClient client, ServicePartitionResolutionChangeHandler callback) { ReleaseAssert.AssertIfNot(client != null, "client != null"); if (callback == null) { return(null); } else { var native = new ComFabricServicePartitionResolutionChangeHandler(client, callback); return(native); } }
internal static unsafe ContainerApiExecutionArgs CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, "ContainerApiExecutionArgs.CreateFromNative() has null pointer."); var nativeArgs = *((NativeTypes.FABRIC_CONTAINER_API_EXECUTION_ARGS *)nativePtr); return(new ContainerApiExecutionArgs { ContainerName = NativeTypes.FromNativeString(nativeArgs.ContainerName), HttpVerb = NativeTypes.FromNativeString(nativeArgs.HttpVerb), UriPath = NativeTypes.FromNativeString(nativeArgs.UriPath), ContentType = NativeTypes.FromNativeString(nativeArgs.ContentType), RequestBody = NativeTypes.FromNativeString(nativeArgs.RequestBody) }); }
internal static unsafe ContainerDeactivationArgs CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, "ContainerDeactivationArgs.CreateFromNative() has null pointer."); var nativeArgs = *((NativeTypes.FABRIC_CONTAINER_DEACTIVATION_ARGS *)nativePtr); return(new ContainerDeactivationArgs { ContainerName = NativeTypes.FromNativeString(nativeArgs.ContainerName), ConfiguredForAutoRemove = NativeTypes.FromBOOLEAN(nativeArgs.ConfiguredForAutoRemove), IsContainerRoot = NativeTypes.FromBOOLEAN(nativeArgs.IsContainerRoot), CgroupName = NativeTypes.FromNativeString(nativeArgs.CgroupName), IsGracefulDeactivation = NativeTypes.FromBOOLEAN(nativeArgs.IsGracefulDeactivation) }); }
internal static unsafe ServicePackageResourceGovernanceDescription CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot( nativePtr != IntPtr.Zero, "ServicePackageResourceGovernanceDescription.CreateFromNative() has null pointer."); var nativeDescription = *((NativeTypes.FABRIC_SERVICE_PACKAGE_RESOURCE_GOVERNANCE_DESCRIPTION *)nativePtr); return(new ServicePackageResourceGovernanceDescription { IsGoverned = NativeTypes.FromBOOLEAN(nativeDescription.IsGoverned), MemoryInMB = nativeDescription.MemoryInMB, CpuCores = nativeDescription.CpuCores, NotUsed = nativeDescription.NotUsed }); }