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

[core] Use an immutable approach to overriding core functionality #466

Merged
merged 4 commits into from
Oct 31, 2021

Conversation

alanmcgovern
Copy link
Owner

Require the user of the library to create the 'Factories' object
before initializing the engine, and ensure 'Factories' is immutable.

If someone wants to enable/disable something core, like proxy support,
then it's far easier to do that safely/reliably if they also instantiate
a new ClientEngine object.

These are things which should not change for the lifetime of a torrent,
unlike the more mutable EngineSettings or ClientSettings.

@alanmcgovern alanmcgovern force-pushed the better-factories branch 3 times, most recently from 3e93877 to 94a644e Compare October 30, 2021 18:11
Require the user of the library to create the 'Factories' object
before initializing the engine, and ensure 'Factories' is immutable.

If someone wants to enable/disable something core, like proxy support,
then it's far easier to do that safely/reliably if they also instantiate
a new ClientEngine object.

These are things which should not change for the lifetime of a torrent,
unlike the more mutable EngineSettings or ClientSettings.
Fold this into 'Factories'
Now we can make IncrementalCacheHash non-static and instantiate
it using the SHA1Creator in the Factory.
@alanmcgovern alanmcgovern merged commit 9228e13 into master Oct 31, 2021
@alanmcgovern alanmcgovern deleted the better-factories branch October 31, 2021 13:39
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

Successfully merging this pull request may close these issues.

1 participant