Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,42 @@ public static void addLinkNfly(final Configuration conf, final String src,
addLinkNfly(conf, getDefaultMountTableName(conf), src, null, targets);
}


/**
* Add a LinkRegex to the config for the specified mount table.
* @param conf - get mountable config from this conf
* @param mountTableName - the mountable name of the regex config item
* @param srcRegex - the src path regex expression that applies to this config
* @param targetStr - the string of target path
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method not used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I guess the next addLinkRegex is used but not this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

public static void addLinkRegex(
Configuration conf, final String mountTableName,
final String srcRegex, final String targetStr) {
addLinkRegex(conf, mountTableName, srcRegex, targetStr, null);
}

/**
* Add a LinkRegex to the config for the specified mount table.
* @param conf - get mountable config from this conf
* @param mountTableName - the mountable name of the regex config item
* @param srcRegex - the src path regex expression that applies to this config
* @param targetStr - the string of target path
* @param interceptorSettings - the serialized interceptor string to be
* applied while resolving the mapping
*/
public static void addLinkRegex(
Configuration conf, final String mountTableName, final String srcRegex,
final String targetStr, final String interceptorSettings) {
String prefix = getConfigViewFsPrefix(mountTableName) + "."
+ Constants.CONFIG_VIEWFS_LINK_REGEX + ".";
if ((interceptorSettings != null) && (!interceptorSettings.isEmpty())) {
prefix = prefix + interceptorSettings
+ RegexMountPoint.SETTING_SRCREGEX_SEP;
}
String key = prefix + srcRegex;
conf.set(key, targetStr);
}

/**
* Add config variable for homedir for default mount table
* @param conf - add to this conf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,34 @@ public interface Constants {
*/
String CONFIG_VIEWFS_LINK_MERGE_SLASH = "linkMergeSlash";

/**
* Config variable for specifying a regex link which uses regular expressions
* as source and target could use group captured in src.
* E.g. (^/(?<firstDir>\\w+), /prefix-${firstDir}) =>
* (/path1/file1 => /prefix-path1/file1)
*/
String CONFIG_VIEWFS_LINK_REGEX = "linkRegex";

FsPermission PERMISSION_555 = new FsPermission((short) 0555);

String CONFIG_VIEWFS_RENAME_STRATEGY = "fs.viewfs.rename.strategy";

/**
* Enable ViewFileSystem to cache all children filesystems in inner cache.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

below comment can be corrected? regex base mount point will not use caching now.
Otherwise people could confuse and may tend to disable. IIUC, even if they enable this, RegexBasedMountPoints will continue to work right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good cache, I should clarify it. ViewFileSystem will work if people enable inner cache. However, regex based mounts won't be cache.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the below comment is still valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch.

* The children filesystems generated by regex mount points won't be cached.
*/
String CONFIG_VIEWFS_ENABLE_INNER_CACHE = "fs.viewfs.enable.inner.cache";

boolean CONFIG_VIEWFS_ENABLE_INNER_CACHE_DEFAULT = true;

/**
* Whether to evict cached children file times on ViewFileSystem::close().
*/
String CONFIG_VIEWFS_INNER_CACHE_EVICT_ON_CLOSE =
"fs.viewfs.inner.cache.evict.on.close";

boolean CONFIG_VIEWFS_INNER_CACHE_EVICT_ON_CLOSE_DEFAULT = false;

/**
* Enable ViewFileSystem to show mountlinks as symlinks.
*/
Expand Down
Loading