@Test public void compatibleWith() { final RecordStoreState empty = stateOf(); final RecordStoreState oneWriteOnly = stateOf("one", IndexState.WRITE_ONLY); final RecordStoreState oneDisabled = stateOf("one", IndexState.DISABLED); final RecordStoreState hasBoth = stateOf("one", IndexState.WRITE_ONLY, "two", IndexState.DISABLED); assertTrue(empty.compatibleWith(oneWriteOnly)); assertFalse(oneWriteOnly.compatibleWith(empty)); assertTrue(empty.compatibleWith(oneDisabled)); assertFalse(oneDisabled.compatibleWith(empty)); assertTrue(empty.compatibleWith(hasBoth)); assertFalse(hasBoth.compatibleWith(empty)); assertTrue(oneDisabled.compatibleWith(oneWriteOnly)); assertTrue(oneWriteOnly.compatibleWith(oneDisabled)); assertTrue(oneWriteOnly.compatibleWith(hasBoth)); assertFalse(hasBoth.compatibleWith(oneWriteOnly)); assertTrue(oneDisabled.compatibleWith(hasBoth)); assertFalse(hasBoth.compatibleWith(oneDisabled)); }
public boolean compatibleWith(@Nonnull RecordStoreState other) { return indexStateMap.get().entrySet().stream().allMatch(entry -> { boolean readableInOther = other.getState(entry.getKey()).equals(IndexState.READABLE); return entry.getValue().equals(IndexState.READABLE) == readableInOther; }); }
RecordStoreState { public boolean compatibleWith(@Nonnull RecordStoreState other) { return indexStateMap.get().entrySet().stream().allMatch(entry -> { boolean readableInOther = other.getState(entry.getKey()).equals(IndexState.READABLE); return entry.getValue().equals(IndexState.READABLE) == readableInOther; }); } }
RecordStoreState { public boolean compatibleWith(@Nonnull RecordStoreState other) { return indexStateMap.get().entrySet().stream().allMatch(entry -> { boolean readableInOther = other.getState(entry.getKey()).equals(IndexState.READABLE); return entry.getValue().equals(IndexState.READABLE) == readableInOther; }); } @API(API.Status.INTERNAL)  RecordStoreState(@Nullable RecordMetaDataProto.DataStoreInfo storeHeader, @Nullable Map<String, IndexState> indexStateMap); @Deprecated  RecordStoreState(@Nullable Map<String, IndexState> indexStateMap); @Deprecated  RecordStoreState(); }
RecordStoreState { public boolean compatibleWith(@Nonnull RecordStoreState other) { return indexStateMap.get().entrySet().stream().allMatch(entry -> { boolean readableInOther = other.getState(entry.getKey()).equals(IndexState.READABLE); return entry.getValue().equals(IndexState.READABLE) == readableInOther; }); } @API(API.Status.INTERNAL)  RecordStoreState(@Nullable RecordMetaDataProto.DataStoreInfo storeHeader, @Nullable Map<String, IndexState> indexStateMap); @Deprecated  RecordStoreState(@Nullable Map<String, IndexState> indexStateMap); @Deprecated  RecordStoreState(); void beginRead(); void endRead(); @Nonnull Map<String, IndexState> getIndexStates(); boolean isWriteOnly(@Nonnull Index index); boolean isWriteOnly(@Nonnull String indexName); boolean isDisabled(@Nonnull Index index); boolean isDisabled(@Nonnull String indexName); boolean isReadable(@Nonnull Index index); boolean isReadable(@Nonnull String indexName); @Nonnull IndexState getState(@Nonnull Index index); @Nonnull IndexState getState(@Nonnull String indexName); boolean allIndexesReadable(); boolean compatibleWith(@Nonnull RecordStoreState other); Set<String> getWriteOnlyIndexNames(); Set<String> getDisabledIndexNames(); @Nonnull RecordStoreState withIndexesInState(@Nonnull final List<String> indexNames,
                                               @Nonnull IndexState state); @Nonnull RecordStoreState withWriteOnlyIndexes(@Nonnull final List<String> writeOnlyIndexNames); @Nonnull RecordMetaDataProto.DataStoreInfo getStoreHeader(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Nonnull RecordStoreState toImmutable(); @Nonnull MutableRecordStoreState toMutable(); }
RecordStoreState { public boolean compatibleWith(@Nonnull RecordStoreState other) { return indexStateMap.get().entrySet().stream().allMatch(entry -> { boolean readableInOther = other.getState(entry.getKey()).equals(IndexState.READABLE); return entry.getValue().equals(IndexState.READABLE) == readableInOther; }); } @API(API.Status.INTERNAL)  RecordStoreState(@Nullable RecordMetaDataProto.DataStoreInfo storeHeader, @Nullable Map<String, IndexState> indexStateMap); @Deprecated  RecordStoreState(@Nullable Map<String, IndexState> indexStateMap); @Deprecated  RecordStoreState(); void beginRead(); void endRead(); @Nonnull Map<String, IndexState> getIndexStates(); boolean isWriteOnly(@Nonnull Index index); boolean isWriteOnly(@Nonnull String indexName); boolean isDisabled(@Nonnull Index index); boolean isDisabled(@Nonnull String indexName); boolean isReadable(@Nonnull Index index); boolean isReadable(@Nonnull String indexName); @Nonnull IndexState getState(@Nonnull Index index); @Nonnull IndexState getState(@Nonnull String indexName); boolean allIndexesReadable(); boolean compatibleWith(@Nonnull RecordStoreState other); Set<String> getWriteOnlyIndexNames(); Set<String> getDisabledIndexNames(); @Nonnull RecordStoreState withIndexesInState(@Nonnull final List<String> indexNames,
                                               @Nonnull IndexState state); @Nonnull RecordStoreState withWriteOnlyIndexes(@Nonnull final List<String> writeOnlyIndexNames); @Nonnull RecordMetaDataProto.DataStoreInfo getStoreHeader(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Nonnull RecordStoreState toImmutable(); @Nonnull MutableRecordStoreState toMutable(); @Deprecated
    @Nonnull
    static final RecordStoreState EMPTY; }