use of com.alipay.sofa.jraft.entity.RaftOutter.SnapshotMeta in project sofa-jraft by sofastack.
the class ProtobufMsgFactoryTest method testNewMessage.
@Test
public void testNewMessage() {
SnapshotMeta meta = SnapshotMeta.newBuilder().setLastIncludedIndex(99).setLastIncludedTerm(1).build();
SnapshotMeta pMeta = ProtobufMsgFactory.newMessageByProtoClassName("jraft.SnapshotMeta", meta.toByteArray());
assertNotNull(pMeta);
assertNotSame(pMeta, meta);
assertEquals(pMeta, meta);
}
use of com.alipay.sofa.jraft.entity.RaftOutter.SnapshotMeta in project sofa-jraft by sofastack.
the class ProtobufMsgFactoryTest method testNewMessageByJavaClassName.
@Test
public void testNewMessageByJavaClassName() {
SnapshotMeta meta = SnapshotMeta.newBuilder().setLastIncludedIndex(99).setLastIncludedTerm(1).build();
SnapshotMeta pMeta = ProtobufMsgFactory.newMessageByJavaClassName(meta.getClass().getName(), meta.toByteArray());
assertNotNull(pMeta);
assertNotSame(pMeta, meta);
assertEquals(pMeta, meta);
}
use of com.alipay.sofa.jraft.entity.RaftOutter.SnapshotMeta in project sofa-jraft by sofastack.
the class SnapshotExecutorImpl method installSnapshot.
@Override
public void installSnapshot(final InstallSnapshotRequest request, final InstallSnapshotResponse.Builder response, final RpcRequestClosure done) {
final SnapshotMeta meta = request.getMeta();
final DownloadingSnapshot ds = new DownloadingSnapshot(request, response, done);
// as the retry snapshot will replace this one.
if (!registerDownloadingSnapshot(ds)) {
LOG.warn("Fail to register downloading snapshot.");
// This RPC will be responded by the previous session
return;
}
Requires.requireNonNull(this.curCopier, "curCopier");
try {
this.curCopier.join();
} catch (final InterruptedException e) {
Thread.currentThread().interrupt();
LOG.warn("Install snapshot copy job was canceled.");
return;
}
loadDownloadingSnapshot(ds, meta);
}
Aggregations