public static String getSuggestDirName(Mount mount) { if (mount.isDefault()){ return SUGGEST_DATA_CHILD_NAME; } String name = mount.getPathFragmentName(); return ":" + name + SUGGEST_DIR_SUFFIX; }
private StrategyWrapper(UniqueEntryStoreStrategy strategy, NodeState indexNode, String indexName, MountedNodeStore nodeStore) { this.strategy = strategy; this.mount = nodeStore.getMount(); this.indexNode = indexNode; this.nodeStore = nodeStore; this.indexName = indexName; this.priority = mount.isDefault() ? PRIORITY_MOUNT : PRIORITY_DEFAULT; }
@NotNull public static String getPermissionRootName(@NotNull Mount mount, @NotNull String workspace) { if (mount.isDefault()) { return workspace; } else { return mount.getPathFragmentName() + "-" + workspace; } }
@Nonnull public static String getPermissionRootName(@Nonnull Mount mount, @Nonnull String workspace) { if (mount.isDefault()) { return workspace; } else { return mount.getPathFragmentName() + "-" + workspace; } }
public static String getIndexDirName(Mount mount) { if (mount.isDefault()){ return FulltextIndexConstants.INDEX_DATA_CHILD_NAME; } String name = mount.getPathFragmentName(); return ":" + name + INDEX_DIR_SUFFIX; }
public static String getIndexDirName(Mount mount) { if (mount.isDefault()){ return FulltextIndexConstants.INDEX_DATA_CHILD_NAME; } String name = mount.getPathFragmentName(); return ":" + name + INDEX_DIR_SUFFIX; }
@NotNull public static String getPermissionRootName(@NotNull Mount mount, @NotNull String workspace) { if (mount.isDefault()) { return workspace; } else { return mount.getPathFragmentName() + "-" + workspace; } }
public T get(MountedNodeStore nodeStore) { if (!suppliers.containsKey(nodeStore)) { Mount mount = nodeStore.getMount(); String mountName = mount.isDefault() ? "[default]" : mount.getName(); throw new IllegalStateException("Node is not available for the node store " + mountName); } return suppliers.get(nodeStore).get(); }
public static String getNodeForMount(Mount mount, String defaultName) { if (mount.isDefault()) { return defaultName; } return ":" + mount.getPathFragmentName() + asSuffix(defaultName); }
public static String getNodeForMount(Mount mount, String defaultName) { if (mount.isDefault()) { return defaultName; } return ":" + mount.getPathFragmentName() + asSuffix(defaultName); }
public static String getNodeForMount(Mount mount, String defaultName) { if (mount.isDefault()) { return defaultName; } return ":" + mount.getPathFragmentName() + asSuffix(defaultName); }
@Override public void onSwitchNodeToNative(Mount mount) { if (mount.isDefault()) { nodeSwitchToDefaultMount.inc(); } else { nodeSwitchToNonDefaultMount.inc(); } }
boolean shouldBeComposite(final String path) { boolean supportMounts = false; if (mip.getNonDefaultMounts().stream().anyMatch(m -> m.isSupportFragmentUnder(path))) { supportMounts = true; } else if (!mip.getMountsPlacedUnder(path).isEmpty()) { supportMounts = true; } return supportMounts && mip.getMountByPath(path).isDefault(); }
private StrategyWrapper getWrapper(Entry<Mount, NodeState> indexEntry, String indexName, Context ctx) { NodeState indexNode = indexEntry.getValue(); Mount mount = indexEntry.getKey(); MountedNodeStore mountedNodeStore = ctx.mountedNodeStoresByName.get(mount.getName()); UniqueEntryStoreStrategy strategy = mount.isDefault() ? new UniqueEntryStoreStrategy() : new UniqueEntryStoreStrategy(Multiplexers.getNodeForMount(mount, INDEX_CONTENT_NODE_NAME)); return new StrategyWrapper(strategy, indexNode.getChildNode(indexName), indexName, mountedNodeStore); } }
@Override public void deleteDocuments(String path) throws IOException { Mount mount = mountInfoProvider.getMountByPath(path); getWriter(mount).deleteDocuments(path); //In case of default mount look for other mounts with roots under this path //Note that one mount cannot be part of another mount if (mount.isDefault()) { //If any mount falls under given path then delete all documents in that for (Mount m : mountInfoProvider.getMountsPlacedUnder(path)) { getWriter(m).deleteAll(); } } }
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); }
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); }
@Test public void defaultMount() throws Exception { MountInfoProvider mip = new SimpleMountInfoProvider(Collections.<Mount>emptyList()); assertNotNull(mip.getMountByPath("/a")); assertTrue(mip.getMountByPath("/a").isDefault()); assertFalse(mip.hasNonDefaultMounts()); }
@Test public void basicMounting() throws Exception { MountInfoProvider mip = Mounts.newBuilder() .mount("foo", "/a", "/b") .mount("bar", "/x", "/y") .build(); assertEquals("foo", mip.getMountByPath("/a").getName()); assertEquals("foo", mip.getMountByPath("/a/x").getName()); assertEquals("bar", mip.getMountByPath("/x").getName()); assertTrue(mip.getMountByPath("/z").isDefault()); assertTrue(mip.hasNonDefaultMounts()); }