This commit is contained in:
Chris Lu
2021-10-07 21:13:31 -07:00
parent 0a856241fe
commit e4830bd93d
11 changed files with 30 additions and 31 deletions

View File

@@ -249,7 +249,7 @@ func (nl *NameList) DeleteName(name string) error {
}
return nil
}
if nextNameBatch != nil && len(nextNameBatch.names) + len(prevNameBatch.names) < nl.batchSize {
if nextNameBatch != nil && len(nextNameBatch.names)+len(prevNameBatch.names) < nl.batchSize {
// case 3.1 merge nextNode and prevNode
if _, err := nl.skipList.DeleteByKey(nextNode.Key); err != nil {
return err
@@ -300,7 +300,7 @@ func (nl *NameList) ListNames(startFrom string, visitNamesFn func(name string) b
}
}
return nil
return nil
}
func (nl *NameList) RemoteAllListElement() error {
@@ -323,4 +323,4 @@ func (nl *NameList) RemoteAllListElement() error {
}
return nil
}
}

View File

@@ -68,4 +68,4 @@ func (nl *NameList) ToBytes() []byte {
glog.Errorf("marshal skiplist: %v", err)
}
return data
}
}

View File

@@ -34,7 +34,7 @@ func TestNameList(t *testing.T) {
// list.skipList.println()
deleteBase := 5
deleteCount := maxNameCount - 3 * deleteBase
deleteCount := maxNameCount - 3*deleteBase
for i := deleteBase; i < deleteBase+deleteCount; i++ {
list.DeleteName(String(i))

View File

@@ -467,7 +467,7 @@ func (t *SkipList) GetSmallestNode() (*SkipListElement, error) {
func (t *SkipList) GetLargestNode() (*SkipListElement, error) {
return t.LoadElement(t.EndLevels[0])
}
func (t *SkipList) GetLargestNodeReference() (*SkipListElementReference) {
func (t *SkipList) GetLargestNodeReference() *SkipListElementReference {
return t.EndLevels[0]
}

View File

@@ -48,4 +48,4 @@ func (ref *SkipListElementReference) IsNil() bool {
return true
}
return false
}
}

View File

@@ -30,7 +30,6 @@ func TestReverseInsert(t *testing.T) {
}
func TestInsertAndFind(t *testing.T) {
k0 := []byte("0")