Search in sources :

Example 6 with GridPartitionStateMap

use of org.apache.ignite.internal.util.GridPartitionStateMap in project ignite by apache.

the class GridDhtPartitionTopologyImpl method localPartitionMap.

/**
 * {@inheritDoc}
 */
@Override
public GridDhtPartitionMap localPartitionMap() {
    GridPartitionStateMap map = new GridPartitionStateMap(locParts.length());
    lock.readLock().lock();
    try {
        for (int i = 0; i < locParts.length(); i++) {
            GridDhtLocalPartition part = locParts.get(i);
            if (part == null)
                continue;
            map.put(i, part.state());
        }
        GridDhtPartitionMap locPartMap = node2part != null ? node2part.get(ctx.localNodeId()) : null;
        return new GridDhtPartitionMap(ctx.localNodeId(), updateSeq.get(), locPartMap != null ? locPartMap.topologyVersion() : readyTopVer, map, true);
    } finally {
        lock.readLock().unlock();
    }
}
Also used : GridDhtPartitionMap(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap) GridPartitionStateMap(org.apache.ignite.internal.util.GridPartitionStateMap)

Example 7 with GridPartitionStateMap

use of org.apache.ignite.internal.util.GridPartitionStateMap in project ignite by apache.

the class GridDhtPartitionMap method readExternal.

/**
 * {@inheritDoc}
 */
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    nodeId = U.readUuid(in);
    updateSeq = in.readLong();
    int size = in.readInt();
    map = new GridPartitionStateMap();
    for (int i = 0; i < size; i++) {
        int ordinal = in.readUnsignedByte();
        int part = in.readUnsignedShort();
        put(part, GridDhtPartitionState.fromOrdinal(ordinal));
    }
    long ver = in.readLong();
    int minorVer = in.readInt();
    if (ver != 0)
        top = new AffinityTopologyVersion(ver, minorVer);
}
Also used : AffinityTopologyVersion(org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion) GridPartitionStateMap(org.apache.ignite.internal.util.GridPartitionStateMap)

Aggregations

GridPartitionStateMap (org.apache.ignite.internal.util.GridPartitionStateMap)7 HashMap (java.util.HashMap)3 GridDhtPartitionMap (org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap)2 HashSet (java.util.HashSet)1 Map (java.util.Map)1 UUID (java.util.UUID)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 AffinityTopologyVersion (org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion)1 GridDhtPartitionState (org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState)1