Refactor Archive loading
Closed, ResolvedPublic

Description

Rationale described in T3296

Proposed fix: replacing Archive *Archive::create() with LoadJob *Archive::load().
LoadJob::archive() provides access to the loaded archive once the job (which internally uses ListJob) is done.

Proof-of-concept in branch refactor/archive-loading.

Details

Differential Revisions
D2811: Refactor archive loading

The biggest problem is: how do we deal with non-existing archives? We use Archive *Archive::create("non-existing-path") when we create a new archive (e.g. in Part and AddToArchive), but the goal is to make those create() methods private.

We could add another wrapper job, e.g. CreateJob *Archive::create(...) that internally calls AddJob. In practice:

  1. If an archive already exists, we have an Archive pointer and we can just call Archive::addFiles() like we already do.
  2. If we need to create a new archive, we do auto createJob = Archive::create() and then, after the job is done, we retrieve the archive (Archive *archive = createJob->archive();).
elvisangelaccio moved this task from Under review to Done on the Ark board.Oct 4 2016, 5:13 PM
elvisangelaccio closed this task as Resolved.Dec 16 2016, 11:00 AM