Drop removes remote repo from collection
(repo *LocalRepo)
| 238 | |
| 239 | // Drop removes remote repo from collection |
| 240 | func (collection *LocalRepoCollection) Drop(repo *LocalRepo) error { |
| 241 | if _, err := collection.db.Get(repo.Key()); err != nil { |
| 242 | if err == database.ErrNotFound { |
| 243 | return errors.New("local repo not found") |
| 244 | } |
| 245 | |
| 246 | return err |
| 247 | } |
| 248 | delete(collection.cache, repo.UUID) |
| 249 | |
| 250 | batch := collection.db.CreateBatch() |
| 251 | _ = batch.Delete(repo.Key()) |
| 252 | _ = batch.Delete(repo.RefKey()) |
| 253 | return batch.Write() |
| 254 | } |