ContentMirrorStoreStrategy implements IndexStoreStrategy { @Override public void update( Supplier<NodeBuilder> index, String path, @Nullable final String indexName, @Nullable final NodeBuilder indexMeta, Set<String> beforeKeys, Set<String> afterKeys) { for (String key : beforeKeys) { remove(index.get(), key, path); } for (String key : afterKeys) { insert(index.get(), key, path); } } ContentMirrorStoreStrategy();  ContentMirrorStoreStrategy(String indexName);  ContentMirrorStoreStrategy(String indexName, String pathPrefix, boolean prependPathPrefix); @Override void update(
            Supplier<NodeBuilder> index, String path,
            @Nullable final String indexName,
            @Nullable final NodeBuilder indexMeta,
            Set<String> beforeKeys, Set<String> afterKeys); Iterable<String> query(final Filter filter, final String indexName,
            final NodeState indexMeta, final String indexStorageNodeName,
            final Iterable<String> values); @Override Iterable<String> query(final Filter filter, final String name,
            final NodeState indexMeta, final Iterable<String> values); @Override long count(NodeState root, NodeState indexMeta, Set<String> values, int max); @Override long count(final Filter filter, NodeState root, NodeState indexMeta, Set<String> values, int max); @Override boolean exists(Supplier<NodeBuilder> index, String key); @Override String getIndexNodeName(); static final int TRAVERSING_WARN; }
@Test public void testIndexPruning() throws CommitFailedException { IndexStoreStrategy store = new ContentMirrorStoreStrategy(); NodeState root = EMPTY_NODE; NodeBuilder builder = root.builder(); Supplier<NodeBuilder> index = () -> builder; for (String path : asList("/", "a/b/c", "a/b/d", "b", "d/e", "d/e/f")) { store.update(index, path, null, null, EMPTY, KEY); } checkPath(builder, "key", "", true); checkPath(builder, "key", "a/b/c", true); checkPath(builder, "key", "a/b/d", true); checkPath(builder, "key", "b", true); checkPath(builder, "key", "d/e", true); checkPath(builder, "key", "d/e/f", true); store.update(index, "/", null, null, KEY, EMPTY); checkPath(builder, "key", "d/e/f", true); store.update(index, "d/e", null, null, KEY, EMPTY); checkPath(builder, "key", "d/e/f", true); store.update(index, "d/e/f", null, null, KEY, EMPTY); checkNotPath(builder, "key", "d"); store.update(index, "a/b/d", null, null, KEY, EMPTY); store.update(index, "a/b", null, null, KEY, EMPTY); checkPath(builder, "key", "a/b/c", true); store.update(index, "", null, null, EMPTY, KEY); store.update(index, "d/e/f", null, null, KEY, EMPTY); store.update(index, "b", null, null, KEY, EMPTY); store.update(index, "a/b/c", null, null, KEY, EMPTY); store.update(index, "", null, null, KEY, EMPTY); Assert.assertEquals(0, builder.getChildNodeCount(1)); }