better debug output
This commit is contained in:
parent
a8fe33ecf4
commit
05e0a506b4
2 changed files with 11 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -12,7 +13,6 @@ import (
|
||||||
"github.com/lbryio/reflector.go/reflector"
|
"github.com/lbryio/reflector.go/reflector"
|
||||||
"github.com/lbryio/reflector.go/store"
|
"github.com/lbryio/reflector.go/store"
|
||||||
|
|
||||||
"github.com/davecgh/go-spew/spew"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
@ -50,5 +50,9 @@ func testCmd(cmd *cobra.Command, args []string) {
|
||||||
<-interruptChan
|
<-interruptChan
|
||||||
peerServer.Shutdown()
|
peerServer.Shutdown()
|
||||||
reflectorServer.Shutdown()
|
reflectorServer.Shutdown()
|
||||||
spew.Dump(memStore)
|
|
||||||
|
fmt.Println("Blobs in store")
|
||||||
|
for hash, blob := range memStore.Debug() {
|
||||||
|
fmt.Printf("%s: %d bytes\n", hash, len(blob))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,3 +47,8 @@ func (m *MemoryBlobStore) Delete(hash string) error {
|
||||||
delete(m.blobs, hash)
|
delete(m.blobs, hash)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debug returns the blobs in memory. It's useful for testing and debugging.
|
||||||
|
func (m *MemoryBlobStore) Debug() map[string][]byte {
|
||||||
|
return m.blobs
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue