Module Styx

9P2000 server and client implementation.

9P2000 (hereafter referred to as 9P) is a protocol for writing file servers. A 9P server communicates with a client over an ordered, reliable transport, exchanging messages to read, write, and update files in a file hierarchy. From a protocol level, there is no difference between a file that is stored on disk and a file that is created on the fly based on the context of a request and the server's purpose. We call such files synthetic files.

This module implements the base 9P2000 protocol and the 9P2000.u extensions for better integration with Unix-type operating systems.

File servers can be constructed by implementing the Filesystem interface and using the Server functor.

module Qid = Styx__.Types.Qid
module Stat = Styx__.Types.Stat
module Flag = Styx__.Types.Flag
module Mode = Styx__.Types.Mode
module Proto : sig ... end

Encoding and decoding of 9P2000 message streams.

module Iovec = Iovec
type error =
| Errno of Unix.error
| Ename of string

Filesystem implementations should not raise exceptions during normal operation, but instead return error results for operations that can fail. For compatibility with Unix clients, it is preferred to return numeric error codes; even if 9P2000.u is not in use, the numeric error will be converted to a well known string that some clients such as v9fs will recognize.

val errno : Unix.error -> ('aerror) Stdlib.result
val ename : string -> ('aerror) Stdlib.result
module type Filesystem = sig ... end

Modules implementing the Filesystem signature can be used to create 9P servers with the Server functor.

module ServerConfig : sig ... end

ServerConfig defines configuration directives for the 9P servers defined by the Server functor.

module Server : functor (FS : Filesystem) -> sig ... end

The Server functor produces a 9P server from a Filesystem implementation.