fix lotus-shed
This commit is contained in:
parent
aec126879e
commit
4715b1f436
@ -950,3 +950,9 @@ func (b *Blockstore) StorageKey(dst []byte, cid cid.Cid) []byte {
|
|||||||
}
|
}
|
||||||
return dst[:reqsize]
|
return dst[:reqsize]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this method is added for lotus-shed needs
|
||||||
|
// WARNING: THIS IS COMPLETELY UNSAFE; DONT USE THIS IN PRODUCTION CODE
|
||||||
|
func (b *Blockstore) DB() *badger.DB {
|
||||||
|
return b.db
|
||||||
|
}
|
||||||
|
@ -161,7 +161,7 @@ var stateTreePruneCmd = &cli.Command{
|
|||||||
if cctx.Bool("only-ds-gc") {
|
if cctx.Bool("only-ds-gc") {
|
||||||
fmt.Println("running datastore gc....")
|
fmt.Println("running datastore gc....")
|
||||||
for i := 0; i < cctx.Int("gc-count"); i++ {
|
for i := 0; i < cctx.Int("gc-count"); i++ {
|
||||||
if err := badgbs.DB.RunValueLogGC(DiscardRatio); err != nil {
|
if err := badgbs.DB().RunValueLogGC(DiscardRatio); err != nil {
|
||||||
return xerrors.Errorf("datastore GC failed: %w", err)
|
return xerrors.Errorf("datastore GC failed: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ var stateTreePruneCmd = &cli.Command{
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
b := badgbs.DB.NewWriteBatch()
|
b := badgbs.DB().NewWriteBatch()
|
||||||
defer b.Cancel()
|
defer b.Cancel()
|
||||||
|
|
||||||
markForRemoval := func(c cid.Cid) error {
|
markForRemoval := func(c cid.Cid) error {
|
||||||
@ -249,7 +249,7 @@ var stateTreePruneCmd = &cli.Command{
|
|||||||
|
|
||||||
fmt.Println("running datastore gc....")
|
fmt.Println("running datastore gc....")
|
||||||
for i := 0; i < cctx.Int("gc-count"); i++ {
|
for i := 0; i < cctx.Int("gc-count"); i++ {
|
||||||
if err := badgbs.DB.RunValueLogGC(DiscardRatio); err != nil {
|
if err := badgbs.DB().RunValueLogGC(DiscardRatio); err != nil {
|
||||||
return xerrors.Errorf("datastore GC failed: %w", err)
|
return xerrors.Errorf("datastore GC failed: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user