code: func NewLDBStore(params *LDBStoreParams) (s *LDBStore, err error) {
  	s = new(LDBStore)
  	s.hashfunc = params.Hash
  	s.quit = make(chan struct{})
  
  	s.batchesC = make(chan struct{}, 1)
  	go s.writeBatches()
  	s.batch = newBatch()
  	// associate encodeData with default functionality
  	s.encodeDataFunc = encodeData
  
  	s.db, err = NewLDBDatabase(params.Path)
  	if err != nil {
  		return nil, err
  	}
  
  	s.po = params.Po
  	s.setCapacity(params.DbCapacity)
  
  	s.bucketCnt = make([]uint64, 0x100)
  	for i := 0; i < 0x100; i++ {
  		k := make([]byte, 2)
  		k[0] = keyDistanceCnt
  		k[1] = uint8(i)
  		cnt, _ := s.db.Get(k)
  		s.bucketCnt[i] = BytesToU64(cnt)
  	}
  	data, _ := s.db.Get(keyEntryCnt)
  	s.entryCnt = BytesToU64(data)
  	data, _ = s.db.Get(keyAccessCnt)
  	s.accessCnt = BytesToU64(data)
  	data, _ = s.db.Get(keyDataIdx)
  	s.dataIdx = BytesToU64(data)
  
  	// set up garbage collection
  	s.gc = &garbage{
  		maxBatch: defaultMaxGCBatch,
  		maxRound: defaultMaxGCRound,
  		ratio:    defaultGCRatio,
  	}
  
  	s.gc.runC = make(chan struct{}, 1)
  	s.gc.runC <- struct{}{}
  
  	return s, nil
  }
docs: // TODO: Instead of passing the distance function, just pass the address from which distances are calculated
  // to avoid the appearance of a pluggable distance metric and opportunities of bugs associated with providing
  // a function different from the one that is actually used.