Remove deletes a pool from the configuration journal.
(ctx context.Context, config Config)
| 100 | |
| 101 | // Remove deletes a pool from the configuration journal. |
| 102 | func (s *Store) Remove(ctx context.Context, config Config) error { |
| 103 | err := s.store.Delete(ctx, config.Name, func(v journal.Entry) bool { |
| 104 | p, ok := v.(*Config) |
| 105 | if !ok { |
| 106 | return false |
| 107 | } |
| 108 | return p.ID == config.ID |
| 109 | }) |
| 110 | if err != nil { |
| 111 | if err == journal.ErrNoSuchKey { |
| 112 | return fmt.Errorf("%s: %w", config.ID, ErrNotFound) |
| 113 | } |
| 114 | if err == journal.ErrConstraint { |
| 115 | return fmt.Errorf("%s: pool %q renamed during removal", config.Name, config.ID) |
| 116 | } |
| 117 | return err |
| 118 | } |
| 119 | return nil |
| 120 | } |
no test coverage detected