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

Custom storage implementation #183

Open
mitar opened this issue Dec 28, 2024 · 1 comment
Open

Custom storage implementation #183

mitar opened this issue Dec 28, 2024 · 1 comment

Comments

@mitar
Copy link

mitar commented Dec 28, 2024

Any plans to support custom storage implementations, so that I could store files into cloud storage for example? Or even memory? It seems that for memory I could use a tmpfs mount point and then direct the library to store everything there, but having things in Go process might be easier to track/account memory usage to the program.

@cenkalti
Copy link
Owner

There isn't built-in support for custom storage implementations. However, I've made a small change to make it easier to modify in the code and build yourself.

Storage appears as an interface to the client:
https://github.com/cenkalti/rain/blob/master/internal/storage/storage.go

If you are willing to write some code, this line is where you should start:

rain/torrent/session.go

Lines 448 to 450 in e8a4831

func (s *Session) newStorage(id string) (storage.Storage, error) {
return filestorage.New(s.getDataDir(id), s.config.FilePermissions)
}

Please let me know if you have questions.

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