microsoft / microsoft/VFSForGit
Cleanup\Refactor: Refactor PlaceholderListDatabase to eliminate the call to WriteAllEntriesAndFlush
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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