MCPcopy
hub / github.com/kopia/kopia / NewReconnectableStorage

Function NewReconnectableStorage

internal/repotesting/reconnectable_storage.go:36–47  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

34// in a wrapper that globally caches storage instance and ensures its connection info is
35// round-trippable.
36func 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
50var reconnectableStorageByUUID sync.Map

Callers 4

setupInMemoryRepoMethod · 0.92
newUploadTestHarnessFunction · 0.92
setupMethod · 0.85

Calls 4

HelperMethod · 0.80
StoreMethod · 0.65
CleanupMethod · 0.65
DeleteMethod · 0.65

Tested by 3

setupInMemoryRepoMethod · 0.74
newUploadTestHarnessFunction · 0.74