Skip to content

Commit

Permalink
ref(dif): Rename ToAssemble trait to IntoAssembleRequestTuple
Browse files Browse the repository at this point in the history
  • Loading branch information
szokeasaurusrex committed Nov 29, 2024
1 parent 1ca5259 commit af2aba1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/utils/dif_upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,19 +273,22 @@ impl AsRef<[u8]> for DifMatch<'_> {
}
}

trait ToAssemble {
fn to_assemble(&self, with_debug_id: bool) -> (Digest, ChunkedDifRequest<'_>);
trait IntoAssembleRequestTuple<'a> {
/// Creates a tuple which can be collected into a mapping of checksums to
/// `ChunkedDifRequest`s. This tuple is then collected and sent in a request
/// to the assemble endpoint.
fn into_assemble_request_tuple(self, with_debug_id: bool) -> (Digest, ChunkedDifRequest<'a>);
}

impl ToAssemble for Chunked<DifMatch<'_>> {
impl<'a> IntoAssembleRequestTuple<'a> for &'a Chunked<DifMatch<'_>> {
/// Creates a tuple which can be collected into a `ChunkedDifRequest`.
// Some(...) for debug_id can only be done if the ChunkedUploadCapability::Pdbs is
// present, which is kind of a protocol bug. Not supplying it means more recent
// sentry-cli versions keep working with ancient versions of sentry by not
// triggering this protocol bug in most common situations.
// See: https://github.com/getsentry/sentry-cli/issues/980
// See: https://github.com/getsentry/sentry-cli/issues/1056
fn to_assemble(&self, with_debug_id: bool) -> (Digest, ChunkedDifRequest<'_>) {
fn into_assemble_request_tuple(self, with_debug_id: bool) -> (Digest, ChunkedDifRequest<'a>) {
(
self.checksum(),
ChunkedDifRequest {
Expand Down Expand Up @@ -1223,7 +1226,7 @@ where
let api = Api::current();
let request = objects
.iter()
.map(|d| d.to_assemble(options.pdbs_allowed))
.map(|d| d.into_assemble_request_tuple(options.pdbs_allowed))
.collect();
let response = api
.authenticated()?
Expand Down Expand Up @@ -1374,7 +1377,7 @@ fn poll_dif_assemble(

let request = difs
.iter()
.map(|d| d.to_assemble(options.pdbs_allowed))
.map(|d| d.into_assemble_request_tuple(options.pdbs_allowed))
.collect();
let response = loop {
let response =
Expand Down

0 comments on commit af2aba1

Please sign in to comment.