Skip to content

Commit

Permalink
feat(destroyer): add destroyer interface
Browse files Browse the repository at this point in the history
our tests sometimes need a "cleanup" function that removes files created by the test. I think we should instead switch to using an opt-in "destroyer" interface, that tests can check for and call if needed. Destroy can also be used in production code for the same teardown purposes
  • Loading branch information
b5 committed Apr 23, 2019
1 parent b7aa092 commit 43a6e0f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ type Filesystem interface {
PathResolver
}

// Destroyer is an optional interface to tear down a filesystem, removing all
// persisted resources
type Destroyer interface {
Destroy() error
}

// AbsPath adjusts the provided string to a path lib functions can work with
// because paths for Qri can come from the local filesystem, an http url, or
// the distributed web, Absolutizing is a little tricky
Expand Down

0 comments on commit 43a6e0f

Please sign in to comment.