@Override public void handlePatch(Operation patchOperation) { ServiceUtils.logInfo(this, "Handling patch for service %s", getSelfLink()); State currentState = getState(patchOperation); State patchState = patchOperation.getBody(State.class); ValidationUtils.validatePatch(currentState, patchState); PatchUtils.patchState(currentState, patchState); ValidationUtils.validateState(currentState); patchOperation.complete(); }
@Override public void handlePatch(Operation patch) { ServiceUtils.logInfo(this, "Handling patch for service %s", getSelfLink()); KubernetesClusterCreateTask currentState = getState(patch); KubernetesClusterCreateTask patchState = patch.getBody(KubernetesClusterCreateTask.class); validatePatchState(currentState, patchState); PatchUtils.patchState(currentState, patchState); validateStartState(currentState); patch.complete(); try { if (ControlFlags.isOperationProcessingDisabled(currentState.controlFlags)) { ServiceUtils.logInfo(this, "Skipping patch handling (disabled)"); } else if (TaskState.TaskStage.STARTED == currentState.taskState.stage) { processStateMachine(currentState); } } catch (Throwable t) { failTask(t); } }
/** * This method applies a patch to a state object. * * @param current Supplies the start state object. * @param patch Supplies the patch state object. */ private State applyPatch(State current, State patch) { PatchUtils.patchState(current, patch); return current; }