Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Introduce a transactional, "safe group writer"  #19

@sdboyer

Description

@sdboyer

There are three basic things that dep writes to disk:

  1. Manifest
  2. Lock
  3. Dep source code (i.e. vendor)

One component of correct operation of the tool is keeping these three states in sync. Or, at minimum, not letting them go out of sync unintentionally. That basically entails taking a transaction-style approach to state changes:

  1. If writing one of the states to disk, the existing state should be preserved until the last possible moment, and rolled back to if any error occurs
  2. If writing multiple states to disk, it is safe to assume that correctness of the overall operation is predicated on all the writes succeeding. So, we need to be expand the transaction to cover all the write ops - if one fails, they all fail, and all pre-existing disk states are restored.

This isn't a super-simple thing to do, so I might say we could defer a bit while we work on higher-priority areas. However, I already implemented this for glide, and the use pattern for us is mostly the same. So, I can do some slapdash work to adapt that for our purposes here.

Having a contained API for this would reduce some cognitive load when implementing commands anyway, which is useful - there's already plenty to think about with what's going on there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions