E9p - pure Erlang implementation of 9p protocol

This is pure Erlang 9p2000 (no extensions for now) implementation with some basic filesystems implementation (passthrough unfs and sysfs exposing ERTS informations).

It is first release, very rough at the edges, with very basic connection handling, but is at least minimally functioning. I hope to expand it further to make implementation of custom filesystems much easier and to implement 9p2000 extensions easier.

Currently implemented:

  • unfs - Unix filesystem passthrough. It supports directory traversal, file reading/writing, but so far no file creation or deletion
  • sysfs - procfs/sysfs-like pseudo-filesystem that is exposing ERTS internals as plain files. For now the accessible informations are - loaded applications and their data (environment, versions, etc. as accessible via application:get_all_key/1), process information (as available via erlang:process_info/2), and sytem information (as available via erlang:system_info/1). In version v0.1.0 this whole filesystem is read-only.

Unsupported features:

  • No authentication - authentication components are currently completely ignored from implementation
  • Only one connection at the time possible - current connection handler is super simple and do not support multiple clients
  • Only raw TCP supported - no Unix sockets nor TLS connections at the time of being
  • No permission validation - if someone connects and the Erlang can edit file, then they will be able to do so, do not expose that service to untrusted parties

Hex: e9p | Hex

Source:

4 Likes

+1 for using tangled!

1 Like

Very cool. Do you have a particular use-case in mind for this or is it just for fun?

+2, gonna move my stuff there soon :slight_smile:

The idea there was to provide a library that will allow me to expose Erlang state to operators that aren’t super familiar with Erlang. Filesystem is good interface there.

Additional goal was to allow exposing libraries like khepri as a filesystem for distributed FS-like database access. I want it to became a building block for people to construct more on top.

Example usecase may be for example exposing LiveBook notes as files, so you can edit these from your own editor, with all your plugins and configuration, and then immediately see updated documents in your browser. Sky is the limit.

3 Likes

Interesting. I’m planning on layering a distributed filesystem/object store on top of Hobbes (it will make a great metadata store). So I could then use this to provide a real filesystem interface? That would be cool.

One small suggestion. In my experience, it’s idiomatic for Erlang libraries to provide start_monitor and start functions, in addition to start_link.

Yeah, Hobbes was another project that I wanted to be able to provide FS interface to.

1 Like

Yeah, for sure, the current implementation of server is super basic as it allows only single client. It will be expanded with different functions as well as child_spec/1 for simplifying Elixir usage.

1 Like

So that I can [9pfuse}(9pfuse(4) - Plan 9 from User Space) on anything that support it? Super cool.

Can’t wait to see .#* *~, .DS_store spring up everywhere in your neat database!. :slight_smile:

1 Like

Yes you can. I have tested it locally (so far, automated tests will come up in future) and it works. 9pfuse and Linux built in v9pfs works with e9p. Another implementation tested is kamiftp. I am also planning on client implementation so it will not only be server, but client as well (it should also help with testing).