Skip to content

Commit 3070a87

Browse files
committed
cli: pebble: enable remote storage for analyze-data
Set up a `tool.WithDBRemoteStorageFn` callback to allow the debug tool to use remote storage for `analyze-data`. Epic: none Release note: None
1 parent 88410ab commit 3070a87

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pkg/cli/debug.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,7 @@ func init() {
14481448
}),
14491449
tool.OpenOptions(pebbleOpenOptionLockDir{pebbleToolFS}),
14501450
tool.WithDBExciseSpanFn(pebbleExciseSpanFn),
1451+
tool.WithDBRemoteStorageFn(pebbleRemoteStorageFn),
14511452
)
14521453
debugPebbleCmd.AddCommand(pebbleTool.Commands...)
14531454
f := debugPebbleCmd.PersistentFlags()
@@ -1714,6 +1715,25 @@ func pebbleExciseSpanFn() (pebble.KeyRange, error) {
17141715
}, nil
17151716
}
17161717

1718+
func pebbleRemoteStorageFn(uri string) (remote.Storage, error) {
1719+
es, err := cloud.ExternalStorageFromURI(
1720+
context.Background(),
1721+
uri,
1722+
base.ExternalIODirConfig{},
1723+
cluster.MakeClusterSettings(),
1724+
nil, /* blobClientFactory: */
1725+
username.PublicRoleName(),
1726+
nil, /* db */
1727+
nil, /* limiters */
1728+
cloud.NilMetrics,
1729+
)
1730+
if err != nil {
1731+
return nil, err
1732+
}
1733+
wrapper := storage.MakeExternalStorageWrapper(context.Background(), es)
1734+
return wrapper, nil
1735+
}
1736+
17171737
func pebbleCryptoInitializer(ctx context.Context) {
17181738
var encryptedPaths []string
17191739
for _, spec := range encryptionSpecs.Specs {

0 commit comments

Comments
 (0)