code: func (db *DB) collectGarbageWorker() {
  	defer close(db.collectGarbageWorkerDone)
  
  	for {
  		select {
  		case <-db.collectGarbageTrigger:
  			// run a single collect garbage run and
  			// if done is false, gcBatchSize is reached and
  			// another collect garbage run is needed
  			collectedCount, done, err := db.collectGarbage()
  			if err != nil {
  				log.Error("localstore collect garbage", "err", err)
  			}
  			// check if another gc run is needed
  			if !done {
  				db.triggerGarbageCollection()
  			}
  
  			if collectedCount > 0 && testHookCollectGarbage != nil {
  				testHookCollectGarbage(collectedCount)
  			}
  		case <-db.close:
  			return
  		}
  	}
  }
docs: // collectGarbageWorker is a long running function that waits for
  // collectGarbageTrigger channel to signal a garbage collection
  // run. GC run iterates on gcIndex and removes older items
  // form retrieval and other indexes.