private static void write(FileSystem fs, Path dir, String name, byte[] data) throws IOException {
    RotateFile file = new RotateFile(fs, dir, name, MAX_FILE_SIZE);
    // to initialize the nextFile index
    file.read();
    file.write(data);
  }
A filesystem based replication peer storage. The implementation does not require atomic rename so
you can use it on cloud OSS.
<p/>
FileSystem layout:

<pre>
hbase
  |
  --peers
      |
      --&lt;peer_id&gt;
          |
          --peer_config
          |
          --disabled
          |
          --sync-rep-state
</pre>

Notice that, if the peer is enabled, we will not have a disabled file.
<p/>
And for other files, to avoid depending on atomic rename, we will use two files for storing the
content. When loading, we will try to read both the files and load the newer one. And when
writing, we will write to the older file.
hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/FSReplicationPeerStorage.java