PartitionedRegionDataStore implements HasCachePerfStats { public boolean isPartitionedRegionReady(PartitionedRegion partitionedRegion, final int bucketId) { List<PartitionedRegion> colocatedWithList = getColocatedChildRegions(partitionedRegion); if (colocatedWithList.size() == 0) { return partitionedRegion.isInitialized(); } return areAllColocatedPartitionedRegionsReady(bucketId, colocatedWithList); } PartitionedRegionDataStore();   PartitionedRegionDataStore(final PartitionedRegion pr, StatisticsClock statisticsClock); boolean isManagingBucket(int bucketId); short getBucketsManaged(); int getNumberOfPrimaryBucketsManaged(); boolean isPartitionedRegionReady(PartitionedRegion partitionedRegion, final int bucketId); Object lockRedundancyLock(InternalDistributedMember moveSource, int bucketId,
      boolean replaceOffineData); void releaseRedundancyLock(Object lock); void assignBucketRegion(int bucketId, BucketRegion bukReg); CacheLoader getCacheLoader(); long currentAllocatedMemory(); boolean handleManageBucketRequest(int bucketId, int size, InternalDistributedMember sender,
      boolean forceCreation); long getBucketSize(int bucketId); boolean putLocally(final Integer bucketId, final EntryEventImpl event, boolean ifNew,
      boolean ifOld, Object expectedOldValue, boolean requireOldValue, final long lastModified); boolean putLocally(final BucketRegion bucketRegion, final EntryEventImpl event,
      boolean ifNew, boolean ifOld, Object expectedOldValue, boolean requireOldValue,
      final long lastModified); PartitionedRegion getPartitionedRegion(); Object destroyLocally(Integer bucketId, EntryEventImpl event, Object expectedOldValue); boolean isRemotePrimaryReadyForColocatedChildren(int bucketId); boolean removeBucket(int bucketId, boolean forceRemovePrimary); CreateBucketResult createRedundantBucket(int bucketId, boolean isRebalance,
      InternalDistributedMember moveSource); boolean moveBucket(int bucketId, InternalDistributedMember source,
      final boolean isRebalance); BucketRegion getInitializedBucketForId(Object key, Integer bucketId); BucketRegion getLocalBucketById(Integer bucketId); BucketRegion getLocalBucketByKey(Object key); int getPerEntryLRUOverhead(); BucketRegion getInitializedBucketWithKnownPrimaryForId(Object key, Integer bucketId); boolean containsValueForKeyLocally(Integer bucketId, Object key); boolean containsKeyLocally(Integer bucketId, Object key); void invokeBucketReadHook(); void setBucketReadHook(Runnable r); Object getLocally(int bucketId, final Object key, final Object aCallbackArgument,
      boolean disableCopyOnRead, boolean preferCD, ClientProxyMembershipID requestingClient,
      EntryEventImpl clientEvent, boolean returnTombstones); Object getLocally(int bucketId, final Object key, final Object aCallbackArgument,
      boolean disableCopyOnRead, boolean preferCD, ClientProxyMembershipID requestingClient,
      EntryEventImpl clientEvent, boolean returnTombstones, boolean opScopeIsLocal); RawValue getSerializedLocally(KeyInfo keyInfo, boolean doNotLockEntry,
      ClientProxyMembershipID requestingClient, EntryEventImpl clientEvent,
      boolean returnTombstones); EntrySnapshot getEntryLocally(int bucketId, final Object key, boolean access,
      boolean allowTombstones); Set handleRemoteGetKeys(Integer bucketId, int interestType, Object interestArg,
      boolean allowTombstones); Set getKeysLocally(Integer bucketId, boolean allowTombstones); @Override String toString(); boolean createLocally(final BucketRegion bucketRegion, final EntryEventImpl event,
      boolean ifNew, boolean ifOld, boolean requireOldValue, final long lastModified); Map<Integer, Integer> getSizeLocally(); Map<Integer, Integer> getSizeLocally(boolean primaryOnly); Map<Integer, SizeEntry> getSizeForLocalBuckets(); Map<Integer, SizeEntry> getSizeForLocalPrimaryBuckets(); Map<Integer, SizeEntry> getSizeEstimateForLocalPrimaryBuckets(); Map<Integer, SizeEntry> getSizeLocallyForBuckets(Collection<Integer> bucketIds); Map<Integer, SizeEntry> getSizeEstimateLocallyForBuckets(Collection<Integer> bucketIds); int getSizeOfLocalPrimaryBuckets(); int getSizeOfLocalBuckets(); void visitBuckets(final BucketVisitor bv); List getEntries(); void dumpEntries(final boolean validateOnly); void dumpBackingMaps(); void dumpBuckets(); List getLocalBucketsListTestOnly(); @VisibleForTesting List<Integer> getLocalPrimaryBucketsListTestOnly(); List getLocalNonPrimaryBucketsListTestOnly(); void dumpBucket(int bucketId, final LocalRegion bucket); BucketRegion handleRemoteGetEntries(int bucketId); @Override CachePerfStats getCachePerfStats(); Set<Map.Entry<Integer, BucketRegion>> getAllLocalBuckets(); Set<Integer> getAllLocalBucketIds(); Set<BucketRegion> getAllLocalBucketRegions(); boolean isLocalBucketRegionPresent(); Set<BucketRegion> getAllLocalPrimaryBucketRegions(); Set<Integer> getAllLocalPrimaryBucketIds(); Set<Integer> getAllLocalPrimaryBucketIdsBetweenProvidedIds(int low, int high); long getEstimatedLocalBucketSize(boolean primaryOnly); long getEstimatedLocalBucketSize(Set<Integer> bucketIds); Object getLocalValueInVM(final Object key, int bucketId); Object getLocalValueOnDisk(final Object key, int bucketId); Object getLocalValueOnDiskOrBuffer(final Object key, int bucketId); void checkRegionDestroyedOnBucket(final BucketRegion br, final boolean isOriginRemote,
      RegionDestroyedException rde); CreateBucketResult grabBucket(final int bucketId,
      final InternalDistributedMember moveSource, final boolean forceCreation,
      final boolean replaceOffineData, final boolean isRebalance,
      final InternalDistributedMember creationRequestor, final boolean isDiskRecovery); boolean verifyBucketBeforeGrabbing(final int buckId); void executeOnDataStore(final Set localKeys, final Function function, final Object object,
      final int prid, final int[] bucketArray, final boolean isReExecute,
      final PartitionedRegionFunctionStreamingMessage msg, long time, ServerConnection servConn,
      int transactionID); boolean areAllBucketsHosted(final int[] bucketArray); boolean hasSeenEvent(EntryEventImpl event); void handleInterestEvent(InterestRegistrationEvent event); void updateEntryVersionLocally(Integer bucketId, EntryEventImpl event);  }
@Test public void returnRegionReadyIfAllColocatedRegionsAreReady() { PartitionedRegionDataStore partitionedRegionDataStore = spy(new PartitionedRegionDataStore()); setupColocatedRegions(partitionedRegionDataStore); assertThat(partitionedRegionDataStore.isPartitionedRegionReady(partitionedRegion, bucketId)) .isTrue(); }
@Test public void returnRegionNotReadyIfAColocatedRegionIsNotInitialized() { PartitionedRegionDataStore partitionedRegionDataStore = spy(new PartitionedRegionDataStore()); setupColocatedRegions(partitionedRegionDataStore); when(grandChildRegion2_2.isInitialized()).thenReturn(false); assertThat(partitionedRegionDataStore.isPartitionedRegionReady(partitionedRegion, bucketId)) .isFalse(); }