コード例 #1
0
        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);
        }
コード例 #2
0
        NativeCommon.IFabricAsyncOperationContext NativeContainerActivatorService.IFabricContainerActivatorService.BeginActivateContainer(
            IntPtr activationParams,
            uint timeoutMilliseconds,
            NativeCommon.IFabricAsyncOperationCallback callback)
        {
            var activationArgs = ContainerActivationArgs.CreateFromNative(activationParams);
            var timeout        = TimeSpan.FromMilliseconds(timeoutMilliseconds);

            return(Utility.WrapNativeAsyncMethodImplementation(
                       (cancellationToken) => this.activatorService.ActivateContainerAsync(activationArgs, timeout),
                       callback,
                       "FabricContainerActivatorServiceBroker.ActivateContainerAsync",
                       ValidateAsyncApi));
        }