Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFS3 demo server #205

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

NFS3 demo server #205

wants to merge 1 commit into from

Conversation

weissi
Copy link
Member

@weissi weissi commented Aug 16, 2023

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.

@weissi weissi requested a review from Lukasa August 16, 2023 16:03
@weissi weissi force-pushed the jw-nfs3demo branch 4 times, most recently from 8659ab1 to 28251d6 Compare August 17, 2023 13:48
@weissi weissi requested a review from glbrntt August 17, 2023 14:45
@Lukasa Lukasa added semver/none No version bump required. semver/patch No public API change. and removed semver/none No version bump required. labels Aug 18, 2023
@@ -135,6 +143,7 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/apple/swift-nio.git", from: "2.42.0"),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we'd avoid the swift-log dependency here. Any reason we can't print?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use the logger to carry metadata through. So if you get an error in your file system, you can log and you'll get the precise connection etc associated. For production that's important and given that I had the code I left it here too because I thought the swift-log dependency wouldn't be too bad.

But I can take it out, lose the metadata propagation and just use print(...)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's definitely not too bad, and I could be talked out of this, but in general keeping the dependency tree small is kinda nice. No strong feelings though, happy for someone to try to talk me out of it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar position but the other way around. Happy either way really ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants