001/*
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *     http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019
020package org.apache.hadoop.hbase.namequeues.request;
021
022import org.apache.commons.lang3.builder.ToStringBuilder;
023import org.apache.hadoop.hbase.namequeues.NamedQueuePayload;
024import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos;
025import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos;
026import org.apache.yetus.audience.InterfaceAudience;
027
028/**
029 * Request object to be used by ring buffer use-cases. Clients get records by sending
030 * this request object.
031 * For each ring buffer use-case, add request payload to this class, client should set
032 * namedQueueEvent based on use-case.
033 * Protobuf does not support inheritance, hence we need to work with
034 */
035@InterfaceAudience.Private
036public class NamedQueueGetRequest {
037
038  private AdminProtos.SlowLogResponseRequest slowLogResponseRequest;
039  private NamedQueuePayload.NamedQueueEvent namedQueueEvent;
040  private MasterProtos.BalancerDecisionsRequest balancerDecisionsRequest;
041
042  public AdminProtos.SlowLogResponseRequest getSlowLogResponseRequest() {
043    return slowLogResponseRequest;
044  }
045
046  public void setSlowLogResponseRequest(
047      AdminProtos.SlowLogResponseRequest slowLogResponseRequest) {
048    this.slowLogResponseRequest = slowLogResponseRequest;
049  }
050
051  public MasterProtos.BalancerDecisionsRequest getBalancerDecisionsRequest() {
052    return balancerDecisionsRequest;
053  }
054
055  public void setBalancerDecisionsRequest(
056      MasterProtos.BalancerDecisionsRequest balancerDecisionsRequest) {
057    this.balancerDecisionsRequest = balancerDecisionsRequest;
058  }
059
060  public NamedQueuePayload.NamedQueueEvent getNamedQueueEvent() {
061    return namedQueueEvent;
062  }
063
064  public void setNamedQueueEvent(int eventOrdinal) {
065    this.namedQueueEvent = NamedQueuePayload.NamedQueueEvent.getEventByOrdinal(eventOrdinal);
066  }
067
068  @Override
069  public String toString() {
070    return new ToStringBuilder(this)
071      .append("slowLogResponseRequest", slowLogResponseRequest)
072      .append("namedQueueEvent", namedQueueEvent)
073      .append("balancerDecisionsRequest", balancerDecisionsRequest)
074      .toString();
075  }
076}