void readSnapshot(final String snapshotPath) {
        final Timer.Context timeCtx = getTimeContext("READ_SNAPSHOT");
        final Lock writeLock = this.readWriteLock.writeLock();
        writeLock.lock();
        try {
            final File snapshotFile = new File(snapshotPath);
            if (!snapshotFile.exists()) {
                LOG.error("Snapshot file [{}] not exists.", snapshotPath);
                return;
            }
            closeRocksDB();
            final String dbPath = this.opts.getDbPath();
            final File dbFile = new File(dbPath);
            FileUtils.deleteDirectory(dbFile);
            if (!Utils.atomicMoveFile(snapshotFile, dbFile, true)) {
                throw new StorageException("Fail to rename [" + snapshotPath + "] to [" + dbPath + "].");
            }
            // reopen the db
            openRocksDB(this.opts);
        } catch (final Exception e) {
            throw new StorageException("Fail to read snapshot from path: " + snapshotPath, e);
        } finally {
            writeLock.unlock();
            timeCtx.stop();
        }
    }
Local KV store based on RocksDB

@author dennis
@author jiachun.fjc
jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/storage/RocksRawKVStore.java