@@ -33,20 +33,22 @@ import (
33
33
// dbT implements db-level tools, including both configuration state and the
34
34
// commands themselves.
35
35
type dbT struct {
36
- Root * cobra.Command
37
- Check * cobra.Command
38
- Upgrade * cobra.Command
39
- Checkpoint * cobra.Command
40
- Get * cobra.Command
41
- Logs * cobra.Command
42
- LSM * cobra.Command
43
- Properties * cobra.Command
44
- Scan * cobra.Command
45
- Set * cobra.Command
46
- Space * cobra.Command
47
- IOBench * cobra.Command
48
- Excise * cobra.Command
49
- AnalyzeData * cobra.Command
36
+ Root * cobra.Command
37
+ Check * cobra.Command
38
+ Upgrade * cobra.Command
39
+ Checkpoint * cobra.Command
40
+ Get * cobra.Command
41
+ Inspect * cobra.Command
42
+ InspectManifest * cobra.Command
43
+ Logs * cobra.Command
44
+ LSM * cobra.Command
45
+ Properties * cobra.Command
46
+ Scan * cobra.Command
47
+ Set * cobra.Command
48
+ Space * cobra.Command
49
+ IOBench * cobra.Command
50
+ Excise * cobra.Command
51
+ AnalyzeData * cobra.Command
50
52
51
53
// Configuration.
52
54
opts * pebble.Options
@@ -153,6 +155,13 @@ process.
153
155
Args : cobra .ExactArgs (2 ),
154
156
Run : d .runGet ,
155
157
}
158
+ d .Inspect = & cobra.Command {
159
+ Use : "inspect <dir>" ,
160
+ Short : "inspect DB internals without opening" ,
161
+ Long : `
162
+ Inspect the DB internals without opening the DB.
163
+ ` ,
164
+ }
156
165
d .Logs = logs .NewCmd ()
157
166
d .LSM = & cobra.Command {
158
167
Use : "lsm <dir>" ,
@@ -235,7 +244,17 @@ experiments and produce a CSV file of the results.
235
244
Run : d .runAnalyzeData ,
236
245
}
237
246
238
- d .Root .AddCommand (d .Check , d .Upgrade , d .Checkpoint , d .Get , d .Logs , d .LSM , d .Properties , d .Scan , d .Set , d .Space , d .Excise , d .IOBench , d .AnalyzeData )
247
+ d .Inspect .AddCommand (& cobra.Command {
248
+ Use : "manifest <dir>" ,
249
+ Short : "Return the manifest filename" ,
250
+ Long : `
251
+ Returns the filename of the current manifest file.
252
+ ` ,
253
+ Args : cobra .ExactArgs (1 ),
254
+ Run : d .inspectManifest ,
255
+ })
256
+
257
+ d .Root .AddCommand (d .Check , d .Upgrade , d .Checkpoint , d .Get , d .Inspect , d .Logs , d .LSM , d .Properties , d .Scan , d .Set , d .Space , d .Excise , d .IOBench , d .AnalyzeData )
239
258
d .Root .PersistentFlags ().BoolVarP (& d .verbose , "verbose" , "v" , false , "verbose output" )
240
259
241
260
for _ , cmd := range []* cobra.Command {d .Check , d .Upgrade , d .Checkpoint , d .Get , d .LSM , d .Properties , d .Scan , d .Set , d .Space , d .Excise , d .AnalyzeData } {
@@ -431,6 +450,15 @@ func (d *dbT) closeDB(stderr io.Writer, db *pebble.DB) {
431
450
}
432
451
}
433
452
453
+ func (d * dbT ) inspectManifest (cmd * cobra.Command , args []string ) {
454
+ desc , err := pebble .Peek (args [0 ], d .opts .FS )
455
+ if err != nil {
456
+ fmt .Fprintf (cmd .ErrOrStderr (), "%s\n " , err )
457
+ return
458
+ }
459
+ fmt .Fprintf (cmd .OutOrStdout (), "%s\n " , desc .ManifestFilename )
460
+ }
461
+
434
462
func (d * dbT ) runCheck (cmd * cobra.Command , args []string ) {
435
463
stdout , stderr := cmd .OutOrStdout (), cmd .ErrOrStderr ()
436
464
db , err := d .openDB (args [0 ])
0 commit comments