Search in sources :

Example 1 with TaskRelocationEvent

use of com.netflix.titus.api.relocation.model.event.TaskRelocationEvent in project titus-control-plane by Netflix.

the class RelocationGrpcModelConverters method toGrpcRelocationEvent.

public static Optional<RelocationEvent> toGrpcRelocationEvent(TaskRelocationEvent coreEvent) {
    RelocationEvent grpcEvent = null;
    if (coreEvent.equals(TaskRelocationEvent.newSnapshotEndEvent())) {
        grpcEvent = RelocationEvent.newBuilder().setSnapshotEnd(RelocationEvent.SnapshotEnd.getDefaultInstance()).build();
    } else if (coreEvent instanceof TaskRelocationPlanUpdateEvent) {
        TaskRelocationPlanUpdateEvent updateEvent = (TaskRelocationPlanUpdateEvent) coreEvent;
        grpcEvent = RelocationEvent.newBuilder().setTaskRelocationPlanUpdateEvent(RelocationEvent.TaskRelocationPlanUpdateEvent.newBuilder().setPlan(toGrpcTaskRelocationPlan(updateEvent.getPlan()))).build();
    } else if (coreEvent instanceof TaskRelocationPlanRemovedEvent) {
        TaskRelocationPlanRemovedEvent removedEvent = (TaskRelocationPlanRemovedEvent) coreEvent;
        grpcEvent = RelocationEvent.newBuilder().setTaskRelocationPlanRemoveEvent(RelocationEvent.TaskRelocationPlanRemoveEvent.newBuilder().setTaskId(removedEvent.getTaskId())).build();
    }
    return Optional.ofNullable(grpcEvent);
}
Also used : TaskRelocationPlanRemovedEvent(com.netflix.titus.api.relocation.model.event.TaskRelocationPlanRemovedEvent) TaskRelocationEvent(com.netflix.titus.api.relocation.model.event.TaskRelocationEvent) RelocationEvent(com.netflix.titus.grpc.protogen.RelocationEvent) TaskRelocationPlanUpdateEvent(com.netflix.titus.api.relocation.model.event.TaskRelocationPlanUpdateEvent)

Aggregations

TaskRelocationEvent (com.netflix.titus.api.relocation.model.event.TaskRelocationEvent)1 TaskRelocationPlanRemovedEvent (com.netflix.titus.api.relocation.model.event.TaskRelocationPlanRemovedEvent)1 TaskRelocationPlanUpdateEvent (com.netflix.titus.api.relocation.model.event.TaskRelocationPlanUpdateEvent)1 RelocationEvent (com.netflix.titus.grpc.protogen.RelocationEvent)1