cnabio / cnab-go

A Go implementation of CNAB Core 1.0
MIT License
69 stars 37 forks source link

Add crud.BackingStore #176

Closed carolynvs closed 4 years ago

carolynvs commented 4 years ago

BackingStore is a utility for people developing CRUD stores that makes it easier for them to do late binding / initialization when the list/save/delete/read methods are called, instead of in the constructor, when you may not be ready to connect to databases, plugins, etc or return errors.

This also adds a CredentialStore which isn't interesting now but combined with #175, makes more sense.

One question I had is that that ReadAll isn't part of crud.Store but it is very useful for both credential store and claim store, so it's implemented on both structs. And in Porter, we created new composite interfaces with crud.Store to add in ReadAll as well. I'm wondering if missing ReadAll was an oversight or deliberate decision?

Part of #172

~🚨 This has some overlap with ~#174~ and #175. I tried to make this PR independent but if those PRs are merged first, this should be rebased and tweaked first.~ Update: I've rebased #174 and #175

carolynvs commented 4 years ago

I've add commits to fixup the PR based on review feedback and also rebased the PR on master and resolved the conflicts.