@@ -44,14 +44,14 @@ type sstableT struct {
44
44
mergers sstable.Mergers
45
45
46
46
// Flags.
47
- fmtKey keyFormatter
48
- fmtValue valueFormatter
49
- start key
50
- end key
51
- filter key
52
- count int64
53
- verbose bool
54
- blobMode string
47
+ fmtKey keyFormatter
48
+ fmtValue valueFormatter
49
+ start key
50
+ end key
51
+ filter key
52
+ count int64
53
+ verbose bool
54
+ blobModeLoad string
55
55
}
56
56
57
57
func newSSTable (
@@ -103,9 +103,6 @@ properties are pretty-printed or displayed in a verbose/raw format.
103
103
Print the records in the sstables. The sstables are scanned in command line
104
104
order which means the records will be printed in that order. Raw range
105
105
tombstones are displayed interleaved with point records.
106
-
107
- When --blob-mode=load is specified, the path to a directory containing a
108
- manifest and blob file must be provided as the last argument.
109
106
` ,
110
107
Args : cobra .MinimumNArgs (1 ),
111
108
Run : s .runScan ,
@@ -145,7 +142,8 @@ inclusive-inclusive range specified by --start and --end.
145
142
s .Scan .Flags ().Int64Var (
146
143
& s .count , "count" , 0 , "key count for scan (0 is unlimited)" )
147
144
s .Scan .Flags ().StringVar (
148
- & s .blobMode , "blob-mode" , "none" , "blob value formatter" )
145
+ & s .blobModeLoad , "load-blobs-from" , "" , "relative path to a directory containing a manifest and " +
146
+ "blob file to load values from" )
149
147
150
148
return s
151
149
}
@@ -339,25 +337,14 @@ func (s *sstableT) runProperties(cmd *cobra.Command, args []string) {
339
337
340
338
func (s * sstableT ) runScan (cmd * cobra.Command , args []string ) {
341
339
stdout , stderr := cmd .OutOrStdout (), cmd .OutOrStderr ()
342
- // If in blob load mode, the last argument is the path to our directory
343
- // containing the manifest(s) and blob file(s).
344
- blobMode := ConvertToBlobRefMode (s .blobMode )
345
- var blobDir string
346
340
var blobMappings * blobFileMappings
347
- if blobMode == BlobRefModeLoad {
348
- if len (args ) < 2 {
349
- fmt .Fprintf (stderr , "when --blob-mode=load is specified, the path to a " +
350
- "directory containing a manifest and blob file must be provided as the last argument" )
351
- return
352
- }
353
- blobDir = args [len (args )- 1 ]
354
- args = args [:len (args )- 1 ]
355
- manifests , err := findManifests (stderr , s .opts .FS , blobDir )
341
+ if s .blobModeLoad != "" {
342
+ manifests , err := findManifests (stderr , s .opts .FS , s .blobModeLoad )
356
343
if err != nil {
357
344
fmt .Fprintf (stderr , "%s\n " , err )
358
345
return
359
346
}
360
- blobMappings , err = newBlobFileMappings (stderr , s .opts .FS , blobDir , manifests )
347
+ blobMappings , err = newBlobFileMappings (stderr , s .opts .FS , s . blobModeLoad , manifests )
361
348
if err != nil {
362
349
fmt .Fprintf (stderr , "%s\n " , err )
363
350
return
@@ -379,22 +366,15 @@ func (s *sstableT) runScan(cmd *cobra.Command, args []string) {
379
366
prefix = fmt .Sprintf ("%s: " , path )
380
367
}
381
368
382
- var blobContext sstable.TableBlobContext
383
- switch blobMode {
384
- case BlobRefModePrint :
385
- s .fmtValue .mustSet ("[%s]" )
386
- blobContext = sstable .DebugHandlesBlobContext
387
- case BlobRefModeLoad :
369
+ blobContext := sstable .DebugHandlesBlobContext
370
+ if s .blobModeLoad != "" {
388
371
// If the file number is unset, we are likely trying to read a
389
372
// non numerically named file.
390
373
if r .BlockReader ().FileNum () == 0 {
391
374
fmt .Fprintf (stderr , "unset file in path %s\n " , path )
392
375
return
393
376
}
394
- s .fmtValue .mustSet ("[%s]" )
395
377
blobContext = blobMappings .LoadValueBlobContext (base .PhysicalTableFileNum (r .BlockReader ().FileNum ()))
396
- default :
397
- blobContext = sstable .AssertNoBlobHandles
398
378
}
399
379
iter , err := r .NewIter (sstable .NoTransforms , nil , s .end , blobContext )
400
380
if err != nil {
0 commit comments