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.client;
019
020import java.util.EnumSet;
021import java.util.List;
022import java.util.Map;
023import java.util.Optional;
024import java.util.Set;
025import java.util.concurrent.CompletableFuture;
026import java.util.concurrent.ExecutorService;
027import java.util.function.Function;
028import java.util.regex.Pattern;
029import org.apache.hadoop.hbase.CacheEvictionStats;
030import org.apache.hadoop.hbase.ClusterMetrics;
031import org.apache.hadoop.hbase.ClusterMetrics.Option;
032import org.apache.hadoop.hbase.NamespaceDescriptor;
033import org.apache.hadoop.hbase.RegionMetrics;
034import org.apache.hadoop.hbase.ServerName;
035import org.apache.hadoop.hbase.TableName;
036import org.apache.hadoop.hbase.client.replication.TableCFs;
037import org.apache.hadoop.hbase.client.security.SecurityCapability;
038import org.apache.hadoop.hbase.net.Address;
039import org.apache.hadoop.hbase.quotas.QuotaFilter;
040import org.apache.hadoop.hbase.quotas.QuotaSettings;
041import org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot;
042import org.apache.hadoop.hbase.replication.ReplicationPeerConfig;
043import org.apache.hadoop.hbase.replication.ReplicationPeerDescription;
044import org.apache.hadoop.hbase.replication.SyncReplicationState;
045import org.apache.hadoop.hbase.rsgroup.RSGroupInfo;
046import org.apache.hadoop.hbase.security.access.GetUserPermissionsRequest;
047import org.apache.hadoop.hbase.security.access.Permission;
048import org.apache.hadoop.hbase.security.access.UserPermission;
049import org.apache.hadoop.hbase.util.FutureUtils;
050import org.apache.hadoop.hbase.util.Pair;
051import org.apache.yetus.audience.InterfaceAudience;
052
053import org.apache.hbase.thirdparty.com.google.protobuf.RpcChannel;
054
055/**
056 * Just a wrapper of {@link RawAsyncHBaseAdmin}. The difference is that users need to provide a
057 * thread pool when constructing this class, and the callback methods registered to the returned
058 * {@link CompletableFuture} will be executed in this thread pool. So usually it is safe for users
059 * to do anything they want in the callbacks without breaking the rpc framework.
060 * @since 2.0.0
061 * @see RawAsyncHBaseAdmin
062 * @see AsyncConnection#getAdmin(ExecutorService)
063 * @see AsyncConnection#getAdminBuilder(ExecutorService)
064 */
065@InterfaceAudience.Private
066class AsyncHBaseAdmin implements AsyncAdmin {
067
068  private final RawAsyncHBaseAdmin rawAdmin;
069
070  private final ExecutorService pool;
071
072  AsyncHBaseAdmin(RawAsyncHBaseAdmin rawAdmin, ExecutorService pool) {
073    this.rawAdmin = rawAdmin;
074    this.pool = pool;
075  }
076
077  private <T> CompletableFuture<T> wrap(CompletableFuture<T> future) {
078    return FutureUtils.wrapFuture(future, pool);
079  }
080
081  @Override
082  public CompletableFuture<Boolean> tableExists(TableName tableName) {
083    return wrap(rawAdmin.tableExists(tableName));
084  }
085
086  @Override
087  public CompletableFuture<List<TableDescriptor>> listTableDescriptors(boolean includeSysTables) {
088    return wrap(rawAdmin.listTableDescriptors(includeSysTables));
089  }
090
091  @Override
092  public CompletableFuture<List<TableDescriptor>> listTableDescriptors(Pattern pattern,
093      boolean includeSysTables) {
094    return wrap(rawAdmin.listTableDescriptors(pattern, includeSysTables));
095  }
096
097  @Override
098  public CompletableFuture<List<TableDescriptor>> listTableDescriptors(List<TableName> tableNames) {
099    return wrap(rawAdmin.listTableDescriptors(tableNames));
100  }
101
102  @Override
103  public CompletableFuture<List<TableDescriptor>> listTableDescriptorsByNamespace(String name) {
104    return wrap(rawAdmin.listTableDescriptorsByNamespace(name));
105  }
106
107  @Override
108  public CompletableFuture<List<TableName>> listTableNames(boolean includeSysTables) {
109    return wrap(rawAdmin.listTableNames(includeSysTables));
110  }
111
112  @Override
113  public CompletableFuture<List<TableName>> listTableNames(Pattern pattern,
114      boolean includeSysTables) {
115    return wrap(rawAdmin.listTableNames(pattern, includeSysTables));
116  }
117
118  @Override
119  public CompletableFuture<List<TableName>> listTableNamesByNamespace(String name) {
120    return wrap(rawAdmin.listTableNamesByNamespace(name));
121  }
122
123  @Override
124  public CompletableFuture<TableDescriptor> getDescriptor(TableName tableName) {
125    return wrap(rawAdmin.getDescriptor(tableName));
126  }
127
128  @Override
129  public CompletableFuture<Void> createTable(TableDescriptor desc) {
130    return wrap(rawAdmin.createTable(desc));
131  }
132
133  @Override
134  public CompletableFuture<Void> createTable(TableDescriptor desc, byte[] startKey, byte[] endKey,
135      int numRegions) {
136    return wrap(rawAdmin.createTable(desc, startKey, endKey, numRegions));
137  }
138
139  @Override
140  public CompletableFuture<Void> createTable(TableDescriptor desc, byte[][] splitKeys) {
141    return wrap(rawAdmin.createTable(desc, splitKeys));
142  }
143
144  @Override
145  public CompletableFuture<Void> modifyTable(TableDescriptor desc) {
146    return wrap(rawAdmin.modifyTable(desc));
147  }
148
149  @Override
150  public CompletableFuture<Void> deleteTable(TableName tableName) {
151    return wrap(rawAdmin.deleteTable(tableName));
152  }
153
154  @Override
155  public CompletableFuture<Void> truncateTable(TableName tableName, boolean preserveSplits) {
156    return wrap(rawAdmin.truncateTable(tableName, preserveSplits));
157  }
158
159  @Override
160  public CompletableFuture<Void> enableTable(TableName tableName) {
161    return wrap(rawAdmin.enableTable(tableName));
162  }
163
164  @Override
165  public CompletableFuture<Void> disableTable(TableName tableName) {
166    return wrap(rawAdmin.disableTable(tableName));
167  }
168
169  @Override
170  public CompletableFuture<Boolean> isTableEnabled(TableName tableName) {
171    return wrap(rawAdmin.isTableEnabled(tableName));
172  }
173
174  @Override
175  public CompletableFuture<Boolean> isTableDisabled(TableName tableName) {
176    return wrap(rawAdmin.isTableDisabled(tableName));
177  }
178
179  @Override
180  public CompletableFuture<Boolean> isTableAvailable(TableName tableName) {
181    return wrap(rawAdmin.isTableAvailable(tableName));
182  }
183
184  @Override
185  public CompletableFuture<Void> addColumnFamily(TableName tableName,
186      ColumnFamilyDescriptor columnFamily) {
187    return wrap(rawAdmin.addColumnFamily(tableName, columnFamily));
188  }
189
190  @Override
191  public CompletableFuture<Void> deleteColumnFamily(TableName tableName, byte[] columnFamily) {
192    return wrap(rawAdmin.deleteColumnFamily(tableName, columnFamily));
193  }
194
195  @Override
196  public CompletableFuture<Void> modifyColumnFamily(TableName tableName,
197      ColumnFamilyDescriptor columnFamily) {
198    return wrap(rawAdmin.modifyColumnFamily(tableName, columnFamily));
199  }
200
201  @Override
202  public CompletableFuture<Void> createNamespace(NamespaceDescriptor descriptor) {
203    return wrap(rawAdmin.createNamespace(descriptor));
204  }
205
206  @Override
207  public CompletableFuture<Void> modifyNamespace(NamespaceDescriptor descriptor) {
208    return wrap(rawAdmin.modifyNamespace(descriptor));
209  }
210
211  @Override
212  public CompletableFuture<Void> deleteNamespace(String name) {
213    return wrap(rawAdmin.deleteNamespace(name));
214  }
215
216  @Override
217  public CompletableFuture<NamespaceDescriptor> getNamespaceDescriptor(String name) {
218    return wrap(rawAdmin.getNamespaceDescriptor(name));
219  }
220
221  @Override
222  public CompletableFuture<List<String>> listNamespaces() {
223    return wrap(rawAdmin.listNamespaces());
224  }
225
226  @Override
227  public CompletableFuture<List<NamespaceDescriptor>> listNamespaceDescriptors() {
228    return wrap(rawAdmin.listNamespaceDescriptors());
229  }
230
231  @Override
232  public CompletableFuture<List<RegionInfo>> getRegions(ServerName serverName) {
233    return wrap(rawAdmin.getRegions(serverName));
234  }
235
236  @Override
237  public CompletableFuture<List<RegionInfo>> getRegions(TableName tableName) {
238    return wrap(rawAdmin.getRegions(tableName));
239  }
240
241  @Override
242  public CompletableFuture<Void> flush(TableName tableName) {
243    return wrap(rawAdmin.flush(tableName));
244  }
245
246  @Override
247  public CompletableFuture<Void> flush(TableName tableName, byte[] columnFamily) {
248    return wrap(rawAdmin.flush(tableName, columnFamily));
249  }
250
251  @Override
252  public CompletableFuture<Void> flushRegion(byte[] regionName) {
253    return wrap(rawAdmin.flushRegion(regionName));
254  }
255
256  @Override
257  public CompletableFuture<Void> flushRegion(byte[] regionName, byte[] columnFamily) {
258    return wrap(rawAdmin.flushRegion(regionName, columnFamily));
259  }
260
261  @Override
262  public CompletableFuture<Void> flushRegionServer(ServerName sn) {
263    return wrap(rawAdmin.flushRegionServer(sn));
264  }
265
266  @Override
267  public CompletableFuture<Void> compact(TableName tableName,
268      CompactType compactType) {
269    return wrap(rawAdmin.compact(tableName, compactType));
270  }
271
272  @Override
273  public CompletableFuture<Void> compact(TableName tableName,
274      byte[] columnFamily, CompactType compactType) {
275    return wrap(rawAdmin.compact(tableName, columnFamily, compactType));
276  }
277
278  @Override
279  public CompletableFuture<Void> compactRegion(byte[] regionName) {
280    return wrap(rawAdmin.compactRegion(regionName));
281  }
282
283  @Override
284  public CompletableFuture<Void> compactRegion(byte[] regionName, byte[] columnFamily) {
285    return wrap(rawAdmin.compactRegion(regionName, columnFamily));
286  }
287
288  @Override
289  public CompletableFuture<Void> majorCompact(TableName tableName, CompactType compactType) {
290    return wrap(rawAdmin.majorCompact(tableName, compactType));
291  }
292
293  @Override
294  public CompletableFuture<Void> majorCompact(TableName tableName, byte[] columnFamily,
295      CompactType compactType) {
296    return wrap(rawAdmin.majorCompact(tableName, columnFamily, compactType));
297  }
298
299  @Override
300  public CompletableFuture<Void> majorCompactRegion(byte[] regionName) {
301    return wrap(rawAdmin.majorCompactRegion(regionName));
302  }
303
304  @Override
305  public CompletableFuture<Void> majorCompactRegion(byte[] regionName, byte[] columnFamily) {
306    return wrap(rawAdmin.majorCompactRegion(regionName, columnFamily));
307  }
308
309  @Override
310  public CompletableFuture<Void> compactRegionServer(ServerName serverName) {
311    return wrap(rawAdmin.compactRegionServer(serverName));
312  }
313
314  @Override
315  public CompletableFuture<Void> majorCompactRegionServer(ServerName serverName) {
316    return wrap(rawAdmin.majorCompactRegionServer(serverName));
317  }
318
319  @Override
320  public CompletableFuture<Boolean> mergeSwitch(boolean enabled, boolean drainMerges) {
321    return wrap(rawAdmin.mergeSwitch(enabled, drainMerges));
322  }
323
324  @Override
325  public CompletableFuture<Boolean> isMergeEnabled() {
326    return wrap(rawAdmin.isMergeEnabled());
327  }
328
329  @Override
330  public CompletableFuture<Boolean> splitSwitch(boolean enabled, boolean drainSplits) {
331    return wrap(rawAdmin.splitSwitch(enabled, drainSplits));
332  }
333
334  @Override
335  public CompletableFuture<Boolean> isSplitEnabled() {
336    return wrap(rawAdmin.isSplitEnabled());
337  }
338
339  @Override
340  public CompletableFuture<Void> mergeRegions(List<byte[]> nameOfRegionsToMerge, boolean forcible) {
341    return wrap(rawAdmin.mergeRegions(nameOfRegionsToMerge, forcible));
342  }
343
344  @Override
345  public CompletableFuture<Void> split(TableName tableName) {
346    return wrap(rawAdmin.split(tableName));
347  }
348
349  @Override
350  public CompletableFuture<Void> split(TableName tableName, byte[] splitPoint) {
351    return wrap(rawAdmin.split(tableName, splitPoint));
352  }
353
354  @Override
355  public CompletableFuture<Void> splitRegion(byte[] regionName) {
356    return wrap(rawAdmin.splitRegion(regionName));
357  }
358
359  @Override
360  public CompletableFuture<Void> splitRegion(byte[] regionName, byte[] splitPoint) {
361    return wrap(rawAdmin.splitRegion(regionName, splitPoint));
362  }
363
364  @Override
365  public CompletableFuture<Void> assign(byte[] regionName) {
366    return wrap(rawAdmin.assign(regionName));
367  }
368
369  @Override
370  public CompletableFuture<Void> unassign(byte[] regionName) {
371    return wrap(rawAdmin.unassign(regionName));
372  }
373
374  @Override
375  public CompletableFuture<Void> offline(byte[] regionName) {
376    return wrap(rawAdmin.offline(regionName));
377  }
378
379  @Override
380  public CompletableFuture<Void> move(byte[] regionName) {
381    return wrap(rawAdmin.move(regionName));
382  }
383
384  @Override
385  public CompletableFuture<Void> move(byte[] regionName, ServerName destServerName) {
386    return wrap(rawAdmin.move(regionName, destServerName));
387  }
388
389  @Override
390  public CompletableFuture<Void> setQuota(QuotaSettings quota) {
391    return wrap(rawAdmin.setQuota(quota));
392  }
393
394  @Override
395  public CompletableFuture<List<QuotaSettings>> getQuota(QuotaFilter filter) {
396    return wrap(rawAdmin.getQuota(filter));
397  }
398
399  @Override
400  public CompletableFuture<Void> addReplicationPeer(String peerId,
401      ReplicationPeerConfig peerConfig, boolean enabled) {
402    return wrap(rawAdmin.addReplicationPeer(peerId, peerConfig, enabled));
403  }
404
405  @Override
406  public CompletableFuture<Void> removeReplicationPeer(String peerId) {
407    return wrap(rawAdmin.removeReplicationPeer(peerId));
408  }
409
410  @Override
411  public CompletableFuture<Void> enableReplicationPeer(String peerId) {
412    return wrap(rawAdmin.enableReplicationPeer(peerId));
413  }
414
415  @Override
416  public CompletableFuture<Void> disableReplicationPeer(String peerId) {
417    return wrap(rawAdmin.disableReplicationPeer(peerId));
418  }
419
420  @Override
421  public CompletableFuture<ReplicationPeerConfig> getReplicationPeerConfig(String peerId) {
422    return wrap(rawAdmin.getReplicationPeerConfig(peerId));
423  }
424
425  @Override
426  public CompletableFuture<Void> updateReplicationPeerConfig(String peerId,
427      ReplicationPeerConfig peerConfig) {
428    return wrap(rawAdmin.updateReplicationPeerConfig(peerId, peerConfig));
429  }
430
431  @Override
432  public CompletableFuture<Void> transitReplicationPeerSyncReplicationState(String peerId,
433      SyncReplicationState clusterState) {
434    return wrap(rawAdmin.transitReplicationPeerSyncReplicationState(peerId, clusterState));
435  }
436
437  @Override
438  public CompletableFuture<Void> appendReplicationPeerTableCFs(String peerId,
439      Map<TableName, List<String>> tableCfs) {
440    return wrap(rawAdmin.appendReplicationPeerTableCFs(peerId, tableCfs));
441  }
442
443  @Override
444  public CompletableFuture<Void> removeReplicationPeerTableCFs(String peerId,
445      Map<TableName, List<String>> tableCfs) {
446    return wrap(rawAdmin.removeReplicationPeerTableCFs(peerId, tableCfs));
447  }
448
449  @Override
450  public CompletableFuture<List<ReplicationPeerDescription>> listReplicationPeers() {
451    return wrap(rawAdmin.listReplicationPeers());
452  }
453
454  @Override
455  public CompletableFuture<List<ReplicationPeerDescription>> listReplicationPeers(Pattern pattern) {
456    return wrap(rawAdmin.listReplicationPeers(pattern));
457  }
458
459  @Override
460  public CompletableFuture<List<TableCFs>> listReplicatedTableCFs() {
461    return wrap(rawAdmin.listReplicatedTableCFs());
462  }
463
464  @Override
465  public CompletableFuture<Void> enableTableReplication(TableName tableName) {
466    return wrap(rawAdmin.enableTableReplication(tableName));
467  }
468
469  @Override
470  public CompletableFuture<Void> disableTableReplication(TableName tableName) {
471    return wrap(rawAdmin.disableTableReplication(tableName));
472  }
473
474  @Override
475  public CompletableFuture<Void> snapshot(SnapshotDescription snapshot) {
476    return wrap(rawAdmin.snapshot(snapshot));
477  }
478
479  @Override
480  public CompletableFuture<Boolean> isSnapshotFinished(SnapshotDescription snapshot) {
481    return wrap(rawAdmin.isSnapshotFinished(snapshot));
482  }
483
484  @Override
485  public CompletableFuture<Void> restoreSnapshot(String snapshotName) {
486    return wrap(rawAdmin.restoreSnapshot(snapshotName));
487  }
488
489  @Override
490  public CompletableFuture<Void> restoreSnapshot(String snapshotName, boolean takeFailSafeSnapshot,
491      boolean restoreAcl) {
492    return wrap(rawAdmin.restoreSnapshot(snapshotName, takeFailSafeSnapshot, restoreAcl));
493  }
494
495  @Override
496  public CompletableFuture<Void> cloneSnapshot(String snapshotName, TableName tableName,
497      boolean restoreAcl) {
498    return wrap(rawAdmin.cloneSnapshot(snapshotName, tableName, restoreAcl));
499  }
500
501  @Override
502  public CompletableFuture<List<SnapshotDescription>> listSnapshots() {
503    return wrap(rawAdmin.listSnapshots());
504  }
505
506  @Override
507  public CompletableFuture<List<SnapshotDescription>> listSnapshots(Pattern pattern) {
508    return wrap(rawAdmin.listSnapshots(pattern));
509  }
510
511  @Override
512  public CompletableFuture<List<SnapshotDescription>> listTableSnapshots(Pattern tableNamePattern) {
513    return wrap(rawAdmin.listTableSnapshots(tableNamePattern));
514  }
515
516  @Override
517  public CompletableFuture<List<SnapshotDescription>> listTableSnapshots(Pattern tableNamePattern,
518      Pattern snapshotNamePattern) {
519    return wrap(rawAdmin.listTableSnapshots(tableNamePattern, snapshotNamePattern));
520  }
521
522  @Override
523  public CompletableFuture<Void> deleteSnapshot(String snapshotName) {
524    return wrap(rawAdmin.deleteSnapshot(snapshotName));
525  }
526
527  @Override
528  public CompletableFuture<Void> deleteSnapshots() {
529    return wrap(rawAdmin.deleteSnapshots());
530  }
531
532  @Override
533  public CompletableFuture<Void> deleteSnapshots(Pattern pattern) {
534    return wrap(rawAdmin.deleteSnapshots(pattern));
535  }
536
537  @Override
538  public CompletableFuture<Void> deleteTableSnapshots(Pattern tableNamePattern) {
539    return wrap(rawAdmin.deleteTableSnapshots(tableNamePattern));
540  }
541
542  @Override
543  public CompletableFuture<Void> deleteTableSnapshots(Pattern tableNamePattern,
544      Pattern snapshotNamePattern) {
545    return wrap(rawAdmin.deleteTableSnapshots(tableNamePattern, snapshotNamePattern));
546  }
547
548  @Override
549  public CompletableFuture<Void> execProcedure(String signature, String instance,
550      Map<String, String> props) {
551    return wrap(rawAdmin.execProcedure(signature, instance, props));
552  }
553
554  @Override
555  public CompletableFuture<byte[]> execProcedureWithReturn(String signature, String instance,
556      Map<String, String> props) {
557    return wrap(rawAdmin.execProcedureWithReturn(signature, instance, props));
558  }
559
560  @Override
561  public CompletableFuture<Boolean> isProcedureFinished(String signature, String instance,
562      Map<String, String> props) {
563    return wrap(rawAdmin.isProcedureFinished(signature, instance, props));
564  }
565
566  @Override
567  public CompletableFuture<Boolean> abortProcedure(long procId, boolean mayInterruptIfRunning) {
568    return wrap(rawAdmin.abortProcedure(procId, mayInterruptIfRunning));
569  }
570
571  @Override
572  public CompletableFuture<String> getProcedures() {
573    return wrap(rawAdmin.getProcedures());
574  }
575
576  @Override
577  public CompletableFuture<String> getLocks() {
578    return wrap(rawAdmin.getLocks());
579  }
580
581  @Override
582  public CompletableFuture<Void> decommissionRegionServers(List<ServerName> servers,
583      boolean offload) {
584    return wrap(rawAdmin.decommissionRegionServers(servers, offload));
585  }
586
587  @Override
588  public CompletableFuture<List<ServerName>> listDecommissionedRegionServers() {
589    return wrap(rawAdmin.listDecommissionedRegionServers());
590  }
591
592  @Override
593  public CompletableFuture<Void> recommissionRegionServer(ServerName server,
594      List<byte[]> encodedRegionNames) {
595    return wrap(rawAdmin.recommissionRegionServer(server, encodedRegionNames));
596  }
597
598  @Override
599  public CompletableFuture<ClusterMetrics> getClusterMetrics() {
600    return getClusterMetrics(EnumSet.allOf(Option.class));
601  }
602
603  @Override
604  public CompletableFuture<ClusterMetrics> getClusterMetrics(EnumSet<Option> options) {
605    return wrap(rawAdmin.getClusterMetrics(options));
606  }
607
608  @Override
609  public CompletableFuture<Void> shutdown() {
610    return wrap(rawAdmin.shutdown());
611  }
612
613  @Override
614  public CompletableFuture<Void> stopMaster() {
615    return wrap(rawAdmin.stopMaster());
616  }
617
618  @Override
619  public CompletableFuture<Void> stopRegionServer(ServerName serverName) {
620    return wrap(rawAdmin.stopRegionServer(serverName));
621  }
622
623  @Override
624  public CompletableFuture<Void> updateConfiguration(ServerName serverName) {
625    return wrap(rawAdmin.updateConfiguration(serverName));
626  }
627
628  @Override
629  public CompletableFuture<Void> updateConfiguration() {
630    return wrap(rawAdmin.updateConfiguration());
631  }
632
633  @Override
634  public CompletableFuture<Void> updateConfiguration(String groupName) {
635    return wrap(rawAdmin.updateConfiguration(groupName));
636  }
637
638  @Override
639  public CompletableFuture<Void> rollWALWriter(ServerName serverName) {
640    return wrap(rawAdmin.rollWALWriter(serverName));
641  }
642
643  @Override
644  public CompletableFuture<Void> clearCompactionQueues(ServerName serverName, Set<String> queues) {
645    return wrap(rawAdmin.clearCompactionQueues(serverName, queues));
646  }
647
648  @Override
649  public CompletableFuture<List<SecurityCapability>> getSecurityCapabilities() {
650    return wrap(rawAdmin.getSecurityCapabilities());
651  }
652
653  @Override
654  public CompletableFuture<List<RegionMetrics>> getRegionMetrics(ServerName serverName) {
655    return wrap(rawAdmin.getRegionMetrics(serverName));
656  }
657
658  @Override
659  public CompletableFuture<List<RegionMetrics>> getRegionMetrics(ServerName serverName,
660      TableName tableName) {
661    return wrap(rawAdmin.getRegionMetrics(serverName, tableName));
662  }
663
664  @Override
665  public CompletableFuture<Boolean> isMasterInMaintenanceMode() {
666    return wrap(rawAdmin.isMasterInMaintenanceMode());
667  }
668
669  @Override
670  public CompletableFuture<CompactionState> getCompactionState(
671      TableName tableName, CompactType compactType) {
672    return wrap(rawAdmin.getCompactionState(tableName, compactType));
673  }
674
675  @Override
676  public CompletableFuture<CompactionState> getCompactionStateForRegion(byte[] regionName) {
677    return wrap(rawAdmin.getCompactionStateForRegion(regionName));
678  }
679
680  @Override
681  public CompletableFuture<Optional<Long>> getLastMajorCompactionTimestamp(TableName tableName) {
682    return wrap(rawAdmin.getLastMajorCompactionTimestamp(tableName));
683  }
684
685  @Override
686  public CompletableFuture<Optional<Long>> getLastMajorCompactionTimestampForRegion(
687      byte[] regionName) {
688    return wrap(rawAdmin.getLastMajorCompactionTimestampForRegion(regionName));
689  }
690
691  @Override
692  public CompletableFuture<Boolean> balancerSwitch(boolean on, boolean drainRITs) {
693    return wrap(rawAdmin.balancerSwitch(on, drainRITs));
694  }
695
696  @Override
697  public CompletableFuture<Boolean> balance(boolean forcible) {
698    return wrap(rawAdmin.balance(forcible));
699  }
700
701  @Override
702  public CompletableFuture<Boolean> isBalancerEnabled() {
703    return wrap(rawAdmin.isBalancerEnabled());
704  }
705
706  @Override
707  public CompletableFuture<Boolean> normalizerSwitch(boolean on) {
708    return wrap(rawAdmin.normalizerSwitch(on));
709  }
710
711  @Override
712  public CompletableFuture<Boolean> isNormalizerEnabled() {
713    return wrap(rawAdmin.isNormalizerEnabled());
714  }
715
716  @Override
717  public CompletableFuture<Boolean> normalize(NormalizeTableFilterParams ntfp) {
718    return wrap(rawAdmin.normalize(ntfp));
719  }
720
721  @Override
722  public CompletableFuture<Boolean> cleanerChoreSwitch(boolean enabled) {
723    return wrap(rawAdmin.cleanerChoreSwitch(enabled));
724  }
725
726  @Override
727  public CompletableFuture<Boolean> isCleanerChoreEnabled() {
728    return wrap(rawAdmin.isCleanerChoreEnabled());
729  }
730
731  @Override
732  public CompletableFuture<Boolean> runCleanerChore() {
733    return wrap(rawAdmin.runCleanerChore());
734  }
735
736  @Override
737  public CompletableFuture<Boolean> catalogJanitorSwitch(boolean enabled) {
738    return wrap(rawAdmin.catalogJanitorSwitch(enabled));
739  }
740
741  @Override
742  public CompletableFuture<Boolean> isCatalogJanitorEnabled() {
743    return wrap(rawAdmin.isCatalogJanitorEnabled());
744  }
745
746  @Override
747  public CompletableFuture<Integer> runCatalogJanitor() {
748    return wrap(rawAdmin.runCatalogJanitor());
749  }
750
751  @Override
752  public <S, R> CompletableFuture<R> coprocessorService(Function<RpcChannel, S> stubMaker,
753      ServiceCaller<S, R> callable) {
754    return wrap(rawAdmin.coprocessorService(stubMaker, callable));
755  }
756
757  @Override
758  public <S, R> CompletableFuture<R> coprocessorService(Function<RpcChannel, S> stubMaker,
759      ServiceCaller<S, R> callable, ServerName serverName) {
760    return wrap(rawAdmin.coprocessorService(stubMaker, callable, serverName));
761  }
762
763  @Override
764  public CompletableFuture<List<ServerName>> listDeadServers() {
765    return wrap(rawAdmin.listDeadServers());
766  }
767
768  @Override
769  public CompletableFuture<List<ServerName>> clearDeadServers(List<ServerName> servers) {
770    return wrap(rawAdmin.clearDeadServers(servers));
771  }
772
773  @Override
774  public CompletableFuture<CacheEvictionStats> clearBlockCache(TableName tableName) {
775    return wrap(rawAdmin.clearBlockCache(tableName));
776  }
777
778  @Override
779  public CompletableFuture<Void> cloneTableSchema(TableName tableName, TableName newTableName,
780      boolean preserveSplits) {
781    return wrap(rawAdmin.cloneTableSchema(tableName, newTableName, preserveSplits));
782  }
783
784  @Override
785  public CompletableFuture<Map<ServerName, Boolean>> compactionSwitch(boolean switchState,
786      List<String> serverNamesList) {
787    return wrap(rawAdmin.compactionSwitch(switchState, serverNamesList));
788  }
789
790  @Override
791  public CompletableFuture<Boolean> switchRpcThrottle(boolean enable) {
792    return wrap(rawAdmin.switchRpcThrottle(enable));
793  }
794
795  @Override
796  public CompletableFuture<Boolean> isRpcThrottleEnabled() {
797    return wrap(rawAdmin.isRpcThrottleEnabled());
798  }
799
800  @Override
801  public CompletableFuture<Boolean> exceedThrottleQuotaSwitch(boolean enable) {
802    return wrap(rawAdmin.exceedThrottleQuotaSwitch(enable));
803  }
804
805  @Override
806  public CompletableFuture<Map<TableName, Long>> getSpaceQuotaTableSizes() {
807    return wrap(rawAdmin.getSpaceQuotaTableSizes());
808  }
809
810  @Override
811  public CompletableFuture<Map<TableName, SpaceQuotaSnapshot>> getRegionServerSpaceQuotaSnapshots(
812      ServerName serverName) {
813    return wrap(rawAdmin.getRegionServerSpaceQuotaSnapshots(serverName));
814  }
815
816  @Override
817  public CompletableFuture<SpaceQuotaSnapshot> getCurrentSpaceQuotaSnapshot(String namespace) {
818    return wrap(rawAdmin.getCurrentSpaceQuotaSnapshot(namespace));
819  }
820
821  @Override
822  public CompletableFuture<SpaceQuotaSnapshot> getCurrentSpaceQuotaSnapshot(TableName tableName) {
823    return wrap(rawAdmin.getCurrentSpaceQuotaSnapshot(tableName));
824  }
825
826  @Override
827  public CompletableFuture<Void> grant(UserPermission userPermission,
828      boolean mergeExistingPermissions) {
829    return wrap(rawAdmin.grant(userPermission, mergeExistingPermissions));
830  }
831
832  @Override
833  public CompletableFuture<Void> revoke(UserPermission userPermission) {
834    return wrap(rawAdmin.revoke(userPermission));
835  }
836
837  @Override
838  public CompletableFuture<List<UserPermission>>
839      getUserPermissions(GetUserPermissionsRequest getUserPermissionsRequest) {
840    return wrap(rawAdmin.getUserPermissions(getUserPermissionsRequest));
841  }
842
843  @Override
844  public CompletableFuture<List<Boolean>> hasUserPermissions(String userName,
845      List<Permission> permissions) {
846    return wrap(rawAdmin.hasUserPermissions(userName, permissions));
847  }
848
849  @Override
850  public CompletableFuture<Boolean> snapshotCleanupSwitch(final boolean on,
851      final boolean sync) {
852    return wrap(rawAdmin.snapshotCleanupSwitch(on, sync));
853  }
854
855  @Override
856  public CompletableFuture<Boolean> isSnapshotCleanupEnabled() {
857    return wrap(rawAdmin.isSnapshotCleanupEnabled());
858  }
859
860  @Override
861  public CompletableFuture<List<Boolean>> clearSlowLogResponses(Set<ServerName> serverNames) {
862    return wrap(rawAdmin.clearSlowLogResponses(serverNames));
863  }
864
865  @Override
866  public CompletableFuture<RSGroupInfo> getRSGroup(String groupName) {
867    return wrap(rawAdmin.getRSGroup(groupName));
868  }
869
870  @Override
871  public CompletableFuture<Void> moveServersToRSGroup(Set<Address> servers, String groupName) {
872    return wrap(rawAdmin.moveServersToRSGroup(servers, groupName));
873  }
874
875  @Override
876  public CompletableFuture<Void> addRSGroup(String groupName) {
877    return wrap(rawAdmin.addRSGroup(groupName));
878  }
879
880  @Override
881  public CompletableFuture<Void> removeRSGroup(String groupName) {
882    return wrap(rawAdmin.removeRSGroup(groupName));
883  }
884
885  @Override
886  public CompletableFuture<Boolean> balanceRSGroup(String groupName) {
887    return wrap(rawAdmin.balanceRSGroup(groupName));
888  }
889
890  @Override
891  public CompletableFuture<List<RSGroupInfo>> listRSGroups() {
892    return wrap(rawAdmin.listRSGroups());
893  }
894
895  @Override
896  public CompletableFuture<List<TableName>> listTablesInRSGroup(String groupName) {
897    return wrap(rawAdmin.listTablesInRSGroup(groupName));
898  }
899
900  @Override
901  public CompletableFuture<Pair<List<String>, List<TableName>>>
902    getConfiguredNamespacesAndTablesInRSGroup(String groupName) {
903    return wrap(rawAdmin.getConfiguredNamespacesAndTablesInRSGroup(groupName));
904  }
905
906  @Override
907  public CompletableFuture<RSGroupInfo> getRSGroup(Address hostPort) {
908    return wrap(rawAdmin.getRSGroup(hostPort));
909  }
910
911  @Override
912  public CompletableFuture<Void> removeServersFromRSGroup(Set<Address> servers) {
913    return wrap(rawAdmin.removeServersFromRSGroup(servers));
914  }
915
916  @Override
917  public CompletableFuture<RSGroupInfo> getRSGroup(TableName tableName) {
918    return wrap(rawAdmin.getRSGroup(tableName));
919  }
920
921  @Override
922  public CompletableFuture<Void> setRSGroup(Set<TableName> tables, String groupName) {
923    return wrap(rawAdmin.setRSGroup(tables, groupName));
924  }
925
926  @Override
927  public CompletableFuture<Void> renameRSGroup(String oldName, String newName) {
928    return wrap(rawAdmin.renameRSGroup(oldName, newName));
929  }
930
931  @Override
932  public CompletableFuture<Void>
933    updateRSGroupConfig(String groupName, Map<String, String> configuration) {
934    return wrap(rawAdmin.updateRSGroupConfig(groupName, configuration));
935  }
936
937  @Override
938  public CompletableFuture<List<LogEntry>> getLogEntries(Set<ServerName> serverNames,
939      String logType, ServerType serverType, int limit,
940      Map<String, Object> filterParams) {
941    return wrap(rawAdmin.getLogEntries(serverNames, logType, serverType, limit, filterParams));
942  }
943}