KeySplits can be used to get rough key ranges to divide up iteration over the DB.
(prefix []byte)
| 1367 | // KeySplits can be used to get rough key ranges to divide up iteration over |
| 1368 | // the DB. |
| 1369 | func (db *DB) KeySplits(prefix []byte) []string { |
| 1370 | var splits []string |
| 1371 | // We just want table ranges here and not keys count. |
| 1372 | for _, ti := range db.Tables(false) { |
| 1373 | // We don't use ti.Left, because that has a tendency to store !badger |
| 1374 | // keys. |
| 1375 | if bytes.HasPrefix(ti.Right, prefix) { |
| 1376 | splits = append(splits, string(ti.Right)) |
| 1377 | } |
| 1378 | } |
| 1379 | sort.Strings(splits) |
| 1380 | return splits |
| 1381 | } |
| 1382 | |
| 1383 | // MaxBatchCount returns max possible entries in batch |
| 1384 | func (db *DB) MaxBatchCount() int64 { |