Skip to content

Improve the core datastructures and traits, and make the {Stable,Beta,Nightly}Releases structs merge-able (0.2)#275

Draft
foresterre wants to merge 23 commits intomainfrom
refactor/core-with-mergable-sources_v0.2
Draft

Improve the core datastructures and traits, and make the {Stable,Beta,Nightly}Releases structs merge-able (0.2)#275
foresterre wants to merge 23 commits intomainfrom
refactor/core-with-mergable-sources_v0.2

Conversation

@foresterre
Copy link
Owner

@foresterre foresterre commented May 16, 2025

  • The previous structs and traits were not great; they were defined in a sort of inverse relationship
  • rust-releases-core should focus on providing structs which define the releases and their metadata.
    • I also added a "context" C generic, which allows for data to be added by specific source implementations (e.g. the rust-dist could add some s3 bucket metadata).
    • This does have a disadvantage that functions like the new merge are more complex as a result.
    • Perhaps we should leave it out initially, and add context versions of the {channel}Release structs later?
  • The previous version of core focused more on fetching data from a source, while that is very much source specific. As a result, implementations almost need to work around the FetchResources trait implementation.
    • In this version, we let source impl crates deal with the fetching themselves. That is, they no longer "need" to implement a common trait to do so. Instead we focus on defining truthful structs which define a Rust release. Each impl can figure out how to build that for themselves
  • We will add methods to do common operations
    • E.g. available versions so a source impl. only needs to fetch the remainder
    • E.g. push new versions (consider conflicts)
  • We added support for nightly and beta releases, in addition to stable (which the current version also has)
  • We focus on a consistent API surface
  • We will add a way to merge two StableReleases (idem. for the other channels, and the total RustReleases) into one, so two different release sources can be combined
    • By having this context generic C, we can enhance the context on merge, e.g. merge(RustReleases<C1>, RustReleases<C2>, f) -> RustReleases<C3>
    • We do need to add a function to determine how to deal with conflicts, or when one of the two does have a value, but the other does not. -> Prototyping phase for (conflict) resolution. This is the f in the above signature.
  • We will add a new release source based on Rust's github releases, which should be reasonably reliable and very fast to fetch
    • reliability: in the past it happened that releases were already published days before the merge to the stable branch was made, which results in the github release tagging
    • fetch speed: the advantage over using the S3 buckets
  • This release will break the complete API

After these changes, the current roadmap is as follows:

  • Release sources should give more control over (on disk) caching to the caller
  • Build a static releases crate, which can act as a build in source
    • So far this was only useful if you would then be always up to date with the crate, but by allowing merges with other sources, you can merge(static, github-releases, f: prefer static) sources

@foresterre foresterre changed the title Improve the core datastructures and traits, and make the {Stable,Beta,Nightly}Releases structs merge-able Improve the core datastructures and traits, and make the {Stable,Beta,Nightly}Releases structs merge-able (0.2) May 16, 2025
@foresterre foresterre force-pushed the refactor/core-with-mergable-sources_v0.2 branch from ae08f3a to 7449ccf Compare May 16, 2025 19:15
@foresterre foresterre force-pushed the refactor/core-with-mergable-sources_v0.2 branch from 2577568 to a05cc3e Compare June 25, 2025 02:22
@foresterre foresterre force-pushed the refactor/core-with-mergable-sources_v0.2 branch from a05cc3e to f9f8558 Compare June 25, 2025 02:23
In conjunction, the TargetTier struct was also removed. The reason is twofold:
1. This makes it easier to define a Toolchain, without the added indirection of surrounding it with ReleaseToolchain. Currently we're aiming for simplicity in the API and figuring out the right API.
2. Whatever a TargetTier is, is often in flux. There used to be a tier 2.5 (which we defined), but the Rust book currently defines platform support from tier 1 to 3, with the added "with or without host tools" supplement. The lack of a static definition makes it harder to target a stable API for this library, which we do want soonish.

https://doc.rust-lang.org/nightly/rustc/platform-support.html
Changed for clarity of what the "clients" represent. We also have a file system client after all.
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