/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.presto.server;
import com.facebook.presto.OutputBuffers;
import com.facebook.presto.SessionRepresentation;
import com.facebook.presto.TaskSource;
import com.facebook.presto.sql.planner.PlanFragment;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableList;
import java.util.List;
import java.util.Optional;
import static com.google.common.base.MoreObjects.toStringHelper;
import static java.util.Objects.requireNonNull;
public class TaskUpdateRequest
{
private final SessionRepresentation session;
private final Optional<PlanFragment> fragment;
private final List<TaskSource> sources;
private final OutputBuffers outputIds;
@JsonCreator
public TaskUpdateRequest(
@JsonProperty("session") SessionRepresentation session,
@JsonProperty("fragment") Optional<PlanFragment> fragment,
@JsonProperty("sources") List<TaskSource> sources,
@JsonProperty("outputIds") OutputBuffers outputIds)
{
requireNonNull(session, "session is null");
requireNonNull(fragment, "fragment is null");
requireNonNull(sources, "sources is null");
requireNonNull(outputIds, "outputIds is null");
this.session = session;
this.fragment = fragment;
this.sources = ImmutableList.copyOf(sources);
this.outputIds = outputIds;
}
@JsonProperty
public SessionRepresentation getSession()
{
return session;
}
@JsonProperty
public Optional<PlanFragment> getFragment()
{
return fragment;
}
@JsonProperty
public List<TaskSource> getSources()
{
return sources;
}
@JsonProperty
public OutputBuffers getOutputIds()
{
return outputIds;
}
@Override
public String toString()
{
return toStringHelper(this)
.add("session", session)
.add("fragment", fragment)
.add("sources", sources)
.add("outputIds", outputIds)
.toString();
}
}