private static IndexStoreStrategy newMirrorStrategy(String defaultName) { if (INDEX_CONTENT_NODE_NAME.equals(defaultName)) { return MIRROR; } else { return new ContentMirrorStoreStrategy(defaultName); } }
private static IndexStoreStrategy newMirrorStrategy(String defaultName) { if (INDEX_CONTENT_NODE_NAME.equals(defaultName)) { return MIRROR; } else { return new ContentMirrorStoreStrategy(defaultName); } }
private static IndexStoreStrategy newMirrorStrategy(String defaultName) { if (INDEX_CONTENT_NODE_NAME.equals(defaultName)) { return MIRROR; } else { return new ContentMirrorStoreStrategy(defaultName); } }
private Iterable<String> queryBucket(Filter filter, String indexName, NodeState propIndexNode, String bucketPropName, Set<String> values) { String bucketName = propIndexNode.getString(bucketPropName); if (bucketName == null) { return Collections.emptyList(); } NodeState bucket = propIndexNode.getChildNode(bucketName); if (bucket.getChildNodeCount(1) == 0) { return Collections.emptyList(); } ContentMirrorStoreStrategy s = new ContentMirrorStoreStrategy(bucketName, pathPrefix, prependPathPrefix); return s.query(filter, indexName, propIndexNode, bucketName, values); } }
private static IndexStoreStrategy newStrategy(boolean unique, boolean defaultMount, String name, Mount m) { Predicate<String> filter = newFilter(m); boolean readOnly = unique && !m.isDefault() && RO_PRIVATE_UNIQUE_INDEX; return unique ? new FilteringIndexStoreStrategy( new UniqueEntryStoreStrategy(name), filter, readOnly) : new FilteringIndexStoreStrategy( new ContentMirrorStoreStrategy(name), filter); }
private Iterable<String> queryBucket(Filter filter, String indexName, NodeState propIndexNode, String bucketPropName, Set<String> values) { String bucketName = propIndexNode.getString(bucketPropName); if (bucketName == null) { return Collections.emptyList(); } NodeState bucket = propIndexNode.getChildNode(bucketName); if (bucket.getChildNodeCount(1) == 0) { return Collections.emptyList(); } ContentMirrorStoreStrategy s = new ContentMirrorStoreStrategy(bucketName, pathPrefix, prependPathPrefix); return s.query(filter, indexName, propIndexNode, bucketName, values); } }
private static IndexStoreStrategy newStrategy(boolean unique, boolean defaultMount, String name, Mount m) { Predicate<String> filter = newFilter(m); boolean readOnly = unique && !m.isDefault() && RO_PRIVATE_UNIQUE_INDEX; return unique ? new FilteringIndexStoreStrategy( new UniqueEntryStoreStrategy(name), filter, readOnly) : new FilteringIndexStoreStrategy( new ContentMirrorStoreStrategy(name), filter); }
private static IndexStoreStrategy newStrategy(boolean unique, boolean defaultMount, String name, Mount m) { Predicate<String> filter = newFilter(m); boolean readOnly = unique && !m.isDefault() && RO_PRIVATE_UNIQUE_INDEX; return unique ? new FilteringIndexStoreStrategy( new UniqueEntryStoreStrategy(name), filter, readOnly) : new FilteringIndexStoreStrategy( new ContentMirrorStoreStrategy(name), filter); }
uniquenessConstraintValidator.add(propertyRelativePath, afterKeys); } else { ContentMirrorStoreStrategy s = new ContentMirrorStoreStrategy(); s.update(ofInstance(indexNode), nodePath,
uniquenessConstraintValidator.add(propertyRelativePath, afterKeys); } else { ContentMirrorStoreStrategy s = new ContentMirrorStoreStrategy(); s.update(ofInstance(indexNode), nodePath,
@Test public void testUnique() throws CommitFailedException { IndexStoreStrategy store = new ContentMirrorStoreStrategy(); NodeState root = EMPTY_NODE; NodeBuilder indexMeta = root.builder(); Supplier<NodeBuilder> index = memoize(() -> indexMeta.child(INDEX_CONTENT_NODE_NAME)); store.update(index, "a", null, null, EMPTY, KEY); store.update(index, "b", null, null, EMPTY, KEY); Assert.assertTrue( "ContentMirrorStoreStrategy should guarantee uniqueness on insert", store.count(root, indexMeta.getNodeState(), Collections.singleton("key"), 2) > 1); }
@Test public void nonRootStorage() throws Exception{ IndexStoreStrategy store = new ContentMirrorStoreStrategy(INDEX_CONTENT_NODE_NAME, "/content", false); NodeState root = EMPTY_NODE; NodeBuilder builder = root.builder(); Supplier<NodeBuilder> index = () -> builder; for (String path : asList("a", "a/c", "b")) { store.update(index, path, null, null, EMPTY, KEY); } FilterImpl filter = FilterImpl.newTestInstance(); filter.restrictPath("/content", Filter.PathRestriction.ALL_CHILDREN); NodeBuilder indexMeta = EMPTY_NODE.builder(); indexMeta.setChildNode(INDEX_CONTENT_NODE_NAME, builder.getNodeState()); Iterable<String> paths = store.query(filter, null, indexMeta.getNodeState(), KEY); assertThat(copyOf(paths), containsInAnyOrder("a", "a/c", "b")); FilterImpl filter2 = FilterImpl.newTestInstance(); filter2.restrictPath("/content/a", Filter.PathRestriction.ALL_CHILDREN); paths = store.query(filter2, null, indexMeta.getNodeState(), KEY); assertThat(copyOf(paths), containsInAnyOrder("a", "a/c")); store = new ContentMirrorStoreStrategy(INDEX_CONTENT_NODE_NAME, "/content", true); paths = store.query(filter, null, indexMeta.getNodeState(), KEY); assertThat(copyOf(paths), containsInAnyOrder("/content/a", "/content/a/c", "/content/b")); paths = store.query(filter2, null, indexMeta.getNodeState(), KEY); assertThat(copyOf(paths), containsInAnyOrder("/content/a", "/content/a/c")); }
final String approxPropName = COUNT_PROPERTY_PREFIX + "gen_uuid"; IndexStoreStrategy store = new ContentMirrorStoreStrategy(); NodeState root = EMPTY_NODE; NodeBuilder indexMeta = root.builder();
final String approxPropName = COUNT_PROPERTY_PREFIX + "gen_uuid"; IndexStoreStrategy store = new ContentMirrorStoreStrategy(); NodeBuilder rootBuilder = EMPTY_NODE.builder();
IndexStoreStrategy store = new ContentMirrorStoreStrategy();