Search in sources :

Example 1 with DistroDataStorage

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));
    }
}
Also used : DistroTransportAgent(com.alibaba.nacos.core.distributed.distro.component.DistroTransportAgent) DistroDataStorage(com.alibaba.nacos.core.distributed.distro.component.DistroDataStorage) Member(com.alibaba.nacos.core.cluster.Member) DistroData(com.alibaba.nacos.core.distributed.distro.entity.DistroData)

Example 2 with DistroDataStorage

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);
}
Also used : DistroDataStorage(com.alibaba.nacos.core.distributed.distro.component.DistroDataStorage) DistroData(com.alibaba.nacos.core.distributed.distro.entity.DistroData)

Example 3 with DistroDataStorage

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);
}
Also used : DistroTransportAgent(com.alibaba.nacos.core.distributed.distro.component.DistroTransportAgent) DistroDataProcessor(com.alibaba.nacos.core.distributed.distro.component.DistroDataProcessor) DistroFailedTaskHandler(com.alibaba.nacos.core.distributed.distro.component.DistroFailedTaskHandler) DistroDataStorage(com.alibaba.nacos.core.distributed.distro.component.DistroDataStorage) Test(org.junit.Test)

Aggregations

DistroDataStorage (com.alibaba.nacos.core.distributed.distro.component.DistroDataStorage)3 DistroTransportAgent (com.alibaba.nacos.core.distributed.distro.component.DistroTransportAgent)2 DistroData (com.alibaba.nacos.core.distributed.distro.entity.DistroData)2 Member (com.alibaba.nacos.core.cluster.Member)1 DistroDataProcessor (com.alibaba.nacos.core.distributed.distro.component.DistroDataProcessor)1 DistroFailedTaskHandler (com.alibaba.nacos.core.distributed.distro.component.DistroFailedTaskHandler)1 Test (org.junit.Test)1