Store saves a state instance and returns its key. This always generates a new key for immutability.
(st ShellState)
| 82 | // |
| 83 | // This always generates a new key for immutability. |
| 84 | func (s *ShellStateStore) Store(st ShellState) string { |
| 85 | st.Key = rand.Text() |
| 86 | s.mu.Lock() |
| 87 | s.data[st.Key] = st |
| 88 | s.mu.Unlock() |
| 89 | return st.Key |
| 90 | } |
| 91 | |
| 92 | // Get returns a state instance by key. |
| 93 | func (s *ShellStateStore) Get(key string) (ShellState, bool) { |