Browse Source

checkKeyCondition -> IsKeyInDomain

pull/1842/head
Ethan Buchman 7 years ago
parent
commit
318982c0ba
3 changed files with 3 additions and 3 deletions
  1. +1
    -1
      db/fsdb.go
  2. +1
    -1
      db/mem_db.go
  3. +1
    -1
      db/util.go

+ 1
- 1
db/fsdb.go View File

@ -247,7 +247,7 @@ func list(dirPath string, start, end []byte) ([]string, error) {
if err != nil {
return nil, fmt.Errorf("Failed to unescape %s while listing", name)
}
if checkKeyCondition(n, start, end) {
if IsKeyInDomain(n, start, end) {
paths = append(paths, n)
}
}


+ 1
- 1
db/mem_db.go View File

@ -157,7 +157,7 @@ func (db *MemDB) ReverseIterator(start, end []byte) Iterator {
func (db *MemDB) getSortedKeys(start, end []byte) []string {
keys := []string{}
for key, _ := range db.db {
if checkKeyCondition(key, start, end) {
if IsKeyInDomain(key, start, end) {
keys = append(keys, key)
}
}


+ 1
- 1
db/util.go View File

@ -39,7 +39,7 @@ func cpIncr(bz []byte) (ret []byte) {
return EndingKey()
}
func checkKeyCondition(key string, start, end []byte) bool {
func IsKeyInDomain(key string, start, end []byte) bool {
leftCondition := bytes.Equal(start, BeginningKey()) || strings.Compare(key, string(start)) >= 0
rightCondition := bytes.Equal(end, EndingKey()) || strings.Compare(key, string(end)) < 0
return leftCondition && rightCondition


Loading…
Cancel
Save