Search in sources :

Example 1 with SnapshotCopier

use of com.alipay.sofa.jraft.storage.snapshot.SnapshotCopier in project sofa-jraft by sofastack.

the class LocalSnapshotStorage method copyFrom.

@Override
public SnapshotReader copyFrom(final String uri, final SnapshotCopierOptions opts) {
    final SnapshotCopier copier = startToCopyFrom(uri, opts);
    if (copier == null) {
        return null;
    }
    try {
        copier.join();
    } catch (final InterruptedException e) {
        Thread.currentThread().interrupt();
        LOG.error("Join on snapshot copier was interrupted.");
        return null;
    }
    final SnapshotReader reader = copier.getReader();
    Utils.closeQuietly(copier);
    return reader;
}
Also used : SnapshotReader(com.alipay.sofa.jraft.storage.snapshot.SnapshotReader) SnapshotCopier(com.alipay.sofa.jraft.storage.snapshot.SnapshotCopier)

Aggregations

SnapshotCopier (com.alipay.sofa.jraft.storage.snapshot.SnapshotCopier)1 SnapshotReader (com.alipay.sofa.jraft.storage.snapshot.SnapshotReader)1