Skip to content

Commit

Permalink
Merge https://github.com/Alluxio/alluxio into alluxio-1728
Browse files Browse the repository at this point in the history
  • Loading branch information
caadecarvalho committed Feb 25, 2016
2 parents 5319b2b + dfb2658 commit 19fbcdd
Show file tree
Hide file tree
Showing 102 changed files with 798 additions and 645 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
import alluxio.annotation.PublicApi;
import alluxio.thrift.CompleteFileTOptions;

import com.google.common.base.Objects;

import javax.annotation.concurrent.NotThreadSafe;

/**
* The method option for completing a file.
* The method options for completing a file.
*/
@PublicApi
@NotThreadSafe
Expand Down Expand Up @@ -56,10 +58,7 @@ public CompleteFileOptions setUfsLength(long ufsLength) {
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder("CompleteFileOptions(");
sb.append(super.toString()).append(", UFS Length: ").append(mUfsLength);
sb.append(")");
return sb.toString();
return Objects.toStringHelper(this).add("ufsLength", mUfsLength).toString();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import alluxio.client.WriteType;
import alluxio.thrift.CreateDirectoryTOptions;

import com.google.common.base.Objects;

import javax.annotation.concurrent.NotThreadSafe;

/**
Expand Down Expand Up @@ -102,12 +104,8 @@ public CreateDirectoryOptions setWriteType(WriteType writeType) {
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder("CreateDirectoryOptions(");
sb.append(super.toString()).append(", AllowExists: ").append(mAllowExists);
sb.append(", Recursive: ").append(mRecursive);
sb.append(", UnderStorageType: ").append(mUnderStorageType.toString());
sb.append(")");
return sb.toString();
return Objects.toStringHelper(this).add("allowExists", mAllowExists)
.add("recursive", mRecursive).add("underStorageType", mUnderStorageType).toString();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import alluxio.thrift.CreateFileTOptions;
import alluxio.util.CommonUtils;

import com.google.common.base.Objects;
import com.google.common.base.Throwables;

import javax.annotation.concurrent.NotThreadSafe;
Expand All @@ -45,9 +46,6 @@ public static CreateFileOptions defaults() {
return new CreateFileOptions();
}

/**
* Creates a new instance with defaults from the configuration.
*/
private CreateFileOptions() {
Configuration conf = ClientContext.getConf();
mRecursive = true;
Expand Down Expand Up @@ -168,13 +166,8 @@ public OutStreamOptions toOutStreamOptions() {
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder("CreateFileOptions(");
sb.append(super.toString()).append(", BlockSizeBytes: ").append(mBlockSizeBytes);
sb.append(", TTL: ").append(mTtl);
sb.append(", Location Policy: ").append(mLocationPolicy);
sb.append(", WriteType: ").append(mWriteType.toString());
sb.append(")");
return sb.toString();
return Objects.toStringHelper(this).add("blockSizeBytes", mBlockSizeBytes).add("ttl", mTtl)
.add("locationPolicy", mLocationPolicy).add("writeType", mWriteType).toString();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@

import alluxio.annotation.PublicApi;

import com.google.common.base.Objects;

import javax.annotation.concurrent.NotThreadSafe;

/**
* Method option for deleting a file.
* Method options for deleting a file.
*/
@PublicApi
@NotThreadSafe
Expand Down Expand Up @@ -59,9 +61,6 @@ public DeleteOptions setRecursive(boolean recursive) {
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder("DeleteOptions(");
sb.append(super.toString()).append(", Recursive: ").append(mRecursive);
sb.append(")");
return sb.toString();
return Objects.toStringHelper(this).add("recursive", mRecursive).toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

import alluxio.annotation.PublicApi;

import com.google.common.base.Objects;

import javax.annotation.concurrent.NotThreadSafe;

/**
Expand All @@ -21,49 +23,22 @@
@PublicApi
@NotThreadSafe
public final class ExistsOptions {
/** Whether or not to check the ufs if the path does not exist in Alluxio. */
private boolean mCheckUfs;

/**
* @return the default {@link ExistsOptions} based on the client's configuration
* @return the default {@link ExistsOptions}
*/
public static ExistsOptions defaults() {
return new ExistsOptions();
}

private ExistsOptions() {
// TODO(calvin): Make this configurable
mCheckUfs = false;
}

/**
* @return whether we should check the under file system for the file if it is not found in
* Alluxio space
*/
public boolean isCheckUfs() {
return mCheckUfs;
}

/**
* Sets the checkUfs flag which determines if this operation should go to the ufs if the data
* is not found in Alluxio.
*
* @param checkUfs the check ufs flag to set
* @return the updated options object
*/
public ExistsOptions setCheckUfs(boolean checkUfs) {
mCheckUfs = checkUfs;
return this;
// No options currently
}

/**
* @return the name : value pairs for all the fields
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder("ExistsOptions(");
sb.append(super.toString()).append(", Check UFS: ").append(mCheckUfs);
sb.append(")");
return sb.toString();
return Objects.toStringHelper(this).toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@

import alluxio.annotation.PublicApi;

import com.google.common.base.Objects;

import javax.annotation.concurrent.NotThreadSafe;

/**
* Method option for freeing space.
* Method options for freeing space.
*/
@PublicApi
@NotThreadSafe
Expand Down Expand Up @@ -59,9 +61,6 @@ public FreeOptions setRecursive(boolean recursive) {
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder("FreeOptions(");
sb.append(super.toString()).append(", Recursive: ").append(mRecursive);
sb.append(")");
return sb.toString();
return Objects.toStringHelper(this).add("recursive", mRecursive).toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

import alluxio.annotation.PublicApi;

import com.google.common.base.Objects;

import javax.annotation.concurrent.NotThreadSafe;

/**
Expand All @@ -21,46 +23,22 @@
@PublicApi
@NotThreadSafe
public final class GetStatusOptions {
/** Whether or not to check the ufs if the path does not exist in Alluxio. */
private boolean mCheckUfs;

/**
* @return a default {@link GetStatusOptions} based on the client's configuration
* @return the default {@link GetStatusOptions}
*/
public static GetStatusOptions defaults() {
return new GetStatusOptions();
}

private GetStatusOptions() {
// TODO(calvin): Make this configurable
mCheckUfs = false;
}

/**
* @return whether we should sync the under file system for the file if it is not found in
* Alluxio space
*/
public boolean isCheckUfs() {
return mCheckUfs;
}

/**
* @param checkUfs the check ufs flag to set
* @return the updated options object
*/
public GetStatusOptions setCheckUfs(boolean checkUfs) {
mCheckUfs = checkUfs;
return this;
// No options currently
}

/**
* @return the name : value pairs for all the fields
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder("GetStatus(");
sb.append(super.toString()).append(", Check UFS: ").append(mCheckUfs);
sb.append(")");
return sb.toString();
return Objects.toStringHelper(this).toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
import alluxio.client.file.policy.FileWriteLocationPolicy;
import alluxio.util.CommonUtils;

import com.google.common.base.Objects;
import com.google.common.base.Throwables;

import javax.annotation.concurrent.NotThreadSafe;

/**
* Method option for reading a file.
* Method options for reading a file.
*/
@PublicApi
@NotThreadSafe
Expand Down Expand Up @@ -92,10 +93,7 @@ public InStreamOptions setReadType(ReadType readType) {
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder("InStreamOptions(");
sb.append(super.toString()).append(", ReadType: ").append(mReadType.toString());
sb.append(", LocationPolicy: ").append(mLocationPolicy.toString());
sb.append(")");
return sb.toString();
return Objects.toStringHelper(this).add("readType", mReadType)
.add("locationPolicy", mLocationPolicy).toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@

import alluxio.annotation.PublicApi;

import com.google.common.base.Objects;

import javax.annotation.concurrent.NotThreadSafe;

/**
* Method option for listing the status.
* Method options for listing the status.
*/
@PublicApi
@NotThreadSafe
public final class ListStatusOptions {
/** Whether or not to check the ufs if the path does not exist in Alluxio. */
private boolean mCheckUfs;

/**
* @return the default {@link ListStatusOptions}
*/
Expand All @@ -32,34 +31,14 @@ public static ListStatusOptions defaults() {
}

private ListStatusOptions() {
mCheckUfs = true;
}

/**
* @return whether we should sync the under file system for the file if it is not found in
* Alluxio space
*/
public boolean isCheckUfs() {
return mCheckUfs;
}

/**
* @param checkUfs the check ufs flag to set
* @return the updated options object
*/
public ListStatusOptions setCheckUfs(boolean checkUfs) {
mCheckUfs = checkUfs;
return this;
// No options currently
}

/**
* @return the name : value pairs for all the fields
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder("ListStatus(");
sb.append(super.toString()).append(", Check UFS: ").append(mCheckUfs);
sb.append(")");
return sb.toString();
return Objects.toStringHelper(this).toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@

import alluxio.annotation.PublicApi;

import com.google.common.base.Objects;

import javax.annotation.concurrent.NotThreadSafe;

/**
* Method option for loading the metadata.
* Method options for loading the metadata.
*/
@PublicApi
@NotThreadSafe
Expand Down Expand Up @@ -59,9 +61,6 @@ public LoadMetadataOptions setRecursive(boolean recursive) {
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder("LoadMetadataOptions(");
sb.append(super.toString()).append(", Recursive: ").append(mRecursive);
sb.append(")");
return sb.toString();
return Objects.toStringHelper(this).add("recursive", mRecursive).toString();
}
}
Loading

0 comments on commit 19fbcdd

Please sign in to comment.