本文整理汇总了Java中org.apache.hadoop.fs.XAttrSetFlag类的典型用法代码示例。如果您正苦于以下问题:Java XAttrSetFlag类的具体用法?Java XAttrSetFlag怎么用?Java XAttrSetFlag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XAttrSetFlag类属于org.apache.hadoop.fs包,在下文中一共展示了XAttrSetFlag类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setXAttrs
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
@Override
public void setXAttrs(Map<String, List<XAttr>> xAttrsToSet, EnumSet<XAttrSetFlag> flag)
throws IOException {
SetXAttrsRequestProto.Builder builder = SetXAttrsRequestProto.newBuilder();
for (String src : xAttrsToSet.keySet()) {
List<XAttr> xAttrs = xAttrsToSet.get(src);
SetXAttrSingleRequestProto singleReq = SetXAttrSingleRequestProto.newBuilder()
.setSrc(src)
.addAllXAttr(NuCypherExtPBHelperClient.convertXAttrProto(xAttrs))
.build();
builder.addXAttrsToSet(singleReq);
}
SetXAttrsRequestProto req = builder.setFlag(NuCypherExtPBHelperClient.convert(flag)).build();
try {
rpcProxy.setXAttrs(null, req);
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:21,代码来源:NuCypherExtClientNamenodeProtocolTranslatorPB.java
示例2: setXAttr
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
public void setXAttr(String src, String name, byte[] value,
EnumSet<XAttrSetFlag> flag) throws IOException {
checkOpen();
TraceScope scope = getPathTraceScope("setXAttr", src);
try {
namenode.setXAttr(src, XAttrHelper.buildXAttr(name, value), flag);
} catch (RemoteException re) {
throw re.unwrapRemoteException(AccessControlException.class,
FileNotFoundException.class,
NSQuotaExceededException.class,
SafeModeException.class,
SnapshotAccessControlException.class,
UnresolvedPathException.class);
} finally {
scope.close();
}
}
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:DFSClient.java
示例3: setFileEncryptionInfo
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
/**
* Set the FileEncryptionInfo for an INode.
*/
void setFileEncryptionInfo(String src, FileEncryptionInfo info)
throws IOException {
// Make the PB for the xattr
final HdfsProtos.PerFileEncryptionInfoProto proto =
PBHelper.convertPerFileEncInfo(info);
final byte[] protoBytes = proto.toByteArray();
final XAttr fileEncryptionAttr =
XAttrHelper.buildXAttr(CRYPTO_XATTR_FILE_ENCRYPTION_INFO, protoBytes);
final List<XAttr> xAttrs = Lists.newArrayListWithCapacity(1);
xAttrs.add(fileEncryptionAttr);
writeLock();
try {
FSDirXAttrOp.unprotectedSetXAttrs(this, src, xAttrs,
EnumSet.of(XAttrSetFlag.CREATE));
} finally {
writeUnlock();
}
}
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:FSDirectory.java
示例4: setXAttr
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
void setXAttr(String src, XAttr xAttr, EnumSet<XAttrSetFlag> flag,
boolean logRetryCache)
throws IOException {
checkOperation(OperationCategory.WRITE);
HdfsFileStatus auditStat = null;
writeLock();
try {
checkOperation(OperationCategory.WRITE);
checkNameNodeSafeMode("Cannot set XAttr on " + src);
auditStat = FSDirXAttrOp.setXAttr(dir, src, xAttr, flag, logRetryCache);
} catch (AccessControlException e) {
logAuditEvent(false, "setXAttr", src);
throw e;
} finally {
writeUnlock();
}
getEditLog().logSync();
logAuditEvent(true, "setXAttr", src, null, auditStat);
}
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:FSNamesystem.java
示例5: setXAttr
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
@Override // ClientProtocol
public void setXAttr(String src, XAttr xAttr, EnumSet<XAttrSetFlag> flag)
throws IOException {
checkNNStartup();
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
if (cacheEntry != null && cacheEntry.isSuccess()) {
return; // Return previous response
}
boolean success = false;
try {
namesystem.setXAttr(src, xAttr, flag, cacheEntry != null);
success = true;
} finally {
RetryCache.setState(cacheEntry, success);
}
}
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:NameNodeRpcServer.java
示例6: setXAttr
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
/**
* Set xattr for a file or directory.
*
* @param src
* - path on which it sets the xattr
* @param xAttr
* - xAttr details to set
* @param flag
* - xAttrs flags
* @throws IOException
*/
static HdfsFileStatus setXAttr(
FSDirectory fsd, String src, XAttr xAttr, EnumSet<XAttrSetFlag> flag,
boolean logRetryCache)
throws IOException {
checkXAttrsConfigFlag(fsd);
checkXAttrSize(fsd, xAttr);
FSPermissionChecker pc = fsd.getPermissionChecker();
XAttrPermissionFilter.checkPermissionForApi(
pc, xAttr, FSDirectory.isReservedRawName(src));
byte[][] pathComponents = FSDirectory.getPathComponentsForReservedPath(src);
src = fsd.resolvePath(pc, src, pathComponents);
List<XAttr> xAttrs = Lists.newArrayListWithCapacity(1);
xAttrs.add(xAttr);
INodesInPath iip;
fsd.writeLock();
try {
iip = fsd.getINodesInPath4Write(src);
checkXAttrChangeAccess(fsd, iip, xAttr, pc);
unprotectedSetXAttrs(fsd, src, xAttrs, flag);
} finally {
fsd.writeUnlock();
}
fsd.getEditLog().logSetXAttrs(src, xAttrs, logRetryCache);
return fsd.getAuditFileInfo(iip);
}
开发者ID:naver,项目名称:hadoop,代码行数:37,代码来源:FSDirXAttrOp.java
示例7: testXAttrsTrackedOnStandby
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
/**
* Test that xattrs are properly tracked by the standby
*/
@Test(timeout = 60000)
public void testXAttrsTrackedOnStandby() throws Exception {
fs.create(path).close();
fs.setXAttr(path, name1, value1, EnumSet.of(XAttrSetFlag.CREATE));
fs.setXAttr(path, name2, value2, EnumSet.of(XAttrSetFlag.CREATE));
HATestUtil.waitForStandbyToCatchUp(nn0, nn1);
List<XAttr> xAttrs = nn1.getRpcServer().getXAttrs("/file", null);
assertEquals(2, xAttrs.size());
cluster.shutdownNameNode(0);
// Failover the current standby to active.
cluster.shutdownNameNode(0);
cluster.transitionToActive(1);
Map<String, byte[]> xattrs = fs.getXAttrs(path);
Assert.assertEquals(xattrs.size(), 2);
Assert.assertArrayEquals(value1, xattrs.get(name1));
Assert.assertArrayEquals(value2, xattrs.get(name2));
fs.delete(path, true);
}
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:TestXAttrsWithHA.java
示例8: setXAttr
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
void setXAttr(String src, XAttr xAttr, EnumSet<XAttrSetFlag> flag,
boolean logRetryCache)
throws IOException {
HdfsFileStatus auditStat = null;
writeLock();
try {
checkOperation(OperationCategory.WRITE);
checkNameNodeSafeMode("Cannot set XAttr on " + src);
auditStat = FSDirXAttrOp.setXAttr(dir, src, xAttr, flag, logRetryCache);
} catch (AccessControlException e) {
logAuditEvent(false, "setXAttr", src);
throw e;
} finally {
writeUnlock();
}
getEditLog().logSync();
logAuditEvent(true, "setXAttr", src, null, auditStat);
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:19,代码来源:FSNamesystem.java
示例9: setFileEncryptionInfo
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
/**
* Set the FileEncryptionInfo for an INode.
*
* @param fsd fsdirectory
* @param src the path of a directory which will be the root of the
* encryption zone.
* @param info file encryption information
* @throws IOException
*/
static void setFileEncryptionInfo(final FSDirectory fsd, final String src,
final FileEncryptionInfo info) throws IOException {
// Make the PB for the xattr
final HdfsProtos.PerFileEncryptionInfoProto proto =
PBHelperClient.convertPerFileEncInfo(info);
final byte[] protoBytes = proto.toByteArray();
final XAttr fileEncryptionAttr =
XAttrHelper.buildXAttr(CRYPTO_XATTR_FILE_ENCRYPTION_INFO, protoBytes);
final List<XAttr> xAttrs = Lists.newArrayListWithCapacity(1);
xAttrs.add(fileEncryptionAttr);
fsd.writeLock();
try {
FSDirXAttrOp.unprotectedSetXAttrs(fsd, src, xAttrs,
EnumSet.of(XAttrSetFlag.CREATE));
} finally {
fsd.writeUnlock();
}
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:28,代码来源:FSDirEncryptionZoneOp.java
示例10: setXAttr
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
@Override // ClientProtocol
public void setXAttr(String src, XAttr xAttr, EnumSet<XAttrSetFlag> flag)
throws IOException {
checkNNStartup();
namesystem.checkOperation(OperationCategory.WRITE);
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
if (cacheEntry != null && cacheEntry.isSuccess()) {
return; // Return previous response
}
boolean success = false;
try {
namesystem.setXAttr(src, xAttr, flag, cacheEntry != null);
success = true;
} finally {
RetryCache.setState(cacheEntry, success);
}
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:18,代码来源:NameNodeRpcServer.java
示例11: setFileEncryptionInfo
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
/**
* Set the FileEncryptionInfo for an INode.
*/
void setFileEncryptionInfo(String src, FileEncryptionInfo info)
throws IOException {
// Make the PB for the xattr
final HdfsProtos.PerFileEncryptionInfoProto proto =
PBHelper.convertPerFileEncInfo(info);
final byte[] protoBytes = proto.toByteArray();
final XAttr fileEncryptionAttr =
XAttrHelper.buildXAttr(CRYPTO_XATTR_FILE_ENCRYPTION_INFO, protoBytes);
final List<XAttr> xAttrs = Lists.newArrayListWithCapacity(1);
xAttrs.add(fileEncryptionAttr);
writeLock();
try {
unprotectedSetXAttrs(src, xAttrs, EnumSet.of(XAttrSetFlag.CREATE));
} finally {
writeUnlock();
}
}
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:22,代码来源:FSDirectory.java
示例12: setXAttr
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
/**
* Set xattr for a file or directory.
*
* @param src
* - path on which it sets the xattr
* @param xAttr
* - xAttr details to set
* @param flag
* - xAttrs flags
* @throws AccessControlException
* @throws SafeModeException
* @throws UnresolvedLinkException
* @throws IOException
*/
void setXAttr(String src, XAttr xAttr, EnumSet<XAttrSetFlag> flag)
throws AccessControlException, SafeModeException,
UnresolvedLinkException, IOException {
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
if (cacheEntry != null && cacheEntry.isSuccess()) {
return; // Return previous response
}
boolean success = false;
try {
setXAttrInt(src, xAttr, flag, cacheEntry != null);
success = true;
} catch (AccessControlException e) {
logAuditEvent(false, "setXAttr", src);
throw e;
} finally {
RetryCache.setState(cacheEntry, success);
}
}
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:33,代码来源:FSNamesystem.java
示例13: setXAttr
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
@Override
public void setXAttr(Path path, String name, byte[] value,
EnumSet<XAttrSetFlag> flag) throws IOException {
InodeTree.ResolveResult<FileSystem> res =
fsState.resolve(getUriPath(path), true);
res.targetFileSystem.setXAttr(res.remainingPath, name, value, flag);
}
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:8,代码来源:ViewFileSystem.java
示例14: setXAttr
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
@Override
public void setXAttr(Path path, String name, byte[] value,
EnumSet<XAttrSetFlag> flag) throws IOException {
InodeTree.ResolveResult<AbstractFileSystem> res =
fsState.resolve(getUriPath(path), true);
res.targetFileSystem.setXAttr(res.remainingPath, name, value, flag);
}
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:8,代码来源:ViewFs.java
示例15: convert
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
public static EnumSet<XAttrSetFlag> convert(int flag) {
EnumSet<XAttrSetFlag> result =
EnumSet.noneOf(XAttrSetFlag.class);
if ((flag & XAttrProtos.XAttrSetFlagProto.XATTR_CREATE_VALUE) ==
XAttrProtos.XAttrSetFlagProto.XATTR_CREATE_VALUE) {
result.add(XAttrSetFlag.CREATE);
}
if ((flag & XAttrProtos.XAttrSetFlagProto.XATTR_REPLACE_VALUE) ==
XAttrProtos.XAttrSetFlagProto.XATTR_REPLACE_VALUE) {
result.add(XAttrSetFlag.REPLACE);
}
return result;
}
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:14,代码来源:NuCypherExtPBHelperClient.java
示例16: setUnreadableBySuperuserXattrib
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
private void setUnreadableBySuperuserXattrib(Path p)
throws IOException {
if (fs.getScheme().toLowerCase().contains("hdfs")
&& intermediateEncryptionEnabled
&& !fs.getXAttrs(p).containsKey(UNREADABLE_BY_SUPERUSER_XATTRIB)) {
fs.setXAttr(p, UNREADABLE_BY_SUPERUSER_XATTRIB, null,
EnumSet.of(XAttrSetFlag.CREATE));
}
}
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:FileSystemRMStateStore.java
示例17: setXAttr
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
@Override
public void setXAttr(Path f, String name, byte[] value,
EnumSet<XAttrSetFlag> flag) throws IOException {
Map<String, String> params = new HashMap<String, String>();
params.put(OP_PARAM, Operation.SETXATTR.toString());
params.put(XATTR_NAME_PARAM, name);
if (value != null) {
params.put(XATTR_VALUE_PARAM,
XAttrCodec.encodeValue(value, XAttrCodec.HEX));
}
params.put(XATTR_SET_FLAG_PARAM, EnumSetParam.toString(flag));
HttpURLConnection conn = getConnection(Operation.SETXATTR.getMethod(),
params, f, true);
HttpExceptionUtils.validateResponse(conn, HttpURLConnection.HTTP_OK);
}
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:HttpFSFileSystem.java
示例18: FSSetXAttr
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
public FSSetXAttr(String path, String name, String encodedValue,
EnumSet<XAttrSetFlag> flag) throws IOException {
this.path = new Path(path);
this.name = name;
this.value = XAttrCodec.decodeValue(encodedValue);
this.flag = flag;
}
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:FSOperations.java
示例19: setXAttr
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
@Override
public void setXAttr(Path p, String name, byte[] value,
EnumSet<XAttrSetFlag> flag) throws IOException {
statistics.incrementWriteOps(1);
final HttpOpParam.Op op = PutOpParam.Op.SETXATTR;
if (value != null) {
new FsPathRunner(op, p, new XAttrNameParam(name), new XAttrValueParam(
XAttrCodec.encodeValue(value, XAttrCodec.HEX)),
new XAttrSetFlagParam(flag)).run();
} else {
new FsPathRunner(op, p, new XAttrNameParam(name),
new XAttrSetFlagParam(flag)).run();
}
}
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:WebHdfsFileSystem.java
示例20: setDirStoragePolicy
import org.apache.hadoop.fs.XAttrSetFlag; //导入依赖的package包/类
private static void setDirStoragePolicy(
FSDirectory fsd, INodeDirectory inode, byte policyId,
int latestSnapshotId) throws IOException {
List<XAttr> existingXAttrs = XAttrStorage.readINodeXAttrs(inode);
XAttr xAttr = BlockStoragePolicySuite.buildXAttr(policyId);
List<XAttr> newXAttrs = FSDirXAttrOp.setINodeXAttrs(fsd, existingXAttrs,
Arrays.asList(xAttr),
EnumSet.of(
XAttrSetFlag.CREATE,
XAttrSetFlag.REPLACE));
XAttrStorage.updateINodeXAttrs(inode, newXAttrs, latestSnapshotId);
}
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:FSDirAttrOp.java
注:本文中的org.apache.hadoop.fs.XAttrSetFlag类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论