putToPreparation adds the given name to the in-creation map. Returns an error if it's already there (to prevent circular creation).
(name string)
| 64 | // putToPreparation adds the given name to the in-creation map. |
| 65 | // Returns an error if it's already there (to prevent circular creation). |
| 66 | func (s *creationState) putToPreparation(name string) error { |
| 67 | s.mu.Lock() |
| 68 | defer s.mu.Unlock() |
| 69 | |
| 70 | if _, ok := s.currentlyInCreation[name]; ok { |
| 71 | return ErrInstanceInPreparation |
| 72 | } |
| 73 | |
| 74 | s.currentlyInCreation[name] = struct{}{} |
| 75 | return nil |
| 76 | } |
| 77 | |
| 78 | // removeFromPreparation removes the given name from the in-creation map. |
| 79 | func (s *creationState) removeFromPreparation(name string) { |
no outgoing calls