Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable cache for large files #79

Closed
abcdesteve opened this issue Oct 15, 2024 · 6 comments
Closed

Disable cache for large files #79

abcdesteve opened this issue Oct 15, 2024 · 6 comments
Assignees

Comments

@abcdesteve
Copy link

When uploading large files(e.g. videos>1G), is it possible to disable cache? Just read from the dir provided by the app and don't copy it to RSAF private dir. This will help reduce disk write and extremely useful when the device don't have enough space for cache

@chenxiaolong chenxiaolong self-assigned this Oct 15, 2024
@chenxiaolong
Copy link
Owner

This is currently not possible.

I may add an option for it in the future, but it would have the same limitations as rclone when doing streaming writes. Files would have to be written sequentially (no random writes) and retries would not be supported in case of network issues.

@abcdesteve
Copy link
Author

Currently RSAF would continue to upload when network is back, so I don't really understand why retries would be unavailable.

@abcdesteve
Copy link
Author

BTW I'm quite curious if RSAF could show the approximate progress bar for upload and download in the notification, since large files currently will be cached first and there's no way to tell how much it had been uploaded.

Also it would be nice to see the upload speed and how much time left to finish the task. If it's technically possible, then please add a pause action button as well.

I know I'm requesting for too much, so just take them as an inspiration for new functions.

@chenxiaolong
Copy link
Owner

Currently RSAF would continue to upload when network is back, so I don't really understand why retries would be unavailable.

This is only possible when caching is enabled. With caching disabled, retrying is not possible. This is an rclone limitation: https://rclone.org/commands/rclone_mount/#vfs-cache-mode-off

rclone likely has this limitation because most backends don't actually support resuming uploads. "Retrying" is actually reuploading from scratch. Without the cached file, there's nowhere it can reread the data from. (RSAF cannot ask the client app to recreate the file either--the Android API does not support this.)


Regarding the upload progress, I'm unfortunately very limited by rclone here. There's no way to monitor anything about that process or control how it behaves besides turning it on or off completely. I might be able to do something hacky to show the approximate progress, but pause/resume is definitely not possible.

chenxiaolong added a commit that referenced this issue Oct 23, 2024
VFS caching can now be configured per-remote. Disabling it is equivalent
to `rclone mount --vfs-cache-mode none`. This will disable support for
random writes and prevent failed uploads from being retried. However, it
allows uploads to begin immediately and allows the client to show more
accurate file write progress.

If a remote type does not support streaming, VFS caching will be force
enabled and the UI option will be grayed out. This is preferable to
allowing the user to set a broken configuration and not knowing until
they try to create a file and having it fail.

Internally, RSAF now maintains two sets of VFS instances. One set with
caching VFSs and another set with streaming VFSs. This allows the
caching option to be toggled immediately without waiting for open files
to be closed (and fully uploaded). The downside is that if the user
toggles the option while uploads are occurring, the directory listings
may be inconsistent until the uploads complete.

Issue: #79

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
@chenxiaolong
Copy link
Owner

chenxiaolong commented Oct 23, 2024

I've implemented support for disabling caching per-remote in #86 (equivalent to rclone's --vfs-cache-mode none option). It'll be included in the next release of RSAF.

I'm planning to take a look at the upload notification soon to see if I can implement some hacky workaround to show the progress.

chenxiaolong added a commit that referenced this issue Oct 23, 2024
VFS caching can now be configured per-remote. Disabling it is equivalent
to `rclone mount --vfs-cache-mode none`. This will disable support for
random writes and prevent failed uploads from being retried. However, it
allows uploads to begin immediately and allows the client to show more
accurate file write progress.

If a remote type does not support streaming, VFS caching will be force
enabled and the UI option will be grayed out. This is preferable to
allowing the user to set a broken configuration and not knowing until
they try to create a file and having it fail.

Internally, RSAF now maintains two sets of VFS instances. One set with
caching VFSs and another set with streaming VFSs. This allows the
caching option to be toggled immediately without waiting for open files
to be closed (and fully uploaded). The downside is that if the user
toggles the option while uploads are occurring, the directory listings
may be inconsistent until the uploads complete.

Issue: #79

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
chenxiaolong added a commit that referenced this issue Oct 24, 2024
VFS caching can now be configured per-remote. Disabling it is equivalent
to `rclone mount --vfs-cache-mode none`. This will disable support for
random writes and prevent failed uploads from being retried. However, it
allows uploads to begin immediately and allows the client to show more
accurate file write progress.

If a remote type does not support streaming, VFS caching will be force
enabled and the UI option will be grayed out. This is preferable to
allowing the user to set a broken configuration and not knowing until
they try to create a file and having it fail.

Internally, RSAF now maintains two sets of VFS instances. One set with
caching VFSs and another set with streaming VFSs. This allows the
caching option to be toggled immediately without waiting for open files
to be closed (and fully uploaded). The downside is that if the user
toggles the option while uploads are occurring, the directory listings
may be inconsistent until the uploads complete.

Issue: #79

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
chenxiaolong added a commit that referenced this issue Oct 24, 2024
Unfortunately, rclone has no APIs, internal or otherwise, for querying
the upload progress for the VFS writeback cache. We'll do it ourselves
the hacky way by scanning all open file descriptors for open files in
the VFS cache directory and grab the current file positions and sizes.

Issue: #79

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
chenxiaolong added a commit that referenced this issue Oct 24, 2024
Unfortunately, rclone has no APIs, internal or otherwise, for querying
the upload progress for the VFS writeback cache. We'll do it ourselves
the hacky way by scanning all open file descriptors for open files in
the VFS cache directory and grab the current file positions and sizes.

Issue: #79

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
@chenxiaolong
Copy link
Owner

The upload progress notification (for remotes with VFS caching enabled) has been updated to show the progress in #87. This will be included in the next version of RSAF as well.

The notification shows the size uploaded so far and the total size to upload. Given how hacky this is, I'd prefer not to try and compute the speed and complicate it further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants