GetStateKey returns the state key from a token. If input is not exactly a token, returns an empty string.
(in string)
| 53 | // |
| 54 | // If input is not exactly a token, returns an empty string. |
| 55 | func GetStateKey(in string) string { |
| 56 | m := shellStatePattern.FindAllStringSubmatch(in, -1) |
| 57 | if len(m) != 1 { |
| 58 | return "" |
| 59 | } |
| 60 | token, key := m[0][0], m[0][1] |
| 61 | if token != in { |
| 62 | return "" |
| 63 | } |
| 64 | return key |
| 65 | } |
| 66 | |
| 67 | // ShellStateStore manages state instances in memory concurrently. |
| 68 | type ShellStateStore struct { |
no outgoing calls
no test coverage detected