|
|
@ -34,6 +34,9 @@ public class SeaweedFileSystem extends org.apache.hadoop.fs.FileSystem { |
|
|
|
public static final int FS_SEAWEED_DEFAULT_PORT = 8888; |
|
|
|
public static final String FS_SEAWEED_FILER_HOST = "fs.seaweed.filer.host"; |
|
|
|
public static final String FS_SEAWEED_FILER_PORT = "fs.seaweed.filer.port"; |
|
|
|
public static final String FS_SEAWEED_GRPC_CA = "fs.seaweed.ca"; |
|
|
|
public static final String FS_SEAWEED_GRPC_CLIENT_KEY = "fs.seaweed.client.key"; |
|
|
|
public static final String FS_SEAWEED_GRPC_CLIENT_CERT = "fs.seaweed.client.cert"; |
|
|
|
|
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(SeaweedFileSystem.class); |
|
|
|
private static int BUFFER_SIZE = 16 * 1024 * 1024; |
|
|
@ -72,9 +75,19 @@ public class SeaweedFileSystem extends org.apache.hadoop.fs.FileSystem { |
|
|
|
setConf(conf); |
|
|
|
this.uri = uri; |
|
|
|
|
|
|
|
if (conf.get(FS_SEAWEED_GRPC_CA) != null && conf.getTrimmed(FS_SEAWEED_GRPC_CA).length() != 0 |
|
|
|
&& conf.get(FS_SEAWEED_GRPC_CLIENT_CERT) != null && conf.getTrimmed(FS_SEAWEED_GRPC_CLIENT_CERT).length() != 0 |
|
|
|
&& conf.get(FS_SEAWEED_GRPC_CLIENT_KEY) != null && conf.getTrimmed(FS_SEAWEED_GRPC_CLIENT_KEY).length() != 0) { |
|
|
|
seaweedFileSystemStore = new SeaweedFileSystemStore(host, port, |
|
|
|
conf.get(FS_SEAWEED_GRPC_CA), |
|
|
|
conf.get(FS_SEAWEED_GRPC_CLIENT_CERT), |
|
|
|
conf.get(FS_SEAWEED_GRPC_CLIENT_KEY)); |
|
|
|
} else { |
|
|
|
seaweedFileSystemStore = new SeaweedFileSystemStore(host, port); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public FSDataInputStream open(Path path, int bufferSize) throws IOException { |
|
|
|
|
|
|
@ -271,6 +284,7 @@ public class SeaweedFileSystem extends org.apache.hadoop.fs.FileSystem { |
|
|
|
|
|
|
|
/** |
|
|
|
* Concat existing files together. |
|
|
|
* |
|
|
|
* @param trg the path to the target destination. |
|
|
|
* @param psrcs the paths to the sources to use for the concatenation. |
|
|
|
* @throws IOException IO failure |
|
|
@ -278,7 +292,7 @@ public class SeaweedFileSystem extends org.apache.hadoop.fs.FileSystem { |
|
|
|
* (default). |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void concat(final Path trg, final Path [] psrcs) throws IOException { |
|
|
|
public void concat(final Path trg, final Path[] psrcs) throws IOException { |
|
|
|
throw new UnsupportedOperationException("Not implemented by the " + |
|
|
|
getClass().getSimpleName() + " FileSystem implementation"); |
|
|
|
} |
|
|
@ -291,9 +305,9 @@ public class SeaweedFileSystem extends org.apache.hadoop.fs.FileSystem { |
|
|
|
* <li>Fails if path is not closed.</li> |
|
|
|
* <li>Fails if new size is greater than current size.</li> |
|
|
|
* </ul> |
|
|
|
* |
|
|
|
* @param f The path to the file to be truncated |
|
|
|
* @param newLength The size the file is to be truncated to |
|
|
|
* |
|
|
|
* @return <code>true</code> if the file has been truncated to the desired |
|
|
|
* <code>newLength</code> and is immediately available to be reused for |
|
|
|
* write operations such as <code>append</code>, or |
|
|
@ -327,6 +341,7 @@ public class SeaweedFileSystem extends org.apache.hadoop.fs.FileSystem { |
|
|
|
|
|
|
|
/** |
|
|
|
* Create a snapshot. |
|
|
|
* |
|
|
|
* @param path The directory where snapshots will be taken. |
|
|
|
* @param snapshotName The name of the snapshot |
|
|
|
* @return the snapshot path. |
|
|
@ -342,6 +357,7 @@ public class SeaweedFileSystem extends org.apache.hadoop.fs.FileSystem { |
|
|
|
|
|
|
|
/** |
|
|
|
* Rename a snapshot. |
|
|
|
* |
|
|
|
* @param path The directory path where the snapshot was taken |
|
|
|
* @param snapshotOldName Old name of the snapshot |
|
|
|
* @param snapshotNewName New name of the snapshot |
|
|
@ -358,6 +374,7 @@ public class SeaweedFileSystem extends org.apache.hadoop.fs.FileSystem { |
|
|
|
|
|
|
|
/** |
|
|
|
* Delete a snapshot of a directory. |
|
|
|
* |
|
|
|
* @param path The directory that the to-be-deleted snapshot belongs to |
|
|
|
* @param snapshotName The name of the snapshot |
|
|
|
* @throws IOException IO failure |
|
|
|