Add adds the given object
(id string)
| 27 | |
| 28 | // Add adds the given object |
| 29 | func (o *Objects) Add(id string) bool { |
| 30 | |
| 31 | if _, ok := o.Contains(id); ok { |
| 32 | return false |
| 33 | } |
| 34 | |
| 35 | o.mutex.Lock() |
| 36 | defer o.mutex.Unlock() |
| 37 | |
| 38 | o.ids = append(o.ids, id) |
| 39 | sort.Strings(o.ids) |
| 40 | |
| 41 | return true |
| 42 | } |
| 43 | |
| 44 | // Remove removes the given object, if it exists |
| 45 | func (o *Objects) Remove(id string) bool { |