Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

starting with hadoop compatible

Chris Lu76cba561cf38
diff --git a/other/java/hdfs/pom.xml b/other/java/hdfs/pom.xml
new file mode 100644
index 0000000000..0892c85e8d
--- /dev/null
+++ b/other/java/hdfs/pom.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>seaweed.hadoop</groupId>
+ <artifactId>seaweedfs</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <properties>
+ <hadoop.version>2.2.0</hadoop.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-client</artifactId>
+ <version>${hadoop.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystem.java b/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystem.java
new file mode 100644
index 0000000000..9b1a842c8d
--- /dev/null
+++ b/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystem.java
@@ -0,0 +1,96 @@
+package seaweed.hdfs;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataInputStream;
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.util.Progressable;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URI;
+
+public class SeaweedFileSystem extends org.apache.hadoop.fs.FileSystem {
+
+ public static final int FS_SEAWEED_DEFAULT_PORT = 8333;
+ public static final String FS_SEAWEED_HOST = "fs.seaweed.host";
+ public static final String FS_SEAWEED_HOST_PORT = "fs.seaweed.host.port";
+
+ private URI uri;
+ private Path workingDirectory = new Path("/");
+
+ public URI getUri() {
+ return uri;
+ }
+
+ public String getScheme() {
+ return "seaweed";
+ }
+
+ @Override
+ public void initialize(URI uri, Configuration conf) throws IOException { // get
+ super.initialize(uri, conf);
+
+ // get host information from uri (overrides info in conf)
+ String host = uri.getHost();
+ host = (host == null) ? conf.get(FS_SEAWEED_HOST, null) : host;
+ if (host == null) {
+ throw new IOException("Invalid host specified");
+ }
+ conf.set(FS_SEAWEED_HOST, host);
+
+ // get port information from uri, (overrides info in conf)
+ int port = uri.getPort();
+ port = (port == -1) ? FS_SEAWEED_DEFAULT_PORT : port;
+ conf.setInt(FS_SEAWEED_HOST_PORT, port);
+
+ setConf(conf);
+ this.uri = uri;
+ }
+
+ public FSDataInputStream open(Path path, int i) throws IOException {
+ return null;
+ }
+
+ public FSDataOutputStream create(Path path, FsPermission fsPermission, boolean b, int i, short i1, long l, Progressable progressable) throws IOException {
+ return null;
+ }
+
+ public FSDataOutputStream append(Path path, int i, Progressable progressable) throws IOException {
+ return null;
+ }
+
+ public boolean rename(Path path, Path path1) throws IOException {
+ return false;
+ }
+
+ public boolean delete(Path path, boolean b) throws IOException {
+ return false;
+ }
+
+ public FileStatus[] listStatus(Path path) throws FileNotFoundException, IOException {
+ return new FileStatus[0];
+ }
+
+ public Path getWorkingDirectory() {
+ return workingDirectory;
+ }
+
+ public void setWorkingDirectory(Path path) {
+ if (path.isAbsolute()) {
+ workingDirectory = path;
+ } else {
+ workingDirectory = new Path(workingDirectory, path);
+ }
+ }
+
+ public boolean mkdirs(Path path, FsPermission fsPermission) throws IOException {
+ return false;
+ }
+
+ public FileStatus getFileStatus(Path path) throws IOException {
+ return null;
+ }
+}