Drop removes remote repo from collection
(repo *RemoteRepo)
| 1024 | |
| 1025 | // Drop removes remote repo from collection |
| 1026 | func (collection *RemoteRepoCollection) Drop(repo *RemoteRepo) error { |
| 1027 | if _, err := collection.db.Get(repo.Key()); err != nil { |
| 1028 | if err == database.ErrNotFound { |
| 1029 | return errors.New("repo not found") |
| 1030 | } |
| 1031 | |
| 1032 | return err |
| 1033 | } |
| 1034 | |
| 1035 | delete(collection.cache, repo.UUID) |
| 1036 | |
| 1037 | batch := collection.db.CreateBatch() |
| 1038 | _ = batch.Delete(repo.Key()) |
| 1039 | _ = batch.Delete(repo.RefKey()) |
| 1040 | return batch.Write() |
| 1041 | } |