checkKeyCondition -> IsKeyInDomain

This commit is contained in:
Ethan Buchman
2017-12-13 01:33:38 -05:00
parent 5636a02d03
commit 318982c0ba
3 changed files with 3 additions and 3 deletions

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)
}
}

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)
}
}

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