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

refactor(datasource): migrate to class based datasource #6747

Merged
merged 7 commits into from
May 21, 2021

Conversation

JamieMagee
Copy link
Contributor

A small experiment into what OOP/class based datasources might look like. Picked Cdnjs as it's the smallest & simplest.

With this approach we can share common logic, like error handling, rate limiting, etc. between different datasources, instead of having to reimplement it each time we write a new datasource. Currently there's nothing shared, as it's only 1 datasource, but the interesting stuff will come with the 2nd datasource!

Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rate limiting should be on http layer, not on datasource layer.

lib/datasource/index.spec.ts Outdated Show resolved Hide resolved
lib/datasource/cdnjs/index.ts Outdated Show resolved Hide resolved
@rarkins
Copy link
Collaborator

rarkins commented Jul 15, 2020

Related:

  • #5557 - De-duplicate datasource error handling
  • #6757 - Add private/auth awareness to datasource index

Also, I'd been thinking the potentially the datasource index could instantiate a http instance for each datasource at startup (being sure to include the id) and then pass it as part of parameters to getReleases or getDigest.

@JamieMagee JamieMagee force-pushed the refactor/class-based-datasource branch from 0b8463e to 68c6029 Compare August 19, 2020 07:55
@JamieMagee JamieMagee force-pushed the refactor/class-based-datasource branch from 68c6029 to 857eecb Compare August 30, 2020 14:24
@rarkins rarkins marked this pull request as ready for review August 30, 2020 14:53
@rarkins rarkins requested a review from viceice August 30, 2020 14:53
@rarkins rarkins marked this pull request as draft August 30, 2020 14:53
@viceice
Copy link
Member

viceice commented Aug 30, 2020

? review or not review? 🤔

@rarkins
Copy link
Collaborator

rarkins commented Aug 30, 2020

? review or not review? 🤔

Sorry, requested review of wrong branch

@JamieMagee JamieMagee force-pushed the refactor/class-based-datasource branch from ce75f5b to 8615e66 Compare September 1, 2020 10:14
@JamieMagee JamieMagee force-pushed the refactor/class-based-datasource branch 2 times, most recently from acc6cf5 to 385df5b Compare October 7, 2020 08:08
@JamieMagee JamieMagee marked this pull request as ready for review October 7, 2020 08:08
@JamieMagee JamieMagee requested a review from rarkins October 27, 2020 14:00
@rarkins rarkins marked this pull request as draft December 4, 2020 06:23
@viceice viceice mentioned this pull request Feb 13, 2021
6 tasks
@JamieMagee JamieMagee force-pushed the refactor/class-based-datasource branch from a49935f to 0e5f281 Compare February 17, 2021 06:25
@JamieMagee
Copy link
Contributor Author

Rebased on top of current HEAD. Reverted crate changes as this branch has strayed too far from the existing implementation, and rewriting would be simpler than rebasing.

@JamieMagee JamieMagee force-pushed the refactor/class-based-datasource branch from 0e5f281 to 9a09d00 Compare March 17, 2021 04:49
@JamieMagee JamieMagee marked this pull request as ready for review March 17, 2021 04:50
lib/datasource/api.ts Outdated Show resolved Hide resolved
lib/datasource/cdnjs/index.ts Outdated Show resolved Hide resolved
lib/datasource/cdnjs/index.ts Outdated Show resolved Hide resolved
.eslintrc.js Outdated Show resolved Hide resolved
lib/datasource/cdnjs/index.ts Outdated Show resolved Hide resolved
lib/datasource/index.ts Outdated Show resolved Hide resolved
lib/util/http/index.ts Outdated Show resolved Hide resolved
lib/versioning/loose/generic.ts Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
tools/jest-gh-reporter.ts Outdated Show resolved Hide resolved
@JamieMagee JamieMagee force-pushed the refactor/class-based-datasource branch from f4dc06d to 8fb734e Compare April 9, 2021 03:01
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should only convert this two datasources with this pr and convert others in separate pr's, so it's easier to review

lib/datasource/datasource.ts Outdated Show resolved Hide resolved
lib/manager/deps-edn/extract.ts Outdated Show resolved Hide resolved
lib/datasource/index.spec.ts Outdated Show resolved Hide resolved
@JamieMagee JamieMagee force-pushed the refactor/class-based-datasource branch 4 times, most recently from ce19bb2 to e0ab61f Compare May 5, 2021 05:13
@JamieMagee JamieMagee requested a review from viceice May 5, 2021 05:14
.eslintrc.js Outdated Show resolved Hide resolved
lib/datasource/datasource.ts Outdated Show resolved Hide resolved
lib/datasource/datasource.ts Outdated Show resolved Hide resolved
lib/datasource/datasource.ts Outdated Show resolved Hide resolved
lib/datasource/index.spec.ts Outdated Show resolved Hide resolved
@JamieMagee JamieMagee force-pushed the refactor/class-based-datasource branch 3 times, most recently from 032ac52 to 56c72a0 Compare May 6, 2021 04:25
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs lint fix 😉

@JamieMagee JamieMagee force-pushed the refactor/class-based-datasource branch from 56c72a0 to 61ced89 Compare May 11, 2021 04:02
lib/datasource/datasource.ts Show resolved Hide resolved
lib/datasource/datasource.ts Outdated Show resolved Hide resolved
@JamieMagee JamieMagee force-pushed the refactor/class-based-datasource branch from 61ced89 to ff03e51 Compare May 14, 2021 05:11
@JamieMagee JamieMagee requested a review from viceice May 14, 2021 15:21
    A small experiment into what OOP/class based datasources might look like. Picked Cdnjs as it's the smallest & simplest.

    With this approach we can share common logic, like error handling, rate limiting, etc. between different datasources, instead of having to reimplement it each time we write a new datasource. Currently there's nothing shared, as it's only 1 datasource, but the interesting stuff will come with the 2nd datasource
@JamieMagee JamieMagee force-pushed the refactor/class-based-datasource branch from ff03e51 to 3f7fc70 Compare May 18, 2021 01:01
@JamieMagee
Copy link
Contributor Author

@viceice I think I've addressed all your comments.

@rarkins I think this is ready for your review.

@JamieMagee
Copy link
Contributor Author

Pls no more conflicts 😨 🤞

Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small stuff

lib/datasource/datasource.spec.ts Outdated Show resolved Hide resolved
lib/datasource/clojure/index.spec.ts Outdated Show resolved Hide resolved
lib/datasource/datasource.spec.ts Outdated Show resolved Hide resolved
@JamieMagee JamieMagee requested a review from viceice May 21, 2021 05:11
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳🥳

@viceice viceice merged commit 621b77b into main May 21, 2021
@viceice viceice deleted the refactor/class-based-datasource branch May 21, 2021 05:40
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 25.26.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants