client: API/Command to drop imports

This commit is contained in:
Łukasz Magiera
2020-07-07 13:45:02 +02:00
parent 7175b1dd65
commit 18fc3337ff
6 changed files with 93 additions and 13 deletions
+2
View File
@@ -226,6 +226,8 @@ func (fsr *fsLockedRepo) DeleteDatastore(ns string) error {
return xerrors.Errorf("no multi-datastore with at index (namespace %s)", ns)
}
delete(mds, idx)
if err := ds.Close(); err != nil {
return xerrors.Errorf("closing datastore: %w", err)
}
+11 -2
View File
@@ -99,5 +99,14 @@ func (m *Mgr) Info(id int64) (*StoreMeta, error) {
return &sm, nil
}
// m.Info
// m.Delete
func (m *Mgr) Remove(id int64) error {
if err := m.mds.Delete(id); err != nil {
return xerrors.Errorf("removing import: %w", err)
}
if err := m.ds.Delete(datastore.NewKey(fmt.Sprintf("%d", id))); err != nil {
return xerrors.Errorf("removing import metadata: %w", err)
}
return nil
}