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.backup;
019
020import java.util.List;
021import org.apache.hadoop.hbase.TableName;
022import org.apache.yetus.audience.InterfaceAudience;
023
024/**
025 * POJO class for backup request
026 */
027@InterfaceAudience.Private
028public final class BackupRequest {
029
030  public static class Builder {
031
032    BackupRequest request;
033
034    public Builder() {
035      request = new BackupRequest();
036    }
037
038    public Builder withBackupType(BackupType type) {
039      request.setBackupType(type);
040      return this;
041    }
042
043    public Builder withTableList(List<TableName> tables) {
044      request.setTableList(tables);
045      return this;
046    }
047
048    public Builder withTargetRootDir(String backupDir) {
049      request.setTargetRootDir(backupDir);
050      return this;
051    }
052
053    public Builder withBackupSetName(String setName) {
054      request.setBackupSetName(setName);
055      return this;
056    }
057
058    public Builder withTotalTasks(int numTasks) {
059      request.setTotalTasks(numTasks);
060      return this;
061    }
062
063    public Builder withBandwidthPerTasks(int bandwidth) {
064      request.setBandwidth(bandwidth);
065      return this;
066    }
067
068    public Builder withNoChecksumVerify(boolean noChecksumVerify) {
069      request.setNoChecksumVerify(noChecksumVerify);
070      return this;
071    }
072
073    public Builder withYarnPoolName(String name) {
074      request.setYarnPoolName(name);
075      return this;
076    }
077
078    public BackupRequest build() {
079      return request;
080    }
081
082  }
083
084  private BackupType type;
085  private List<TableName> tableList;
086  private String targetRootDir;
087  private int totalTasks = -1;
088  private long bandwidth = -1L;
089  private boolean noChecksumVerify = false;
090  private String backupSetName;
091  private String yarnPoolName;
092
093  private BackupRequest() {
094  }
095
096  private BackupRequest setBackupType(BackupType type) {
097    this.type = type;
098    return this;
099  }
100
101  public BackupType getBackupType() {
102    return this.type;
103  }
104
105  private BackupRequest setTableList(List<TableName> tableList) {
106    this.tableList = tableList;
107    return this;
108  }
109
110  public List<TableName> getTableList() {
111    return this.tableList;
112  }
113
114  private BackupRequest setTargetRootDir(String targetRootDir) {
115    this.targetRootDir = targetRootDir;
116    return this;
117  }
118
119  public String getTargetRootDir() {
120    return this.targetRootDir;
121  }
122
123  private BackupRequest setTotalTasks(int totalTasks) {
124    this.totalTasks = totalTasks;
125    return this;
126  }
127
128  public int getTotalTasks() {
129    return this.totalTasks;
130  }
131
132  private BackupRequest setBandwidth(long bandwidth) {
133    this.bandwidth = bandwidth;
134    return this;
135  }
136
137  public long getBandwidth() {
138    return this.bandwidth;
139  }
140
141  private BackupRequest setNoChecksumVerify(boolean noChecksumVerify) {
142    this.noChecksumVerify = noChecksumVerify;
143    return this;
144  }
145
146  public boolean getNoChecksumVerify() {
147    return noChecksumVerify;
148  }
149
150  public String getBackupSetName() {
151    return backupSetName;
152  }
153
154  private BackupRequest setBackupSetName(String backupSetName) {
155    this.backupSetName = backupSetName;
156    return this;
157  }
158
159  public String getYarnPoolName() {
160    return yarnPoolName;
161  }
162
163  public void setYarnPoolName(String yarnPoolName) {
164    this.yarnPoolName = yarnPoolName;
165  }
166}