Object callCOSClientWithRetry(X request) throws CosServiceException,
}
}
}
+
+ private static String ensureValidAttributeName(String attributeName) {
+ return attributeName.replace('.', '-').toLowerCase();
+ }
}
diff --git a/src/main/java/org/apache/hadoop/fs/FileMetadata.java b/src/main/java/org/apache/hadoop/fs/FileMetadata.java
index 17461b91..ae04a936 100644
--- a/src/main/java/org/apache/hadoop/fs/FileMetadata.java
+++ b/src/main/java/org/apache/hadoop/fs/FileMetadata.java
@@ -3,6 +3,8 @@
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
+import java.util.Map;
+
/**
*
* Holds basic metadata for a file stored in a {@link NativeFileSystemStore}.
@@ -19,6 +21,7 @@ public class FileMetadata {
private final String crc64ecm;
private final String versionId;
private final String storageClass;
+ private final Map userAttributes;
public FileMetadata(String key, long length, long lastModified) {
this(key, length, lastModified, true);
@@ -35,11 +38,16 @@ public FileMetadata(String key, long length, long lastModified, boolean isFile,
public FileMetadata(String key, long length, long lastModified, boolean isFile, String eTag, String crc64ecm,
String versionId) {
- this(key, length, lastModified, isFile, eTag, crc64ecm, versionId, null);
+ this(key, length, lastModified, isFile, eTag, crc64ecm, versionId, null, null);
}
public FileMetadata(String key, long length, long lastModified, boolean isFile, String eTag, String crc64ecm,
String versionId, String storageClass) {
+ this(key, length, lastModified, isFile, eTag, crc64ecm, versionId, storageClass, null);
+ }
+
+ public FileMetadata(String key, long length, long lastModified, boolean isFile, String eTag, String crc64ecm,
+ String versionId, String storageClass, Map userAttributes) {
this.key = key;
this.length = length;
this.lastModified = lastModified;
@@ -48,6 +56,7 @@ public FileMetadata(String key, long length, long lastModified, boolean isFile,
this.crc64ecm = crc64ecm;
this.versionId = versionId;
this.storageClass = storageClass;
+ this.userAttributes = userAttributes;
}
public String getKey() {
@@ -78,6 +87,10 @@ public String getStorageClass() {
return storageClass;
}
+ public Map getUserAttributes() {
+ return userAttributes;
+ }
+
@Override
public String toString() {
return "FileMetadata[" + key + ", " + length + ", " + lastModified +
diff --git a/src/main/java/org/apache/hadoop/fs/NativeFileSystemStore.java b/src/main/java/org/apache/hadoop/fs/NativeFileSystemStore.java
index 059eef92..4ca8ecf1 100644
--- a/src/main/java/org/apache/hadoop/fs/NativeFileSystemStore.java
+++ b/src/main/java/org/apache/hadoop/fs/NativeFileSystemStore.java
@@ -45,6 +45,14 @@ PartETag uploadPart(InputStream inputStream, String key, String uploadId,
FileMetadata retrieveMetadata(String key) throws IOException;
+ byte[] retrieveAttribute(String key, String attribute) throws IOException;
+
+ void storeDirAttribute(String key, String attribute, byte[] value) throws IOException;
+ void storeFileAttribute(String key, String attribute, byte[] value) throws IOException;
+
+ void removeDirAttribute(String key, String attribute) throws IOException;
+ void removeFileAttribute(String key, String attribute) throws IOException;
+
InputStream retrieve(String key) throws IOException;
InputStream retrieve(String key, long byteRangeStart) throws IOException;