This commit is contained in:
Chris Lu
2019-07-21 21:51:38 -07:00
parent 79762385bd
commit 862c2cb8e6
6 changed files with 9 additions and 13 deletions

View File

@@ -21,7 +21,7 @@ func init() {
}
type LevelDB2Store struct {
dbs []*leveldb.DB
dbs []*leveldb.DB
dbCount int
}
@@ -46,7 +46,7 @@ func (store *LevelDB2Store) initialize(dir string, dbCount int) (err error) {
CompactionTableSizeMultiplier: 4,
}
for d := 0 ; d < dbCount; d++ {
for d := 0; d < dbCount; d++ {
dbFolder := fmt.Sprintf("%s/%02d", dir, d)
os.MkdirAll(dbFolder, 0755)
db, dbErr := leveldb.OpenFile(dbFolder, opts)
@@ -204,5 +204,5 @@ func hashToBytes(dir string, dbCount int) ([]byte, int) {
x := b[len(b)-1]
return b, int(x)%dbCount
return b, int(x) % dbCount
}