在项目中使用libfuse,无需root权限(用于安装)? FTP安装&的inotify / kqueue的/ FSEvents [英] Use libfuse in a project, without root access (for installation)? FTP mounts & inotify/kqueue/FSEvents

查看:168
本文介绍了在项目中使用libfuse,无需root权限(用于安装)? FTP安装&的inotify / kqueue的/ FSEvents的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的应用程序能够显示远程FTP(或SFTP等)位置的目录列表。当远程目录树中的文件/目录发生变化时,应用程序应更新其视图并进行相关更改。



由于遍历整个树是缓慢且浪费的, d喜欢使用FSEvent(Linux上的inotify / kqueues),但显然这些库是基于文件系统的,并且与FTP服务器的连接与安装的文件系统不同。



为了使这些库工作,我需要在本地机器上实际挂载由FTP / SFTP支持的文件系统,然后将FSEventStream(或kqueue等)附加到本地挂载中。我知道FUSE可以做到这一点,但是有什么方法可以使用FUSE而无需用户首先安装它?我的意思是,我可以将它与我的(Mac)应用程序捆绑在一起并创建安装程序,而不必让用户完成实际运行安装程序包以将libfuse和内核模块复制到系统中的过程?它是否假设 / dev / fuse 存在,或者它是否位于我的应用程序目录内 / dev / 路径之外?



好的Mac应用程序安装了一个简单的拖拽&下降,我想尽可能保持我的方式。我不清楚是否可以直接使用libfuse(假定文件包含在应用程序中),而不是将它安装在系统路径中。



或者,是否有人有没有其他的建议来监测通过FTP进行的更改,而不进行轮询?

解决方案

FTP SFTP 不支持任何形式的客户端通知。



很像HTTP,它们基于请求/响应方案,每个数据传输都由客户端发起。更糟糕的是,与HTTP相反,无法要求服务器在特定日期后通知客户端有任何更改。



这意味着不是只有你必须使用轮询,而且轮询决不会是轻量级的。



就FUSE而言,大多数仅可用的FTP和SFTP模块当用户空间应用程序要求目录列表(例如在文件浏览器窗口中点击刷新)时更新其文件系统的视图。他们不会自己进行投票。您的用户空间应用程序必须通过轮询目录本身来启动刷新。



编辑:



澄清几件事情,FUSE的最新版本确实支持通知事件。它们
只是将事件从模块传递给内核。这些模块仍然需要生成它们,并且对于FTP / SFTP客户端模块来说,这是不可能的,而不需要轮询服务器。

同时记住许多当前的NFS实现尽管NFSv4.1有必要的规定,但也不支持更改通知。许多SMB / CIFS服务器(尤其是廉价的网络连接存储嵌入式系统中的服务器)也仅限于不支持。

I'd like my application to be able to show a directory listing from a remote FTP (or SFTP etc) location. When a file/directory changes in the remote directory tree, the application should update its view with the relevant changes.

Because traversing the entire tree is slow and wasteful, I'd like to use something along the lines of FSEvents (inotify/kqueues on Linux), but obviously these libraries are filesystem-based, and a connection to an FTP server is not the same as a mounted filesystem.

In order to make these libraries work, I'd need to actually mount a filesystem backed by FTP/SFTP on the local machine, then attach an FSEventStream (or kqueue etc) to this local mount. I know FUSE can do this, but is there any way I can use FUSE without the user having to first install it? I mean, can I bundle it with my (Mac) application and create mounts without having to put the user through the process of actually running an installer package to copy libfuse and the kernel modules into the system? Does it assume /dev/fuse exists, or can this live outside the /dev/ path, inside my application directory?

Nice Mac applications are installed with a simple drag & drop and I'd like to keep mine this way if possible. I'm unclear on if it's possible to use libfuse directly (provided the files are included with the app), without installing it in the system paths.

Alternatively, does anyone have any other suggestions for monitoring for changes over FTP, without polling?

解决方案

Unfortunately FTP and SFTP do not support any form of client notification.

Much like HTTP they are based on a request/response scheme, where each data transfer is initiated by the client. What makes things worse is that, contrary to HTTP, there is no way to ask the server to inform the client of any changes since a specific date.

This means that not only you have to use polling, but also that said polling will by no means be lightweight.

As far as FUSE is related, most FTP and SFTP modules that are available only update their view of the filesystem when the userspace applications ask for a directory listing (e.g. hitting Refresh in a file browser window). They do not perform polling on their own. Your userspace application will have to initiate the refresh by polling the directory itself.

EDIT:

To clarify a couple of things, recent versions of FUSE do support notification events. They simply pass through the events from the modules to the kernel. The modules still have to generate them and in the case of an FTP/SFTP client module that is impossible without polling the server.

Also keep in mind that many current NFS implementations do not support change notifications either, despite the fact that NFSv4.1 has the necessary provisions. Many SMB/CIFS servers (esp. those in cheap Network-Attached-Storage embedded systems) also have limited to no support.

这篇关于在项目中使用libfuse,无需root权限(用于安装)? FTP安装&的inotify / kqueue的/ FSEvents的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆