Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

serve nfs: store billy FS in the Handler

Nick Craig-Wooda697d274556b
diff --git a/cmd/serve/nfs/handler.go b/cmd/serve/nfs/handler.go
index c89b0c7cb..bd5cf04a8 100644
--- a/cmd/serve/nfs/handler.go
+++ b/cmd/serve/nfs/handler.go
@@ -18,8 +18,9 @@ import (
// NewHandler creates a handler for the provided filesystem
func NewHandler(vfs *vfs.VFS, opt *Options) nfs.Handler {
handler := &Handler{
- vfs: vfs,
- opt: opt,
+ vfs: vfs,
+ opt: opt,
+ billyFS: &FS{vfs: vfs},
}
handler.opt.HandleLimit = handler.opt.Limit()
handler.cache = cacheHelper(handler, handler.HandleLimit())
@@ -28,17 +29,16 @@ func NewHandler(vfs *vfs.VFS, opt *Options) nfs.Handler {
// Handler returns a NFS backing that exposes a given file system in response to all mount requests.
type Handler struct {
- vfs *vfs.VFS
- opt *Options
- cache nfs.Handler
+ vfs *vfs.VFS
+ opt *Options
+ billyFS *FS
+ cache nfs.Handler
}
// Mount backs Mount RPC Requests, allowing for access control policies.
func (h *Handler) Mount(ctx context.Context, conn net.Conn, req nfs.MountRequest) (status nfs.MountStatus, hndl billy.Filesystem, auths []nfs.AuthFlavor) {
- status = nfs.MountStatusOk
- hndl = &FS{vfs: h.vfs}
auths = []nfs.AuthFlavor{nfs.AuthFlavorNull}
- return
+ return nfs.MountStatusOk, h.billyFS, auths
}
// Change provides an interface for updating file attributes.