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

Inheriting Torrent Settings #9939

Open
glassez opened this Issue Nov 29, 2018 · 5 comments

Comments

Projects
None yet
3 participants
@glassez
Member

glassez commented Nov 29, 2018

Let me to introduce "Inheriting Torrent Settings" feature.
It should be a generalized replacement for some existing mechanisms (e.g. Automatic Torrent Management) and bring a convenient way to implement all similar capabilities.

From a user perspective, it is a set of torrent settings (like Save path, Ratio limit, etc.) that have some default values and can be overridden at different levels (e.g. at Category level or Torrent level).
settings

From a developer perspective, it is a set of torrent settings that is bound to each "manageable item" (Application, Category, Torrent).
Each setting can be either set or not set.
The following resolution algorithm is used to obtain the effective value of some setting:

  1. If setting is not set the effective value of parent "manageable item" is used (the setting inherits the value).
  2. If setting is explicitly set its value is resolved relative to the effective value of the parent "manageable item" and then used. By default the resolution simply boils down to returning the value itself. But some particular settings (e.g. Save path) can actually make relative resolution.

Example
Consider the following example of one of the settings (Save path):
inheriting

A value for "Save path" setting of "Torrent A" is not set so it inherits the value from its parent item (Category "Misc"). Category "Misc" also hasn't explicit value of "Save path" and it inherits the value of its parent item (Application default "Save path" setting). So the effective value of "Torrent A" "Save path" setting is "C:\Users\John\Downloads".
"Torrent B" has explicit value of "Save path" setting so the effective value is its value resolved against the effective value of appropriate parent item setting. Since it's absolute path it is used as is.
The effective values for "Save path" setting of all other torrents we get in the same way (e.g. "Torrent E" has "D:\Videos\Movies").

Inheritance of Setting works in two ways:

  1. Real inheritance. When "manageable item" is created some settings are passed as is. When value of one of these settings is changed by the user the "manageable item" calls its children to adjust the appropriate setting.
  2. Create-time inheritance. When "manageable item" is created some settings are resolved against parent item settings so the explicit values are really stored and such settings aren't affected by parent settings changes.

Each setting is mapped to a policy that determines how this setting will be created. There is also a default policy that allows you to not explicitly set all policies.
policies
When a user (or some automation tool) creates Category or adds Torrent it pass "Torrent Settings" that are pre-processed by the Session using Policies. If appropriate Policy is "Bypass" the setting is passed as is. If Policy is "Resolve" the setting is resolved first and passed having explicit value. If an appropriate Policy for some Setting is not set the Default Policy is used.

I want to pre-discuss this feature here and get the main approval before proceeding with its implementation. So waiting for your comments (I'm more interested in the comments of team members, but users can also speak out if someone has something really valuable).
@sledgehammer999, @qbittorrent/demigods, @qbittorrent/frequent-contributors, ping.

@glassez glassez added this to the 4.2.0 milestone Nov 29, 2018

@glassez glassez self-assigned this Nov 29, 2018

@sledgehammer999

This comment has been minimized.

Contributor

sledgehammer999 commented Nov 29, 2018

  1. kudos for the included charts
  2. I agree with the abstract concept
  3. I understand how the inheritable settings can work with Torrents. But you seem to mention other areas where they could be used (Application, Category). Do you have abstract examples on how the settings will work for the other areas?
  4. About policies: Is some example possible to see how they relate to settings?
@glassez

This comment has been minimized.

Member

glassez commented Nov 29, 2018

But you seem to mention other areas where they could be used (Application, Category).

You misunderstood me. They're just handle the Torrent Settings but don't use themselves. See my example carefully.

About policies: Is some example possible to see how they relate to settings?

Tomorrow I will add an example of their work.

@qbittorrent qbittorrent deleted a comment from Grip555 Nov 30, 2018

@glassez

This comment has been minimized.

Member

glassez commented Nov 30, 2018

Tomorrow I will add an example of their work.

I've added the description of Creation Policies.

@glassez

This comment has been minimized.

Member

glassez commented Nov 30, 2018

I intend to implement this feature in the application core initially with minimal UI changes. But in the future it will require significant rework and unification.

@Seeker2

This comment has been minimized.

Seeker2 commented Dec 9, 2018

Is this what's necessary to implement separate max connection limits for downloading and seeding torrents? Found here:
[Wishlist] Alternate connections per torrent while seeding - Upload Slots per SEEDING torrent limit!
#2193
...Which would explain why "Milestone: qBitTorrent v3.2.1" has long-since been passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment