001/** 002 * Licensed to the Apache Software Foundation (ASF) under one or more contributor license 003 * agreements. See the NOTICE file distributed with this work for additional information regarding 004 * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the 005 * "License"); you may not use this file except in compliance with the License. You may obtain a 006 * copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable 007 * law or agreed to in writing, software distributed under the License is distributed on an "AS IS" 008 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License 009 * for the specific language governing permissions and limitations under the License. 010 */ 011package org.apache.hadoop.hbase.replication; 012 013import org.apache.yetus.audience.InterfaceAudience; 014 015/** 016 * A HBase ReplicationLoad to present MetricsSource information 017 */ 018@InterfaceAudience.Public 019public class ReplicationLoadSource { 020 private final String peerID; 021 private final long ageOfLastShippedOp; 022 private final int sizeOfLogQueue; 023 private final long timestampOfLastShippedOp; 024 private final long replicationLag; 025 026 // TODO: add the builder for this class 027 @InterfaceAudience.Private 028 public ReplicationLoadSource(String id, long age, int size, long timestamp, long lag) { 029 this.peerID = id; 030 this.ageOfLastShippedOp = age; 031 this.sizeOfLogQueue = size; 032 this.timestampOfLastShippedOp = timestamp; 033 this.replicationLag = lag; 034 } 035 036 public String getPeerID() { 037 return this.peerID; 038 } 039 040 public long getAgeOfLastShippedOp() { 041 return this.ageOfLastShippedOp; 042 } 043 044 public long getSizeOfLogQueue() { 045 return this.sizeOfLogQueue; 046 } 047 048 /** 049 * @deprecated Since 2.0.0. Will be removed in 3.0.0. 050 * @see #getTimestampOfLastShippedOp() 051 */ 052 @Deprecated 053 public long getTimeStampOfLastShippedOp() { 054 return getTimestampOfLastShippedOp(); 055 } 056 057 public long getTimestampOfLastShippedOp() { 058 return this.timestampOfLastShippedOp; 059 } 060 061 public long getReplicationLag() { 062 return this.replicationLag; 063 } 064}