Network-NineP-0.4.0: High-level abstraction over 9P protocol

StabilityUltra-Violence
PortabilityI'm too young to die
Safe HaskellNone
LanguageHaskell98

Network.NineP.Server

Description

Listening on sockets for the incoming requests.

Synopsis

Documentation

data NineFile m Source

Constructors

RegularFile 

Fields

read :: Word64 -> Word32 -> m ByteString
 
write :: Word64 -> ByteString -> m Word32
 
remove :: m ()
 
stat :: m Stat

The directory stat must return only stat for ..

wstat :: Stat -> m ()
 
version :: m Word32
 
Directory 

Fields

getFiles :: m [NineFile m]

A callback to get the list of the files this directory contains. Must not contain . and .. entries.

parent :: m (Maybe (NineFile m))
 
descend :: String -> m (NineFile m)

A callback to address a specific file by its name. . and .. are handled in the library.

create :: String -> Word32 -> m (NineFile m)

Create a file under this directory.

remove :: m ()
 
stat :: m Stat

The directory stat must return only stat for ..

wstat :: Stat -> m ()
 
version :: m Word32
 

boringFile :: (Monad m, EmbedIO m) => String -> NineFile m Source

A dumb file that can't do anything.

boringDir :: (Monad m, EmbedIO m) => String -> [(String, NineFile m)] -> NineFile m Source

A dumb directory that can't do anything but provide the files it contains. An user can create files, but they won't show up in listing and will essentially be boringFiles.

data Config m Source

Server configuration.

Constructors

Config 

Fields

root :: NineFile m

The / directory of the hosted filesystem.

addr :: String

The listening address. The syntax is taken from Plan 9 operating system and has the form unix!/path/to/socket for unix socket files, and tcp!hostname!port for tcp sockets.

monadState :: Content m

The initial state for the user-supplied monad. Use Void for IO.

run9PServer :: EmbedIO m => Config m -> IO () Source

Run the actual server using the supplied configuration.