Skip to content

Instantly share code, notes, and snippets.

@zelig
Last active April 7, 2017 14:39
Show Gist options
  • Save zelig/3c8507e919fa45d2ba38ddd260c76ea0 to your computer and use it in GitHub Desktop.
Save zelig/3c8507e919fa45d2ba38ddd260c76ea0 to your computer and use it in GitHub Desktop.
dumper
func (s *DbStore) Dump() {
//Iterates over the database and checks that there are no faulty chunks
it := s.db.NewIterator()
startPosition := []byte{kpIndex}
it.Seek(startPosition)
var key []byte
var total int
for it.Valid() {
key = it.Key()
if (key == nil) || (key[0] != kpIndex) {
break
}
total++
fmt.Printf("%x\n", key[1:])
it.Next()
}
it.Release()
log.Warn(fmt.Sprintf("logged %v chunks", total))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment