mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
swarm/storage: Remove comment
This commit is contained in:
parent
82ca35d666
commit
47db1fa245
2 changed files with 8 additions and 26 deletions
|
|
@ -95,13 +95,13 @@ func NewLDBStoreParams(storeparams *StoreParams, path string) *LDBStoreParams {
|
||||||
}
|
}
|
||||||
|
|
||||||
type garbage struct {
|
type garbage struct {
|
||||||
maxRound int // maximum number of chunks to delete in one garbage collection round
|
maxRound int // maximum number of chunks to delete in one garbage collection round
|
||||||
maxBatch int // maximum number of chunks to delete in one db request batch
|
maxBatch int // maximum number of chunks to delete in one db request batch
|
||||||
ratio int // 1/x ratio to calculate the number of chunks to gc on a low capacity db
|
ratio int // 1/x ratio to calculate the number of chunks to gc on a low capacity db
|
||||||
count int // number of chunks deleted in running round
|
count int // number of chunks deleted in running round
|
||||||
target int // number of chunks to delete in running round
|
target int // number of chunks to delete in running round
|
||||||
batch *dbBatch // the delete batch
|
batch *dbBatch // the delete batch
|
||||||
runC chan struct{}
|
runC chan struct{} // struct in chan means gc is NOT running
|
||||||
}
|
}
|
||||||
|
|
||||||
type LDBStore struct {
|
type LDBStore struct {
|
||||||
|
|
@ -187,6 +187,7 @@ func NewLDBStore(params *LDBStoreParams) (s *LDBStore, err error) {
|
||||||
maxRound: defaultMaxGCRound,
|
maxRound: defaultMaxGCRound,
|
||||||
ratio: defaultGCRatio,
|
ratio: defaultGCRatio,
|
||||||
}
|
}
|
||||||
|
|
||||||
s.gc.runC = make(chan struct{}, 1)
|
s.gc.runC = make(chan struct{}, 1)
|
||||||
s.gc.runC <- struct{}{}
|
s.gc.runC <- struct{}{}
|
||||||
|
|
||||||
|
|
@ -313,7 +314,6 @@ func decodeData(addr Address, data []byte) (*chunk, error) {
|
||||||
func (s *LDBStore) collectGarbage() error {
|
func (s *LDBStore) collectGarbage() error {
|
||||||
|
|
||||||
// prevent duplicate gc from starting when one is already running
|
// prevent duplicate gc from starting when one is already running
|
||||||
// runC contains a struct{} as long as we are NOT running
|
|
||||||
if len(s.gc.runC) == 0 {
|
if len(s.gc.runC) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -589,21 +589,3 @@ func waitGc(ctx context.Context, ldb *LDBStore) {
|
||||||
<-ldb.gc.runC
|
<-ldb.gc.runC
|
||||||
ldb.gc.runC <- struct{}{}
|
ldb.gc.runC <- struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
//func waitGc(ctx context.Context, ldb *LDBStore) error {
|
|
||||||
// ticker := time.Tick(time.Millisecond * 100)
|
|
||||||
// for {
|
|
||||||
// select {
|
|
||||||
//
|
|
||||||
// case <-ctx.Done():
|
|
||||||
// return errors.New("timeout")
|
|
||||||
// case <-ticker:
|
|
||||||
// ldb.lock.Lock()
|
|
||||||
// running := ldb.gc.running
|
|
||||||
// ldb.lock.Unlock()
|
|
||||||
// if !running {
|
|
||||||
// return nil
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue