View Javadoc

1   /*
2    * Copyright 2010 The Apache Software Foundation
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  package org.apache.hadoop.hbase.replication.regionserver;
21  
22  import org.apache.hadoop.conf.Configuration;
23  import org.apache.hadoop.fs.FileSystem;
24  import org.apache.hadoop.fs.Path;
25  import org.apache.hadoop.hbase.HConstants;
26  
27  import java.io.IOException;
28  import java.util.concurrent.atomic.AtomicBoolean;
29  
30  /**
31   * Interface that defines a replication source
32   */
33  public interface ReplicationSourceInterface {
34  
35    /**
36     * Initializer for the source
37     * @param conf the configuration to use
38     * @param fs the file system to use
39     * @param manager the manager to use
40     * @param stopper the stopper object for this region server
41     * @param replicating the status of the replication on this cluster
42     * @param peerClusterId the id of the peer cluster
43     * @throws IOException
44     */
45    public void init(final Configuration conf,
46                     final FileSystem fs,
47                     final ReplicationSourceManager manager,
48                     final AtomicBoolean stopper,
49                     final AtomicBoolean replicating,
50                     final String peerClusterId) throws IOException;
51  
52    /**
53     * Add a log to the list of logs to replicate
54     * @param log path to the log to replicate
55     */
56    public void enqueueLog(Path log);
57  
58    /**
59     * Get the current log that's replicated
60     * @return the current log
61     */
62    public Path getCurrentPath();
63  
64    /**
65     * Start the replication
66     */
67    public void startup();
68  
69    /**
70     * End the replication
71     */
72    public void terminate();
73  
74    /**
75     * Get the id that the source is replicating to
76     *
77     * @return peer cluster id
78     */
79    public String getPeerClusterZnode();
80  }