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 Builder withContinuousBackupEnabled(boolean continuousBackupEnabled) { 079 request.setContinuousBackupEnabled(continuousBackupEnabled); 080 return this; 081 } 082 083 public BackupRequest build() { 084 return request; 085 } 086 087 } 088 089 private BackupType type; 090 private List<TableName> tableList; 091 private String targetRootDir; 092 private int totalTasks = -1; 093 private long bandwidth = -1L; 094 private boolean noChecksumVerify = false; 095 private String backupSetName; 096 private String yarnPoolName; 097 private boolean continuousBackupEnabled; 098 099 private BackupRequest() { 100 } 101 102 private BackupRequest setBackupType(BackupType type) { 103 this.type = type; 104 return this; 105 } 106 107 public BackupType getBackupType() { 108 return this.type; 109 } 110 111 private BackupRequest setTableList(List<TableName> tableList) { 112 this.tableList = tableList; 113 return this; 114 } 115 116 public List<TableName> getTableList() { 117 return this.tableList; 118 } 119 120 private BackupRequest setTargetRootDir(String targetRootDir) { 121 this.targetRootDir = targetRootDir; 122 return this; 123 } 124 125 public String getTargetRootDir() { 126 return this.targetRootDir; 127 } 128 129 private BackupRequest setTotalTasks(int totalTasks) { 130 this.totalTasks = totalTasks; 131 return this; 132 } 133 134 public int getTotalTasks() { 135 return this.totalTasks; 136 } 137 138 private BackupRequest setBandwidth(long bandwidth) { 139 this.bandwidth = bandwidth; 140 return this; 141 } 142 143 public long getBandwidth() { 144 return this.bandwidth; 145 } 146 147 private BackupRequest setNoChecksumVerify(boolean noChecksumVerify) { 148 this.noChecksumVerify = noChecksumVerify; 149 return this; 150 } 151 152 public boolean getNoChecksumVerify() { 153 return noChecksumVerify; 154 } 155 156 public String getBackupSetName() { 157 return backupSetName; 158 } 159 160 private BackupRequest setBackupSetName(String backupSetName) { 161 this.backupSetName = backupSetName; 162 return this; 163 } 164 165 public String getYarnPoolName() { 166 return yarnPoolName; 167 } 168 169 public void setYarnPoolName(String yarnPoolName) { 170 this.yarnPoolName = yarnPoolName; 171 } 172 173 private void setContinuousBackupEnabled(boolean continuousBackupEnabled) { 174 this.continuousBackupEnabled = continuousBackupEnabled; 175 } 176 177 public boolean isContinuousBackupEnabled() { 178 return this.continuousBackupEnabled; 179 } 180}