use of org.apache.hadoop.ozone.container.replication.ContainerReplicator in project ozone by apache.
the class ClosedContainerReplicator method initializeReplicationSupervisor.
@NotNull
private void initializeReplicationSupervisor(ConfigurationSource conf) throws IOException {
String fakeDatanodeUuid = datanode;
if (fakeDatanodeUuid.isEmpty()) {
fakeDatanodeUuid = UUID.randomUUID().toString();
}
ContainerSet containerSet = new ContainerSet();
ContainerMetrics metrics = ContainerMetrics.create(conf);
MutableVolumeSet volumeSet = new MutableVolumeSet(fakeDatanodeUuid, conf, null, StorageVolume.VolumeType.DATA_VOLUME, null);
Map<ContainerType, Handler> handlers = new HashMap<>();
for (ContainerType containerType : ContainerType.values()) {
final Handler handler = Handler.getHandlerForContainerType(containerType, conf, fakeDatanodeUuid, containerSet, volumeSet, metrics, containerReplicaProto -> {
});
handler.setClusterID(UUID.randomUUID().toString());
handlers.put(containerType, handler);
}
ContainerController controller = new ContainerController(containerSet, handlers);
ContainerReplicator replicator = new DownloadAndImportReplicator(containerSet, controller, new SimpleContainerDownloader(conf, null), new TarContainerPacker());
supervisor = new ReplicationSupervisor(containerSet, replicator, 10);
}
Aggregations