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