Closed Bug 1164754 Opened 9 years ago Closed 9 years ago

[Prototype][FUSE] Cloud storage manager

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1188230

People

(Reporter: edenchuang, Unassigned)

References

Details

Attachments

(2 files)

A new component in Gecko to manage cloud storage
Blocks: 1164750
Attached image CloudStorageManager.png
CloudStorageManager architecture
CloudStorageManager: A singleton used to maintain all cloud storage in Gecko
CloudStorage: Data structure used to save corresponding cloud storage information, such as name, mount point, etc.
CloudStorageRequestHandler: CloudStorageRequestHandler has two responsibilities 1. Setup environment for cloud storage 2. Handle the hard drive request for cloud storage.
For 1. Once CloudStorageRequestHandler is created, it will mount FUSE device to the mount point that corresponding CloudStorage specified and create a fake volume for VolumeManager.
For 2. Create an independent thread to handle the hard drive request to the FUSE device, it will transfer the request to the corresponding JS module by XPCOM
I'm not convinced that it makes sense to add support for 3rd party storage *in the platform*. What would be more interesting would be to let add-ons extend the device storage api to give access to these 3rd party providers. This way you would install "dropbox storage", "gdrive storage" etc.
Agree with Fabrice that web-storage plugin mechanism is flexible for 3rd party provider.

Just share some work already done here.

This sample interface uses a JSON object to describe a file-system structure.
https://github.com/weilonge/unidisk/blob/master/clouddrive/Sample.js

Dropbox implementation is here:
https://github.com/weilonge/unidisk/blob/master/clouddrive/Dropbox.js

The following API should be implemented to support read-only FUSE:
// Get the statistic information of storage usage. This one is optional.
Dropbox.quota = function (cb){

// Get a file meta of a specific path.
Dropbox.getFileMeta = function (path, cb){

// Get a file list of a specific directory path.
Dropbox.getFileList = function (path, cb){

// Get a file content of a file with offset and size.
Dropbox.getFileDownload = function (path, offset, size, cb){

For the authentication, I have not came out a general API (OAuth probably) for every 3rd party storage provide yet, but getAccessToken API is a must.

Thanks.
The attached is a simple illustration for FUSE based storage plugin system.

Following is the use scenario
Cloud storage add-on/webapps can use CloudStorageAPI to mount a cloud storage as a local device by FUSE. 
When webapps operates cloud storage through DeviceStorageAPI, FxOS will send the corresponding read/write operations to VFS(Virtual filesystem), and then CloudStorage component in FxOS will get the request from FUSE device. Once CloudStorage receives the request, it will send corresponding CloudStorageEvent to gaia. Cloud Storage add-on/webapps should listen on the corresponding CloudStorageEvent to perform read/write on cloud storage. After cloud storage add-on/webapps finish operations, it might need to call corresponding CloudStorageAPI to info FxOS operations is finished, and then FxOS can info the Webapps.

Another idea is using JS interpreter in Gerko.
Cloud storage add-on/webapps register a JS script to gecko. Once CloudStorage component receives the request from FUSE, it asks JS interpreter to execute the corresponding functions. But I am not very familiar with this kind of mechanism, I am also not sure if we can execute JS code through interpreter in Gecko. I will study if it is workable.
Eden, we really want to do something like what you called "using JS interpreter in Gecko". That's one of the capabilities that we want to enable for add-ons.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: