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,6 +86,14 @@ 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";
Expand Down
Loading