use of org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManager in project ignite by apache.
the class GridDistributedCacheAdapter method localSizeLong.
/** {@inheritDoc} */
@Override
public long localSizeLong(int partition, CachePeekMode[] peekModes) throws IgniteCheckedException {
PeekModes modes = parsePeekModes(peekModes, true);
long size = 0;
if (modes.near)
size += nearSize();
// Swap and offheap are disabled for near cache.
if (modes.offheap) {
AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion();
IgniteCacheOffheapManager offheap = ctx.offheap();
if (ctx.affinity().primaryByPartition(ctx.localNode(), partition, topVer) && modes.primary || ctx.affinity().backupByPartition(ctx.localNode(), partition, topVer) && modes.backup)
size += offheap.entriesCount(partition);
}
return size;
}
use of org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManager in project ignite by apache.
the class GridDistributedCacheAdapter method localSizeLong.
/** {@inheritDoc} */
@Override
public long localSizeLong(CachePeekMode[] peekModes) throws IgniteCheckedException {
PeekModes modes = parsePeekModes(peekModes, true);
long size = 0;
if (modes.near)
size += nearSize();
// Swap and offheap are disabled for near cache.
if (modes.primary || modes.backup) {
AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion();
IgniteCacheOffheapManager offheap = ctx.offheap();
if (modes.offheap)
size += offheap.entriesCount(modes.primary, modes.backup, topVer);
else if (modes.heap) {
for (GridDhtLocalPartition locPart : ctx.topology().currentLocalPartitions()) {
if ((modes.primary && locPart.primary(topVer)) || (modes.backup && locPart.backup(topVer)))
size += locPart.publicSize();
}
}
}
return size;
}
Aggregations