Page 1 of 1

Abstracted file access

Posted: Wed Apr 18, 2012 11:04 am
by FuzziBear
I'm looking at modifying my client (and submitting the code if you'd like to include it) so that access to the file system is abstracted into a separate code section.

This would allow plugin authors to write plugins to do things like read and write through a compression or encryption mechanism, thereby compressing/encrypting on the fly. Several other possible use cases exist for this (network storage, etc) however the other ones I could think of would be less useful, and/or easier implemented by just setting the download location to a FUSE filesystem (eg read/writing to SFTP).

I'm aware that there are FUSE (and many other options) available for mountable on the fly encryption and compression, etc, however then you need root access to mount and the whole file/folder structure is available in searches and for general access, which is fairly useless in a number of use cases.

Now, onto the question:
From what I've read, it's possible to create a custom FileObject for doing the read/write and general file handling. From there, the calls to open a file would need to be replaced with an abstracted open that returns the custom FileObject. The other necessity would be to replace other file system access (create directory, read directory structure etc) with abstracted methods also.

I'm not really sure where to start, so would someone be able to point me to any files that open files and interact with the file system in relation to torrent data?

I'm only really interested in torrent data at the moment, and no config/extra data. I'm also aware that most people probably won't be interested in this, thus would be a waste of cpu/mem to include it by default, however I would distribute the patch for anyone to include in their own client.

Re: Abstracted file access

Posted: Wed Apr 18, 2012 12:41 pm
by Cas
This would be a libtorrent related so you should ask on the mailing list: http://www.rasterbar.com/products/libtorrent/