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 java.util.List;
021import org.apache.yetus.audience.InterfaceAudience;
022
023/**
024 * Perform read/write to the replication peer storage.
025 */
026@InterfaceAudience.Private
027public interface ReplicationPeerStorage {
028
029  /**
030   * Add a replication peer.
031   * @throws ReplicationException if there are errors accessing the storage service.
032   */
033  void addPeer(String peerId, ReplicationPeerConfig peerConfig, boolean enabled)
034    throws ReplicationException;
035
036  /**
037   * Remove a replication peer.
038   * @throws ReplicationException if there are errors accessing the storage service.
039   */
040  void removePeer(String peerId) throws ReplicationException;
041
042  /**
043   * Set the state of peer, {@code true} to {@code ENABLED}, otherwise to {@code DISABLED}.
044   * @throws ReplicationException if there are errors accessing the storage service.
045   */
046  void setPeerState(String peerId, boolean enabled) throws ReplicationException;
047
048  /**
049   * Update the config a replication peer.
050   * @throws ReplicationException if there are errors accessing the storage service.
051   */
052  void updatePeerConfig(String peerId, ReplicationPeerConfig peerConfig)
053    throws ReplicationException;
054
055  /**
056   * Return the peer ids of all replication peers.
057   * @throws ReplicationException if there are errors accessing the storage service.
058   */
059  List<String> listPeerIds() throws ReplicationException;
060
061  /**
062   * Test whether a replication peer is enabled.
063   * @throws ReplicationException if there are errors accessing the storage service.
064   */
065  boolean isPeerEnabled(String peerId) throws ReplicationException;
066
067  /**
068   * Get the peer config of a replication peer.
069   * @throws ReplicationException if there are errors accessing the storage service.
070   */
071  ReplicationPeerConfig getPeerConfig(String peerId) throws ReplicationException;
072}