Skip to content

Commit

Permalink
load metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
peisun1115 committed May 13, 2016
1 parent 52bd5fc commit 1c1771a
Show file tree
Hide file tree
Showing 43 changed files with 506 additions and 182 deletions.
Expand Up @@ -238,7 +238,7 @@ public synchronized void loadMetadata(final AlluxioURI path,
retryRPC(new RpcCallableThrowsAlluxioTException<Long>() {
@Override
public Long call() throws AlluxioTException, TException {
return mClient.loadMetadata(path.toString(), options.isRecursive());
return mClient.loadMetadata(path.toString(), options.toThrift());
}
});
}
Expand Down
Expand Up @@ -12,6 +12,7 @@
package alluxio.client.file.options;

import alluxio.annotation.PublicApi;
import alluxio.thrift.LoadMetadataTOptions;

import com.google.common.base.Objects;

Expand All @@ -24,6 +25,7 @@
@NotThreadSafe
public final class LoadMetadataOptions {
private boolean mRecursive;
private boolean mLoadDirectChildren;

/**
* @return the default {@link LoadMetadataOptions}
Expand All @@ -34,6 +36,7 @@ public static LoadMetadataOptions defaults() {

private LoadMetadataOptions() {
mRecursive = false;
mLoadDirectChildren = false;
}

/**
Expand All @@ -44,6 +47,14 @@ public boolean isRecursive() {
return mRecursive;
}

/**
* @return the load direct children flag. It specifies whether the direct children should
* be loaded.
*/
public boolean isLoadDirectChildren() {
return mLoadDirectChildren;
}

/**
* Sets the recursive flag.
*
Expand All @@ -56,6 +67,18 @@ public LoadMetadataOptions setRecursive(boolean recursive) {
return this;
}

/**
* Sets the load direct children flag.
*
* @param loadDirectChildren the load direct children flag. It specifies whether the direct
* children should be loaded.
* @return the updated object
*/
public LoadMetadataOptions setLoadDirectChildren(boolean loadDirectChildren) {
mLoadDirectChildren = loadDirectChildren;
return this;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand All @@ -65,18 +88,28 @@ public boolean equals(Object o) {
return false;
}
LoadMetadataOptions that = (LoadMetadataOptions) o;
return Objects.equal(mRecursive, that.mRecursive);
return Objects.equal(mRecursive, that.mRecursive)
&& Objects.equal(mLoadDirectChildren, that.mLoadDirectChildren);
}

@Override
public int hashCode() {
return Objects.hashCode(mRecursive);
return Objects.hashCode(mRecursive, mLoadDirectChildren);
}

@Override
public String toString() {
return Objects.toStringHelper(this)
.add("recursive", mRecursive)
.toString();
return Objects.toStringHelper(this).add("recursive", mRecursive)
.add("loadDirectChildren", mLoadDirectChildren).toString();
}

/**
* @return the thrift representation of the options
*/
public LoadMetadataTOptions toThrift() {
LoadMetadataTOptions options = new LoadMetadataTOptions();
options.setRecursive(mRecursive);
options.setLoadDirectChildren(mLoadDirectChildren);
return options;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/common/src/main/java/alluxio/thrift/BlockInfo.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/common/src/main/java/alluxio/thrift/Command.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/common/src/main/java/alluxio/thrift/FileInfo.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1c1771a

Please sign in to comment.