Merge pull request #3925 from dmcgowan/snapshot-cleanup-api
Add Cleanup to snapshot API
This commit is contained in:
@@ -184,6 +184,13 @@ func (p *proxySnapshotter) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *proxySnapshotter) Cleanup(ctx context.Context) error {
|
||||
_, err := p.client.Cleanup(ctx, &snapshotsapi.CleanupRequest{
|
||||
Snapshotter: p.snapshotterName,
|
||||
})
|
||||
return errdefs.FromGRPC(err)
|
||||
}
|
||||
|
||||
func toKind(kind snapshotsapi.Kind) snapshots.Kind {
|
||||
if kind == snapshotsapi.KindActive {
|
||||
return snapshots.KindActive
|
||||
|
||||
@@ -341,6 +341,17 @@ type Snapshotter interface {
|
||||
Close() error
|
||||
}
|
||||
|
||||
// Cleaner defines a type capable of performing asynchronous resource cleanup.
|
||||
// The Cleaner interface should be used by snapshotters which implement fast
|
||||
// removal and deferred resource cleanup. This prevents snapshots from needing
|
||||
// to perform lengthy resource cleanup before acknowledging a snapshot key
|
||||
// has been removed and available for re-use. This is also useful when
|
||||
// performing multi-key removal with the intent of cleaning up all the
|
||||
// resources after each snapshot key has been removed.
|
||||
type Cleaner interface {
|
||||
Cleanup(ctx context.Context) error
|
||||
}
|
||||
|
||||
// Opt allows setting mutable snapshot properties on creation
|
||||
type Opt func(info *Info) error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user