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