snapshot: add Close()
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
@@ -724,3 +724,8 @@ func (s *snapshotter) pruneBranch(ctx context.Context, node *treeNode) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close closes s.Snapshotter but not db
|
||||
func (s *snapshotter) Close() error {
|
||||
return s.Snapshotter.Close()
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ func newTestSnapshotter(ctx context.Context, root string) (snapshot.Snapshotter,
|
||||
sn := NewDB(db, nil, map[string]snapshot.Snapshotter{"naive": snapshotter}).Snapshotter("naive")
|
||||
|
||||
return sn, func() error {
|
||||
if err := sn.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
return db.Close()
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user