microsoft / microsoft/VFSForGit

Cleanup\Refactor: Refactor PlaceholderListDatabase to eliminate the call to WriteAllEntriesAndFlush

Open
#426 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pr: refactoring
Dominant language
C#
Stars
6.1k
Forks
474
Avg merge
2d 4h
Merged PRs (30d)
8

Description

From discussion in #408:

@wilbaker would it be possible and safer to have a method that takes a delegate like
Func<List<PlaceholderListDatabase.PlaceholderData>, IEnumerable<PlaceholderData> updatedPlaceholders>
Then we could hide the fact that these need to be tied together by having the method be something like

void UpdatePlaceholders(Func<List<PlaceholderListDatabase.PlaceholderData>, IEnumerable<PlaceholderData> updatedPlaceholders> updateWork)
{
    List<PlaceholderListDatabase.PlaceholderData> placeholders = this.GetAllEntries();
    this.WriteAllEntriesAndFlush(updateWork(placeholders));
}

And make the 2 methods private.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search for PlaceholderListDatabase, GetAllEntries, and WriteAllEntriesAndFlush, then inspect the callers that coordinate placeholder updates. Introduce the proposed update method, make the two existing methods private, and verify that all placeholder-update callers still compile and preserve the read-update-write-and-flush behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
database
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.