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

Include project-id in sync'ed data to allow future calls to directly jump to that project. #70343

Merged
merged 13 commits into from
Oct 14, 2023

Conversation

CyrusNajmabadi
Copy link
Member

No description provided.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Oct 11, 2023
return new SolutionStateChecksums(
attributesChecksum,
new ChecksumCollection(projectChecksums.WhereNotNull().ToImmutableArray()),
projectIds.ToImmutableAndClear(),
Copy link
Member Author

Choose a reason for hiding this comment

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

passing along the project ids, not just their checksums. that way when we jhave an instance of SolutionStateChecksums we can scope requests down to a particular id when trying to retrieve a particular project checksum.


public Checksum Attributes { get; }
public ImmutableArray<ProjectId> ProjectIds { get; }
public ChecksumCollection Projects { get; }
Copy link
Member Author

Choose a reason for hiding this comment

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

note: i merge ProejctIds and Projects into a singular collection type in a later PR to keep these more tightly bound

foreach (var projectChecksum in solutionChecksums.Projects)
projects.AddIfNotNull(await CreateProjectInfoAsync(projectChecksum, cancellationToken).ConfigureAwait(false));
for (int i = 0, n = solutionChecksums.ProjectIds.Length; i < n; i++)
projects.AddIfNotNull(await CreateProjectInfoAsync(solutionChecksums.ProjectIds[i], solutionChecksums.Projects[i], cancellationToken).ConfigureAwait(false));
Copy link
Member Author

Choose a reason for hiding this comment

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

the benefit comes here.

{
var projectChecksums = await GetAssetAsync<ProjectStateChecksums>(hintProject: null, projectChecksum, cancellationToken).ConfigureAwait(false);
var projectChecksums = await GetAssetAsync<ProjectStateChecksums>(hintProject: projectId, projectChecksum, cancellationToken).ConfigureAwait(false);
Contract.ThrowIfFalse(projectId == projectChecksums.ProjectId);
Copy link
Member Author

Choose a reason for hiding this comment

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

now, when asking to retrieve the ProjectStateChecksums we don't need to do a linear walk to find it. we can directly grab it using the known projectId.

@@ -71,7 +71,8 @@ public async Task<Solution> CreateSolutionAsync(Checksum newSolutionChecksum, Ca

if (oldSolutionChecksums.Projects.Checksum != newSolutionChecksums.Projects.Checksum)
{
solution = await UpdateProjectsAsync(solution, oldSolutionChecksums.Projects, newSolutionChecksums.Projects, cancellationToken).ConfigureAwait(false);
solution = await UpdateProjectsAsync(
solution, oldSolutionChecksums, newSolutionChecksums, cancellationToken).ConfigureAwait(false);
Copy link
Member Author

Choose a reason for hiding this comment

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

i preferred this form as just passing around CheckasumCollection instances is unclear as to what they represent.

@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review October 12, 2023 21:41
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner October 12, 2023 21:41
@CyrusNajmabadi CyrusNajmabadi changed the title WIP: More checksum work (cont2) Include project-id in sync'ed data to allow future calls to directly jump to that project. Oct 12, 2023
searchingChecksumsLeft.Remove(projectStateChecksums.Checksum))
var projectState = state.GetProjectState(hintProject);
if (projectState != null &&
projectState.TryGetStateChecksums(out var projectStateChecksums))
{
Copy link
Contributor

Choose a reason for hiding this comment

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

a searchingChecksumsLeft.Remove call isn't required here?

Copy link
Member Author

Choose a reason for hiding this comment

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

no. this isn't removing. this is just fast-pathing finding the project-state-checksums to dive into it to search the actual checksums.

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

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

:shipit:

@CyrusNajmabadi CyrusNajmabadi merged commit fe6cc3e into dotnet:main Oct 14, 2023
22 of 24 checks passed
@ghost ghost added this to the Next milestone Oct 14, 2023
@CyrusNajmabadi CyrusNajmabadi deleted the checksumCleanup7 branch October 14, 2023 02:49
@jjonescz jjonescz modified the milestones: Next, 17.9 P1 Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants