Search in sources :

Example 1 with ClientConnectableNodePartitions

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);
    }
}
Also used : ClientConnectableNodePartitions(org.apache.ignite.internal.processors.platform.client.ClientConnectableNodePartitions)

Example 2 with ClientConnectableNodePartitions

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);
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) IgniteCache(org.apache.ignite.IgniteCache) ArrayList(java.util.ArrayList) GridDiscoveryManager(org.apache.ignite.internal.managers.discovery.GridDiscoveryManager) ClientConnectableNodePartitions(org.apache.ignite.internal.processors.platform.client.ClientConnectableNodePartitions) Affinity(org.apache.ignite.cache.affinity.Affinity)

Aggregations

ClientConnectableNodePartitions (org.apache.ignite.internal.processors.platform.client.ClientConnectableNodePartitions)2 ArrayList (java.util.ArrayList)1 IgniteCache (org.apache.ignite.IgniteCache)1 Affinity (org.apache.ignite.cache.affinity.Affinity)1 ClusterNode (org.apache.ignite.cluster.ClusterNode)1 GridDiscoveryManager (org.apache.ignite.internal.managers.discovery.GridDiscoveryManager)1