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 org.apache.yetus.audience.InterfaceAudience;
021
022/**
023 * For creating {@link Table} instance.
024 * <p>
025 * The implementation should have default configurations set before returning the builder to user.
026 * So users are free to only set the configurations they care about to create a new Table instance.
027 */
028@InterfaceAudience.Public
029public interface TableBuilder {
030
031  /**
032   * Set timeout for a whole operation such as get, put or delete. Notice that scan will not be
033   * effected by this value, see scanTimeoutNs.
034   * <p>
035   * Operation timeout and max attempt times(or max retry times) are both limitations for retrying,
036   * we will stop retrying when we reach any of the limitations.
037   */
038  TableBuilder setOperationTimeout(int timeout);
039
040  /**
041   * Set timeout for each rpc request.
042   * <p>
043   * Notice that this will <strong>NOT</strong> change the rpc timeout for read(get, scan) request
044   * and write request(put, delete).
045   */
046  TableBuilder setRpcTimeout(int timeout);
047
048  /**
049   * Set timeout for each read(get, scan) rpc request.
050   */
051  TableBuilder setReadRpcTimeout(int timeout);
052
053  /**
054   * Set timeout for each write(put, delete) rpc request.
055   */
056  TableBuilder setWriteRpcTimeout(int timeout);
057
058  /**
059   * Set a request attribute
060   */
061  TableBuilder setRequestAttribute(String key, byte[] value);
062
063  /**
064   * Create the {@link Table} instance.
065   */
066  Table build();
067}