NewReconnectableStorage wraps the provided storage that may or may not be round-trippable in a wrapper that globally caches storage instance and ensures its connection info is round-trippable.
(tb testing.TB, st blob.Storage)
| 34 | // in a wrapper that globally caches storage instance and ensures its connection info is |
| 35 | // round-trippable. |
| 36 | func NewReconnectableStorage(tb testing.TB, st blob.Storage) blob.Storage { |
| 37 | tb.Helper() |
| 38 | |
| 39 | st2 := reconnectableStorage{st, &ReconnectableStorageOptions{UUID: uuid.NewString()}} |
| 40 | |
| 41 | reconnectableStorageByUUID.Store(st2.opt.UUID, st2) |
| 42 | tb.Cleanup(func() { |
| 43 | reconnectableStorageByUUID.Delete(st2.opt.UUID) |
| 44 | }) |
| 45 | |
| 46 | return st2 |
| 47 | } |
| 48 | |
| 49 | //nolint:gochecknoglobals |
| 50 | var reconnectableStorageByUUID sync.Map |