Skip to content

HADOOP-17039. Change scope of InternalDirOfViewFs and InodeTree to make ViewFileSystem extendable outside common package #2017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@
* </ul>
*/

@InterfaceAudience.Private
@InterfaceAudience.Public
@InterfaceStability.Evolving /*Evolving for a release,to be changed to Stable */
class ChRootedFileSystem extends FilterFileSystem {
public class ChRootedFileSystem extends FilterFileSystem {
private final URI myUri; // the base URI + the chRoot
private final Path chRootPathPart; // the root below the root of the base
private final String chRootPathPartString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.apache.hadoop.fs.viewfs;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;

/**
Expand Down Expand Up @@ -85,4 +86,6 @@ public interface Constants {
String CONFIG_VIEWFS_ENABLE_INNER_CACHE = "fs.viewfs.enable.inner.cache";

boolean CONFIG_VIEWFS_ENABLE_INNER_CACHE_DEFAULT = true;

Path ROOT_PATH = new Path(Path.SEPARATOR);
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
* {@link #resolve(String, boolean)}
*/

@InterfaceAudience.Private
@InterfaceAudience.Public
@InterfaceStability.Unstable
abstract class InodeTree<T> {
public abstract class InodeTree<T> {
enum ResultKind {
INTERNAL_DIR,
EXTERNAL_DIR
Expand Down Expand Up @@ -119,7 +119,7 @@ boolean isLink() {
* Internal class to represent an internal dir of the mount table.
* @param <T>
*/
static class INodeDir<T> extends INode<T> {
public static class INodeDir<T> extends INode<T> {
private final Map<String, INode<T>> children = new HashMap<>();
private T internalDirFs = null; //filesystem of this internal directory
private boolean isRoot = false;
Expand Down Expand Up @@ -448,7 +448,7 @@ Configuration getConfig() {
* @throws FileAlreadyExistsException
* @throws IOException
*/
protected InodeTree(final Configuration config, final String viewName)
public InodeTree(final Configuration config, final String viewName)
throws UnsupportedFileSystemException, URISyntaxException,
FileAlreadyExistsException, IOException {
String mountTableName = viewName;
Expand Down Expand Up @@ -600,7 +600,7 @@ protected InodeTree(final Configuration config, final String viewName)
* If the input pathname leads to an internal mount-table entry then
* the target file system is one that represents the internal inode.
*/
static class ResolveResult<T> {
public static class ResolveResult<T> {
final ResultKind kind;
final T targetFileSystem;
final String resolvedPath;
Expand All @@ -614,8 +614,23 @@ static class ResolveResult<T> {
remainingPath = remainingP;
}

// Gets the target filesystem the path is pointing to
public T getTargetFileSystem() {
return targetFileSystem;
}

// Gets the resolved path from the result
public String getResolvedPath() {
return resolvedPath;
}

// Gets the remaining path from the result
public Path getRemainingPath() {
return remainingPath;
}

// Internal dir path resolution completed within the mount table
boolean isInternalDir() {
public boolean isInternalDir() {
return (kind == ResultKind.INTERNAL_DIR);
}
}
Expand All @@ -627,7 +642,7 @@ boolean isInternalDir() {
* @return ResolveResult which allows further resolution of the remaining path
* @throws FileNotFoundException
*/
ResolveResult<T> resolve(final String p, final boolean resolveLastComponent)
public ResolveResult<T> resolve(final String p, final boolean resolveLastComponent)
throws FileNotFoundException {
String[] path = breakIntoPathComponents(p);
if (path.length <= 1) { // special case for when path is "/"
Expand Down
Loading