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

Introduce a transactional, "safe group writer" #19

Closed
sdboyer opened this issue Dec 1, 2016 · 0 comments
Closed

Introduce a transactional, "safe group writer" #19

sdboyer opened this issue Dec 1, 2016 · 0 comments
Milestone

Comments

@sdboyer
Copy link
Member

sdboyer commented Dec 1, 2016

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.

This was referenced Dec 23, 2016
@sdboyer sdboyer added this to the Go public milestone Dec 30, 2016
krisnova pushed a commit to krisnova/dep that referenced this issue Apr 21, 2017
Separate local name and network name concepts
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant