swift-nio-extras
swift-nio-extras copied to clipboard
NFS3 demo server
Motivation:
Previously (#155), we added support for the NFS3 protocol. But without actually having a demo server, that's not actually very much fun.
Modifications:
Add a demo server which can mount a simple dummy file system in user space.
Result:
Better demo
How to try this out? Just swift run NIOExtrasNFS3Demo
and then you should see
2023-08-17T14:55:23+0100 info com.apple.swift-nio-extras-nfs3-demo : address=[IPv4]127.0.0.1/127.0.0.1:55507 pid=45446 [NIOExtrasNFS3Demo] FileSystemServer up and running
2023-08-17T14:55:23+0100 info com.apple.swift-nio-extras-nfs3-demo : mount-command=/sbin/mount -o ro,dumbtimer,timeo=100,deadtimeout=300,port=55507,mountport=55507,acregmin=31536000,acregmax=31536000,acdirmin=31536000,acdirmax=31536000,locallocks -t nfs 127.0.0.1:// /tmp/mount -- [NIOExtrasNFS3Demo] attempting mount
2023-08-17T14:55:23+0100 info com.apple.swift-nio-extras-nfs3-demo : mount-point=/tmp/mount [NIOExtrasNFS3Demo] mount successful
which means it successfully mounted the filesystem at /tmp/mount
. You can then check it out
$ find /tmp/mount
/tmp/mount
/tmp/mount/dir
/tmp/mount/dir/file
/tmp/mount/dir/file1
/tmp/mount/dir/file2
/tmp/mount/dir/file3
/tmp/mount/dir/file4
/tmp/mount/dir/file5
$ head -c 20 /tmp/mount/dir/file1
HEEEEEEEEEEEEEEEEEEE
$
to unmount press Ctrl+C in the NIOExtrasNFS3Demo
process.