|
Add RemoveAll() to environs.StorageWriter.
There was one method that just about all providers need from their storage
implementations, but which wasn't on the interface: "delete all files." To
work around this, several providers took their Storage() and downcast it to
their own specific Storage implementation, just to call an internal
deleteAll() method. The EC2 provider solved it by referring to the
implementation type, rather than the interface type, from the environment
object. And the Azure one solved it by going straight into the internals from
its Environ.Destroy() implementation.
Adding a "delete all" method to the interface solves all that. (I provided a
shared basic implementation for the dummy and local storage implementations.
It can't easily be tested on its own, but it's covered indirectly by these
uses.)
The new method is called RemoveAll, for consistency with the existing Remove()
method. It should now be possible to jack a local storage object into an EC2
provider instance, and indeed into any other provider, to simplify testing.
And some ugly HTTP-level mocking and testing disappears from the Azure
provider.
https://code.launchpad.net/~jtv/juju-core/providers-deleteall/+merge/173857
(do not edit description out of merge proposal)
Total comments: 1
Total comments: 3
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+153 lines, -99 lines) |
Patch |
 |
A |
[revision details]
|
View
|
1
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
environs/azure/environ.go
|
View
|
|
1 chunk |
+1 line, -7 lines |
0 comments
|
Download
|
 |
M |
environs/azure/environ_test.go
|
View
|
|
4 chunks |
+10 lines, -50 lines |
0 comments
|
Download
|
 |
M |
environs/azure/storage.go
|
View
|
|
1 chunk |
+11 lines, -0 lines |
0 comments
|
Download
|
 |
M |
environs/azure/storage_test.go
|
View
|
|
1 chunk |
+25 lines, -0 lines |
0 comments
|
Download
|
 |
M |
environs/dummy/storage.go
|
View
|
|
1 chunk |
+7 lines, -0 lines |
0 comments
|
Download
|
 |
M |
environs/ec2/ec2.go
|
View
|
|
2 chunks |
+4 lines, -6 lines |
1 comment
|
Download
|
 |
M |
environs/ec2/export_test.go
|
View
|
|
1 chunk |
+0 lines, -4 lines |
0 comments
|
Download
|
 |
M |
environs/ec2/live_test.go
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
environs/ec2/storage.go
|
View
|
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
environs/emptystorage.go
|
View
|
|
0 chunks |
+-1 lines, --1 lines |
0 comments
|
Download
|
 |
M |
environs/emptystorage_test.go
|
View
|
|
0 chunks |
+-1 lines, --1 lines |
0 comments
|
Download
|
 |
M |
environs/interface.go
|
View
|
1
|
1 chunk |
+8 lines, -0 lines |
1 comment
|
Download
|
 |
M |
environs/localstorage/storage.go
|
View
|
|
1 chunk |
+4 lines, -0 lines |
0 comments
|
Download
|
 |
M |
environs/localstorage/storage_test.go
|
View
|
|
3 chunks |
+27 lines, -1 line |
0 comments
|
Download
|
 |
M |
environs/maas/environ.go
|
View
|
|
1 chunk |
+2 lines, -4 lines |
0 comments
|
Download
|
 |
M |
environs/maas/storage.go
|
View
|
|
6 chunks |
+7 lines, -6 lines |
0 comments
|
Download
|
 |
M |
environs/maas/storage_test.go
|
View
|
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
environs/openstack/export_test.go
|
View
|
|
1 chunk |
+0 lines, -4 lines |
0 comments
|
Download
|
 |
M |
environs/openstack/local_test.go
|
View
|
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
 |
M |
environs/openstack/provider.go
|
View
|
|
1 chunk |
+2 lines, -4 lines |
0 comments
|
Download
|
 |
M |
environs/openstack/storage.go
|
View
|
|
3 chunks |
+9 lines, -7 lines |
0 comments
|
Download
|
 |
A |
environs/storage.go
|
View
|
|
1 chunk |
+28 lines, -0 lines |
1 comment
|
Download
|
Total messages: 7
|