swarm/storage: Remove comment

This commit is contained in:
lash 2018-10-12 10:31:58 +02:00
parent 82ca35d666
commit 47db1fa245
2 changed files with 8 additions and 26 deletions

View file

@ -101,7 +101,7 @@ type garbage struct {
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
} }

View file

@ -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
// }
// }
// }
//}