apache / apache/buildstream

Consolidate code duplicated in ArtifactCache and SourceCache

Open
#1,166 6 comments 0 reactions 0 assignees View on GitHub
refactoring
Dominant language
Python
Stars
140
Forks
45
Avg merge
1d 3h
Merged PRs (30d)
6

Description

[See original issue on GitLab](https://gitlab.com/BuildStream/buildstream/-/issues/1166)
In GitLab by [[Gitlab user @juergbi]](https://gitlab.com/juergbi) on Oct 9, 2019, 16:37

The following discussion from !1635 should be addressed:

- [ ] [[Gitlab user @juergbi]](https://gitlab.com/juergbi) started a [discussion](https://gitlab.com/BuildStream/buildstream/merge_requests/1635#note_228185667): (+1 comment)

> This makes sense. However, it seems we have some code duplication between `ArtifactCache` and `SourceCache` with differences in error handling. We should fix this with a method in `CASCache` that fetches a directory with file blobs (or adding a parameter to the already existing `_fetch_directory()`) and possibly a helper method in the `BaseCache` class. The former can be implemented with a single `FetchTree` call to buildbox-casd in the future.
>
> Do you want to update this branch or defer this to a separate MR?

Contributor guide

Open the contributing guide

Research direction

Read ArtifactCache and SourceCache alongside CASCache._fetch_directory() and the BaseCache helper area; use the linked GitLab discussion and MR !1635 for context. Identify the duplicated directory-fetch logic, preserve the differing error handling, and confirm that both cache paths still behave as before.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.