Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        internal static unsafe NodeTransitionDescription CreateFromNative(IntPtr native)
        {
            ReleaseAssert.AssertIfNot(native != IntPtr.Zero, StringResources.Error_NullNativePointer);

            NativeTypes.FABRIC_NODE_TRANSITION_DESCRIPTION *casted = (NativeTypes.FABRIC_NODE_TRANSITION_DESCRIPTION *)native;
            switch (casted->NodeTransitionType)
            {
            case NativeTypes.FABRIC_NODE_TRANSITION_TYPE.FABRIC_NODE_TRANSITION_TYPE_START:
                return(NodeStartDescription.CreateFromNative(casted->Value));

            case NativeTypes.FABRIC_NODE_TRANSITION_TYPE.FABRIC_NODE_TRANSITION_TYPE_STOP:
                return(NodeStopDescription.CreateFromNative(casted->Value));

            default:
                AppTrace.TraceSource.WriteError("NodeTransitionDescription.CreateFromNative", "Unknown node transition description type {0}", casted->NodeTransitionType);

                ReleaseAssert.Failfast(string.Format(CultureInfo.CurrentCulture, StringResources.Error_UnknownNodeTransitionType, casted->NodeTransitionType));
                break;
            }

            return(null);
        }