(context.Context)
| 109 | } |
| 110 | |
| 111 | func (c *scriptedConnector) Connect(context.Context) (lifecycle.Session, error) { |
| 112 | c.calls.Add(1) |
| 113 | c.mu.Lock() |
| 114 | if c.idx >= len(c.scripts) { |
| 115 | c.mu.Unlock() |
| 116 | return nil, errors.New("scripted connector exhausted") |
| 117 | } |
| 118 | step := c.scripts[c.idx] |
| 119 | c.idx++ |
| 120 | c.mu.Unlock() |
| 121 | |
| 122 | if step.err != nil { |
| 123 | return nil, step.err |
| 124 | } |
| 125 | c.delivered <- step.session |
| 126 | return step.session, nil |
| 127 | } |
| 128 | |
| 129 | func (c *scriptedConnector) Calls() int { return int(c.calls.Load()) } |
| 130 |