Search in sources :

Example 1 with ClientSyncDatumSnapshot

use of com.alibaba.nacos.naming.core.v2.client.ClientSyncDatumSnapshot in project nacos by alibaba.

the class DistroClientDataProcessor method getDatumSnapshot.

@Override
public DistroData getDatumSnapshot() {
    List<ClientSyncData> datum = new LinkedList<>();
    for (String each : clientManager.allClientId()) {
        Client client = clientManager.getClient(each);
        if (null == client || !client.isEphemeral()) {
            continue;
        }
        datum.add(client.generateSyncData());
    }
    ClientSyncDatumSnapshot snapshot = new ClientSyncDatumSnapshot();
    snapshot.setClientSyncDataList(datum);
    byte[] data = ApplicationUtils.getBean(Serializer.class).serialize(snapshot);
    return new DistroData(new DistroKey(DataOperation.SNAPSHOT.name(), TYPE), data);
}
Also used : ClientSyncData(com.alibaba.nacos.naming.core.v2.client.ClientSyncData) ClientSyncDatumSnapshot(com.alibaba.nacos.naming.core.v2.client.ClientSyncDatumSnapshot) Client(com.alibaba.nacos.naming.core.v2.client.Client) DistroKey(com.alibaba.nacos.core.distributed.distro.entity.DistroKey) LinkedList(java.util.LinkedList) Serializer(com.alibaba.nacos.naming.cluster.transport.Serializer) DistroData(com.alibaba.nacos.core.distributed.distro.entity.DistroData)

Aggregations

DistroData (com.alibaba.nacos.core.distributed.distro.entity.DistroData)1 DistroKey (com.alibaba.nacos.core.distributed.distro.entity.DistroKey)1 Serializer (com.alibaba.nacos.naming.cluster.transport.Serializer)1 Client (com.alibaba.nacos.naming.core.v2.client.Client)1 ClientSyncData (com.alibaba.nacos.naming.core.v2.client.ClientSyncData)1 ClientSyncDatumSnapshot (com.alibaba.nacos.naming.core.v2.client.ClientSyncDatumSnapshot)1 LinkedList (java.util.LinkedList)1