use of org.corfudb.runtime.object.CorfuCompileProxy in project CorfuDB by CorfuDB.
the class MultiCheckpointWriter method appendCheckpoints.
/** Checkpoint multiple SMRMaps serially.
*
* @param rt CorfuRuntime
* @param author Author's name, stored in checkpoint metadata
* @param postAppendFunc User-supplied lambda for post-append action on each
* checkpoint entry type.
* @return Global log address of the first record of
* @throws Exception
*/
public long appendCheckpoints(CorfuRuntime rt, String author, BiConsumer<CheckpointEntry, Long> postAppendFunc) throws Exception {
long globalAddress = CheckpointWriter.startGlobalSnapshotTxn(rt);
try {
for (ICorfuSMR<Map> map : maps) {
UUID streamID = map.getCorfuStreamID();
CheckpointWriter cpw = new CheckpointWriter(rt, streamID, author, (SMRMap) map);
ISerializer serializer = ((CorfuCompileProxy<Map>) map.getCorfuSMRProxy()).getSerializer();
cpw.setSerializer(serializer);
cpw.setPostAppendFunc(postAppendFunc);
List<Long> addresses = cpw.appendCheckpoint();
checkpointLogAddresses.addAll(addresses);
}
} finally {
rt.getObjectsView().TXEnd();
}
return globalAddress;
}
Aggregations