public int appendData(final long logIndex, final byte[] data) {
        this.writeLock.lock();
        try {
            assert (logIndex > getLastLogIndex());
            final byte[] writeData = encodeData(data);
            return doAppend(logIndex, writeData);
        } finally {
            this.writeLock.unlock();
        }
    }
Write the data and return it's wrote position.
@param logIndex the log index
@param data     data to write
@return the wrote position
jraft-extension/java-log-storage-impl/src/main/java/com/alipay/sofa/jraft/storage/file/segment/SegmentFile.java