Method
Repair
(path string, cfg *config.Config)
Source from the content-addressed store, hash-verified
| 50 | } |
| 51 | |
| 52 | func (s Store) Repair(path string, cfg *config.Config) error { |
| 53 | // Open database with default options |
| 54 | db, err := badger.Open(badger.DefaultOptions(path)) |
| 55 | if err != nil { |
| 56 | return err |
| 57 | } |
| 58 | defer db.Close() |
| 59 | |
| 60 | // Run value log GC to clean up any corrupted data |
| 61 | for { |
| 62 | err := db.RunValueLogGC(0.7) |
| 63 | if err == badger.ErrNoRewrite { |
| 64 | break |
| 65 | } |
| 66 | if err != nil { |
| 67 | return err |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | return nil |
| 72 | } |
Callers
nothing calls this directly
Tested by
no test coverage detected