use of io.pravega.segmentstore.server.ContainerMetadata in project pravega by pravega.
the class OperationMetadataUpdaterTests method clone.
private UpdateableContainerMetadata clone(ContainerMetadata base) {
val metadata = createBlankMetadata();
// First clone stand-alone (parent) Segments (since there may be Transactions mapped to them).
base.getAllStreamSegmentIds().stream().map(base::getStreamSegmentMetadata).filter(sm -> !sm.isTransaction()).forEach(bsm -> metadata.mapStreamSegmentId(bsm.getName(), bsm.getId()).copyFrom(bsm));
// Then clone transactions.
base.getAllStreamSegmentIds().stream().map(base::getStreamSegmentMetadata).filter(SegmentMetadata::isTransaction).forEach(bsm -> metadata.mapStreamSegmentId(bsm.getName(), bsm.getId(), bsm.getParentId()).copyFrom(bsm));
return metadata;
}
Aggregations