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.replication;
019
020import org.apache.yetus.audience.InterfaceAudience;
021
022/**
023 * A HBase ReplicationLoad to present MetricsSink information
024 */
025@InterfaceAudience.Public
026public class ReplicationLoadSink {
027  private final long ageOfLastAppliedOp;
028  private final long timestampsOfLastAppliedOp;
029  private final long timestampStarted;
030  private final long totalOpsProcessed;
031
032  private ReplicationLoadSink(long age, long timestamp, long timestampStarted,
033    long totalOpsProcessed) {
034    this.ageOfLastAppliedOp = age;
035    this.timestampsOfLastAppliedOp = timestamp;
036    this.timestampStarted = timestampStarted;
037    this.totalOpsProcessed = totalOpsProcessed;
038  }
039
040  public long getAgeOfLastAppliedOp() {
041    return this.ageOfLastAppliedOp;
042  }
043
044  public long getTimestampsOfLastAppliedOp() {
045    return this.timestampsOfLastAppliedOp;
046  }
047
048  public long getTimestampStarted() {
049    return timestampStarted;
050  }
051
052  public long getTotalOpsProcessed() {
053    return totalOpsProcessed;
054  }
055
056  @InterfaceAudience.Private
057  public static ReplicationLoadSinkBuilder newBuilder() {
058    return new ReplicationLoadSinkBuilder();
059  }
060
061  @InterfaceAudience.Private
062  public static final class ReplicationLoadSinkBuilder {
063    private long ageOfLastAppliedOp;
064    private long timestampsOfLastAppliedOp;
065    private long timestampStarted;
066    private long totalOpsProcessed;
067
068    private ReplicationLoadSinkBuilder() {
069    }
070
071    public ReplicationLoadSinkBuilder setAgeOfLastAppliedOp(long ageOfLastAppliedOp) {
072      this.ageOfLastAppliedOp = ageOfLastAppliedOp;
073      return this;
074    }
075
076    public ReplicationLoadSinkBuilder setTimestampsOfLastAppliedOp(long timestampsOfLastAppliedOp) {
077      this.timestampsOfLastAppliedOp = timestampsOfLastAppliedOp;
078      return this;
079    }
080
081    public ReplicationLoadSinkBuilder setTimestampStarted(long timestampStarted) {
082      this.timestampStarted = timestampStarted;
083      return this;
084    }
085
086    public ReplicationLoadSinkBuilder setTotalOpsProcessed(long totalOpsProcessed) {
087      this.totalOpsProcessed = totalOpsProcessed;
088      return this;
089    }
090
091    public ReplicationLoadSink build() {
092      return new ReplicationLoadSink(ageOfLastAppliedOp, timestampsOfLastAppliedOp,
093        timestampStarted, totalOpsProcessed);
094    }
095  }
096}