@Override public int getLocalSize() { return idToType.size(); } }
@Override public int size() { return map.size(); }
public int getMetaSize() { return this.redisMetaRegion.size() - RedisConstants.NUM_DEFAULT_KEYS; }
@Override public int size() { return getSessionRegion().size(); }
@Override public int getSize(String regionName) { security.authorize(DATA, READ, regionName, ALL); return getRegion(regionName).size(); }
@Override public int size() { try { preOp(); return this.realRegion.size(); } finally { postOp(); } }
/** * Mark all PDX types as requiring dispatch so that they will be sent over the connection again. * */ public void checkIfPdxNeedsResend(int remotePdxSize) { InternalCache cache = this.sender.getCache(); Region<Object, Object> pdxRegion = cache.getRegion(PeerTypeRegistration.REGION_NAME); // The peer has not seen all of our PDX types. This may be because // they have been lost on the remote side. Resend the PDX types. if (pdxRegion != null && pdxRegion.size() > remotePdxSize) { rebuildPdxList = true; } }
@Override public void execute(FunctionContext context) { RegionFunctionContext rfc = (RegionFunctionContext) context; context.getResultSender().lastResult(rfc.getDataSet().size()); }
protected void verify100Int(boolean verifySize) { if (verifySize) { assertEquals(100, region.size()); } for (int i = 0; i < 100; i++) { Integer key = i; assertTrue(region.containsKey(key)); assertEquals(key, region.get(key)); } }
public RegionDescriptionPerMember(Region<?, ?> region, String hostingMember) { this.regionAttributesInfo = new RegionAttributesInfo(region.getAttributes()); this.hostingMember = hostingMember; this.size = region.size(); this.name = region.getFullPath().substring(1); // For the replicated proxy if ((this.regionAttributesInfo.getDataPolicy().equals(DataPolicy.EMPTY) && this.regionAttributesInfo.getScope().equals(Scope.DISTRIBUTED_ACK))) { setAccessor(true); } // For the partitioned proxy if (this.regionAttributesInfo.getPartitionAttributesInfo() != null && this.regionAttributesInfo.getPartitionAttributesInfo().getLocalMaxMemory() == 0) { setAccessor(true); } }
@Test public void getSize() { authorize(DATA, READ, REGION, ALL); authorizingCache.getSize(REGION); verify(region).size(); }
public static void checkAsyncEventQueueSize(String asyncQueueId, int numQueueEntries, boolean localSize) { AsyncEventQueueImpl aeq = (AsyncEventQueueImpl) cache.getAsyncEventQueue(asyncQueueId); GatewaySender sender = aeq.getSender(); if (sender.isParallel()) { Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues(); Region queueRegion = queues.toArray(new RegionQueue[queues.size()])[0].getRegion(); if (localSize) { queueRegion = PartitionRegionHelper.getLocalData(queueRegion); } assertEquals(numQueueEntries, queueRegion.size()); } else { Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues(); int size = 0; for (RegionQueue q : queues) { size += q.size(); } assertEquals(numQueueEntries, size); } }
@Test public void processReturnsCacheRegions() throws Exception { RegionAttributes regionAttributesStub = mock(RegionAttributes.class); when(cacheStub.getRegion(TEST_REGION1)).thenReturn(region1Stub); when(region1Stub.getName()).thenReturn(TEST_REGION1); when(region1Stub.size()).thenReturn(10); when(region1Stub.getAttributes()).thenReturn(regionAttributesStub); when(regionAttributesStub.getDataPolicy()).thenReturn(DataPolicy.PERSISTENT_REPLICATE); when(regionAttributesStub.getKeyConstraint()).thenReturn(String.class); when(regionAttributesStub.getValueConstraint()).thenReturn(Integer.class); when(regionAttributesStub.getScope()).thenReturn(Scope.DISTRIBUTED_ACK); Result result = operationHandler.process(serializationService, MessageUtil.makeGetSizeRequest(TEST_REGION1), getNoAuthCacheExecutionContext(cacheStub)); RegionAPI.GetSizeResponse response = (RegionAPI.GetSizeResponse) result.getMessage(); Assert.assertEquals(10, response.getSize()); }
public MemoryHog printTenuredSize() { this.cache.getLogger().info( "Tenured data size: " + this.tenuredData.getName() + ": " + this.tenuredData.size()); return this; } }
@Override public void executeCommand(Command command, ExecutionHandlerContext context) { List<byte[]> commandElems = command.getProcessedCommand(); if (commandElems.size() < 3) { command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError())); return; } ByteArrayWrapper key = command.getKey(); Region<Integer, ByteArrayWrapper> keyRegion = getOrCreateRegion(context, key, RedisDataType.REDIS_LIST); pushElements(key, commandElems, START_VALUES_INDEX, commandElems.size(), keyRegion, pushType(), context); int listSize = keyRegion.size() - LIST_EMPTY_SIZE; command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), listSize)); }
private void initialize(Region region) { setNumberOfEntries(region.size()); EvictionAttributes ea = region.getAttributes().getEvictionAttributes(); if (ea != null && ea.getAlgorithm().isLRUMemory()) { setHeapSize(((InternalRegion) region).getEvictionCounter()); } else { setHeapSize(-1); } }
@Override public void executeCommand(Command command, ExecutionHandlerContext context) { List<byte[]> commandElems = command.getProcessedCommand(); if (commandElems.size() < 2) { command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZCARD)); return; } ByteArrayWrapper key = command.getKey(); Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key); checkDataType(key, RedisDataType.REDIS_SORTEDSET, context); if (keyRegion == null) command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS)); else command .setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), keyRegion.size())); } }
@Override public void executeCommand(Command command, ExecutionHandlerContext context) { List<byte[]> commandElems = command.getProcessedCommand(); if (commandElems.size() < 2) { command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HLEN)); return; } ByteArrayWrapper key = command.getKey(); checkDataType(key, RedisDataType.REDIS_HASH, context); Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key); if (keyRegion == null) { command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS)); return; } final int regionSize = keyRegion.size(); command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), regionSize)); }
@SuppressWarnings("unchecked") @Override public void executeCommand(Command command, ExecutionHandlerContext context) { List<byte[]> commandElems = command.getProcessedCommand(); if (commandElems.size() < 2) { command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SCARD)); return; } ByteArrayWrapper key = command.getKey(); checkDataType(key, RedisDataType.REDIS_SET, context); Region<ByteArrayWrapper, Boolean> keyRegion = (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key); if (keyRegion == null) { command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS)); return; } command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), keyRegion.size())); }
@Override public void executeCommand(Command command, ExecutionHandlerContext context) { List<byte[]> commandElems = command.getProcessedCommand(); if (commandElems.size() < 3) { command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError())); return; } ByteArrayWrapper key = command.getKey(); Region<Integer, ByteArrayWrapper> keyRegion = getRegion(context, key); if (keyRegion == null) { command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS)); return; } checkDataType(key, RedisDataType.REDIS_LIST, context); pushElements(key, commandElems, 2, 3, keyRegion, pushType(), context); int listSize = keyRegion.size() - LIST_EMPTY_SIZE; command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), listSize)); }