Ejemplo n.º 1
0
        private static RepairTask CreateFromScope(RepairScopeIdentifier scope)
        {
            switch (scope.Kind)
            {
            case RepairScopeIdentifierKind.Cluster:
                return(new ClusterRepairTask());

            default:
                return(new RepairTask(scope));
            }
        }
Ejemplo n.º 2
0
        internal RepairTask(RepairScopeIdentifier scope, string taskId, string action)
        {
            Requires.Argument("scope", scope).NotNull();
            Requires.Argument("taskId", taskId).NotNullOrEmpty();
            Requires.Argument("action", action).NotNullOrEmpty();

            this.Scope  = scope;
            this.TaskId = taskId;
            this.State  = RepairTaskState.Created;
            this.Action = action;
        }
Ejemplo n.º 3
0
 internal RepairTaskQueryDescription(
     RepairScopeIdentifier scope,
     string taskIdFilter,
     RepairTaskStateFilter stateFilter,
     string executorFilter)
 {
     this.Scope          = scope;
     this.TaskIdFilter   = taskIdFilter;
     this.StateFilter    = stateFilter;
     this.ExecutorFilter = executorFilter;
 }
 internal RepairTaskHealthPolicyUpdateDescription(
     RepairScopeIdentifier scope,
     string taskId,
     Int64 version,
     bool?performPreparingHealthCheck,
     bool?performRestoringHealthCheck)
 {
     this.Scope   = scope;
     this.TaskId  = taskId;
     this.Version = version;
     this.PerformPreparingHealthCheck = performPreparingHealthCheck;
     this.PerformRestoringHealthCheck = performRestoringHealthCheck;
 }
Ejemplo n.º 5
0
        internal static unsafe RepairTask FromNative(NativeTypes.FABRIC_REPAIR_TASK *casted)
        {
            RepairScopeIdentifier scope   = RepairScopeIdentifier.CreateFromNative(casted->Scope);
            RepairTask            managed = CreateFromScope(scope);

            managed.TaskId      = NativeTypes.FromNativeString(casted->TaskId);
            managed.Version     = casted->Version;
            managed.Description = NativeTypes.FromNativeString(casted->Description);
            managed.State       = (RepairTaskState)casted->State;
            managed.Flags       = (RepairTaskFlags)casted->Flags;
            managed.Action      = NativeTypes.FromNativeString(casted->Action);

            managed.Target = RepairTargetDescription.CreateFromNative(casted->Target);
            managed.Impact = RepairImpactDescription.CreateFromNative(casted->Impact);

            if (casted->ExecutorState != IntPtr.Zero)
            {
                var nativeExecutorState = (NativeTypes.FABRIC_REPAIR_EXECUTOR_STATE *)casted->ExecutorState;

                managed.Executor     = NativeTypes.FromNativeString(nativeExecutorState->Executor);
                managed.ExecutorData = NativeTypes.FromNativeString(nativeExecutorState->ExecutorData);
            }

            if (casted->Result != IntPtr.Zero)
            {
                var nativeResult = (NativeTypes.FABRIC_REPAIR_RESULT_DESCRIPTION *)casted->Result;

                managed.ResultStatus  = (RepairTaskResult)nativeResult->ResultStatus;
                managed.ResultCode    = nativeResult->ResultCode;
                managed.ResultDetails = NativeTypes.FromNativeString(nativeResult->ResultDetails);
            }

            if (casted->History != IntPtr.Zero)
            {
                var nativeHistory = (NativeTypes.FABRIC_REPAIR_TASK_HISTORY *)casted->History;

                managed.CreatedTimestamp   = NativeTypes.FromNullableNativeFILETIME(nativeHistory->CreatedUtcTimestamp);
                managed.ClaimedTimestamp   = NativeTypes.FromNullableNativeFILETIME(nativeHistory->ClaimedUtcTimestamp);
                managed.PreparingTimestamp = NativeTypes.FromNullableNativeFILETIME(nativeHistory->PreparingUtcTimestamp);
                managed.ApprovedTimestamp  = NativeTypes.FromNullableNativeFILETIME(nativeHistory->ApprovedUtcTimestamp);
                managed.ExecutingTimestamp = NativeTypes.FromNullableNativeFILETIME(nativeHistory->ExecutingUtcTimestamp);
                managed.RestoringTimestamp = NativeTypes.FromNullableNativeFILETIME(nativeHistory->RestoringUtcTimestamp);
                managed.CompletedTimestamp = NativeTypes.FromNullableNativeFILETIME(nativeHistory->CompletedUtcTimestamp);

                if (nativeHistory->Reserved != IntPtr.Zero)
                {
                    var ex1 = (NativeTypes.FABRIC_REPAIR_TASK_HISTORY_EX1 *)nativeHistory->Reserved;

                    managed.PreparingHealthCheckStartTimestamp =
                        NativeTypes.FromNullableNativeFILETIME(ex1->PreparingHealthCheckStartUtcTimestamp);
                    managed.PreparingHealthCheckEndTimestamp =
                        NativeTypes.FromNullableNativeFILETIME(ex1->PreparingHealthCheckEndUtcTimestamp);
                    managed.RestoringHealthCheckStartTimestamp =
                        NativeTypes.FromNullableNativeFILETIME(ex1->RestoringHealthCheckStartUtcTimestamp);
                    managed.RestoringHealthCheckEndTimestamp =
                        NativeTypes.FromNullableNativeFILETIME(ex1->RestoringHealthCheckEndUtcTimestamp);
                }
            }

            if (casted->Reserved != IntPtr.Zero)
            {
                var ex1 = (NativeTypes.FABRIC_REPAIR_TASK_EX1 *)casted->Reserved;

                managed.PreparingHealthCheckState   = (RepairTaskHealthCheckState)ex1->PreparingHealthCheckState;
                managed.RestoringHealthCheckState   = (RepairTaskHealthCheckState)ex1->RestoringHealthCheckState;
                managed.PerformPreparingHealthCheck = NativeTypes.FromBOOLEAN(ex1->PerformPreparingHealthCheck);
                managed.PerformRestoringHealthCheck = NativeTypes.FromBOOLEAN(ex1->PerformRestoringHealthCheck);
            }

            return(managed);
        }
Ejemplo n.º 6
0
 internal RepairTask(RepairScopeIdentifier scope)
 {
     Requires.Argument("scope", scope).NotNull();
     this.Scope = scope;
 }