基于 http 的文件系统,支持查找和锁定

发布于 2024-07-17 19:00:44 字数 588 浏览 11 评论 0原文

我正在构建一个需要使用网络服务器(如文件系统)的应用程序。 具体来说,理想的解决方案是:

  • 一个服务器端组件,允许通过 HTTP 打开(锁定)、读取、写入、查找和截断一个文件。 我需要能够同时锁定多个文件。 我需要它在任何标准 Web 主机上运行,​​因此它必须在 IIS 或 Apache 之上运行,使用服务器端脚本(Web 服务、PHP 等)
  • 一个客户端接口,我向它传递一个 URI,它就像一个文件一样打开和运行。 我的客户端应用程序位于 .NET 中,因此理想情况下客户端 API 将实现 FileSteam 子类。

我需要这个的原因是我有相当大的文件将位于网络主机上。 我需要读取部分文件(使用查找)、截断并附加到末尾。 下载和上传整个文件会占用大量带宽。 另外,我需要同时锁定多个文件。

我的问题:

  • 这样的事情存在吗?
  • 如果没有,为什么不呢? 这看起来不是一个非常有用的服务吗?

看起来这样的组件可以让我使用任何网络托管公司作为网络文件服务器。 这看起来很有用,不是吗?

感谢您的帮助!

埃里克

I'm building an application that needs to use a web server like a file system. Specifically, the ideal solution would be:

  • A server side component that would allow, via HTTP, opening (locking), reading, writing, seeking and truncating one file. I need to be able to lock multiple files simultaneously. I need this to run on any of the standard web hosts out there, so it must run on top of IIS or Apache, using server side scripting (Web Services, PHP, etc)
  • A client interface to this that I hand it a URI, and it opens and acts just like a file. My client app is in .NET, so ideally the client API would implement a FileSteam subclass.

The reason I need this is that I have rather large files that will be sitting on a web host. I need to read parts of the files (using seek), truncate, and append to the end. Downloading and uploading the entire file is too bandwidth intensive. Also, I need to lock multiple files simultaneously.

My questions:

  • Does such a thing exist?
  • If not, why not? Does this not seem like a very useful service?

It seems like such a component would allow me to use any web hosting company out there as a network file server. That seems useful, no?

Thanks for your help!

Eric

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

入画浅相思 2024-07-24 19:00:44

看来您正在寻找的是 WebDAV 服务器。

It seems what you are looking for is a WebDAV server.

红衣飘飘貌似仙 2024-07-24 19:00:44

长版
Web 主机最初设计用于通过单独连接向用户发送内容。 会话的整个概念是一个相对现代的现象(关键词:相对) - 其中大多数只是跟踪同一用户的各个连接的方法。 通常情况下,它只是给人一种您仍然连接到服务器的印象,而实际上您已经连接、下载、断开连接 - 并且每次都执行相同的连接/下载/断开连接你采取行动。

像 WebDav 这样的东西是标准 HTTP 对话框的附加功能,允许专门设计的软件通过 HTTP 与服务器进行更复杂的通信。 WebDav 的最常见用途是 Subversion、iCal(日历支持)等 - 这些允许单连接上传数据。

您所说的是基于会话的文件系统服务。 虽然这似乎是一项很好的服务,但我怀疑它尚未实施,因为其复杂性和危险超过了好处。 例如,这样的服务不仅需要担心标准文件系统问题(授权、文件权限、锁定、超时等),而且现在还必须担心网络上的复杂性(身份验证、会话跟踪、断开连接、重放攻击、DDoS 等)。 例如,如果客户端锁定文件然后脱机,会发生什么情况? 在服务器重新启动之前文件是否保持锁定状态? 如果没有,什么时候自动解锁文件? 如果自动解锁触发并且原始储物柜重新上线,会发生什么情况? 您是否强制所有事情都在单个连接中完成以进行补偿? 如果他们在会话中途断开连接会发生什么?

它们只是您需要担心的几件事。 我闲聊的时间比我本来想的要长得多,但底线是......

简短版本
您当然可以使用 WebDav 来实现这一点,这需要您构建一个服务器端库。 然而,虽然这并非不可能,但你将陷入一个设计好的受伤世界。 我建议简化它的设计,这样你就不需要它像文件系统一样工作了。

Long version
Web hosts were originally designed to send content tothe user in individual connection. The whole concept of sessions is a relatively modern phenomenon (key word: relatively) - most of which are simply methods to track individual connections from the same user. More often than not, its just giving the impression that you're still connected to the server, when in reality you've connected, downloaded, disconnected - and do the same connect/download/disconnect every time you take an action.

Things like WebDav that are tack-on additions to the standard HTTP dialog that allow specially designed software to have more complex communication via HTTP to a server. Very common use for WebDav is Subversion, iCal (calendaring support), etc - these allow for single connection uploading of data.

What you're talking about is having a session-based filesystem service. While it seems that it would be a good service, i suspect it hasn't been implemented due to the sheer complexity and danger outweighing the benefits. For example, not only would such a service have to worry about standard filesystem issues (authorization, file permissions, locking, timeouts, etc), but now also has to worry about the complexities of being on the web (authentication, session-tracking, disconnects, replay attacks, DDoS, etc). For example, what happens if a client locks a file then falls offline? Does the file stay locked until the server reboots? If not, when do you automatically unlock the file? What happens if the auto-unlock triggers and the original locker comes back online? Do you force everything to be done in a single connection to compensate? What happens if they get disconnected in the middle of a session?

They are but a few things that you have to worry about. I've rambled on much longer than i meant to, but the bottom line is that...

Short Version
You can certainly use WebDav to implement this, which will require you to build a server-side library. However, while its not impossible, you're in for a world of hurt as designed. I'd suggest simplifying the design it so that you don't need it to act like a filesystem so much.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文