use of com.alibaba.nacos.core.distributed.distro.component.DistroDataStorage in project nacos by alibaba.
the class DistroVerifyTimedTask method verifyForDataStorage.
private void verifyForDataStorage(String type, List<Member> targetServer) {
DistroDataStorage dataStorage = distroComponentHolder.findDataStorage(type);
if (!dataStorage.isFinishInitial()) {
Loggers.DISTRO.warn("data storage {} has not finished initial step, do not send verify data", dataStorage.getClass().getSimpleName());
return;
}
List<DistroData> verifyData = dataStorage.getVerifyData();
if (null == verifyData || verifyData.isEmpty()) {
return;
}
for (Member member : targetServer) {
DistroTransportAgent agent = distroComponentHolder.findTransportAgent(type);
if (null == agent) {
continue;
}
executeTaskExecuteEngine.addTask(member.getAddress() + type, new DistroVerifyExecuteTask(agent, verifyData, member.getAddress(), type));
}
}
use of com.alibaba.nacos.core.distributed.distro.component.DistroDataStorage in project nacos by alibaba.
the class DistroProtocol method onQuery.
/**
* Query data of input distro key.
*
* @param distroKey key of data
* @return data
*/
public DistroData onQuery(DistroKey distroKey) {
String resourceType = distroKey.getResourceType();
DistroDataStorage distroDataStorage = distroComponentHolder.findDataStorage(resourceType);
if (null == distroDataStorage) {
Loggers.DISTRO.warn("[DISTRO] Can't find data storage for received key {}", resourceType);
return new DistroData(distroKey, new byte[0]);
}
return distroDataStorage.getDistroData(distroKey);
}
use of com.alibaba.nacos.core.distributed.distro.component.DistroDataStorage in project nacos by alibaba.
the class DistroClientComponentRegistryTest method testDoRegister.
@Test
public void testDoRegister() {
distroClientComponentRegistry.doRegister();
DistroDataStorage dataStorage = componentHolder.findDataStorage(DistroClientDataProcessor.TYPE);
Assert.assertNotNull(dataStorage);
DistroDataProcessor dataProcessor = componentHolder.findDataProcessor(DistroClientDataProcessor.TYPE);
Assert.assertNotNull(dataProcessor);
DistroFailedTaskHandler failedTaskHandler = componentHolder.findFailedTaskHandler(DistroClientDataProcessor.TYPE);
Assert.assertNotNull(failedTaskHandler);
DistroTransportAgent transportAgent = componentHolder.findTransportAgent(DistroClientDataProcessor.TYPE);
Assert.assertNotNull(transportAgent);
}
Aggregations