use of org.apache.ignite.internal.processors.platform.client.ClientConnectableNodePartitions in project ignite by apache.
the class ClientCacheNodePartitionsResponse method encode.
/**
* {@inheritDoc}
*/
@Override
public void encode(ClientConnectionContext ctx, BinaryRawWriterEx writer) {
super.encode(ctx, writer);
writer.writeInt(nodeParts.size());
for (ClientConnectableNodePartitions nodePart : nodeParts) {
nodePart.write(writer);
}
}
use of org.apache.ignite.internal.processors.platform.client.ClientConnectableNodePartitions in project ignite by apache.
the class ClientCacheNodePartitionsRequest method process.
/**
* {@inheritDoc}
*/
@Override
public ClientResponse process(ClientConnectionContext ctx) {
IgniteCache cache = cache(ctx);
GridDiscoveryManager discovery = ctx.kernalContext().discovery();
Collection<ClusterNode> nodes = discovery.discoCache().cacheNodes(cache.getName());
Affinity aff = ctx.kernalContext().affinity().affinityProxy(cache.getName());
ArrayList<ClientConnectableNodePartitions> res = new ArrayList<>();
for (ClusterNode node : nodes) {
Integer port = node.attribute(ClientListenerProcessor.CLIENT_LISTENER_PORT);
if (port == null)
continue;
Collection<String> addrs = node.addresses();
int[] parts = aff.primaryPartitions(node);
res.add(new ClientConnectableNodePartitions(port, addrs, parts));
}
return new ClientCacheNodePartitionsResponse(requestId(), res);
}
Aggregations