Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

chore(skiplist): remove unused NameList/NameBatch implementation (#9603)

Chris Lu2c2b2d4d3ebb
diff --git a/weed/util/skiplist/name_batch.go b/weed/util/skiplist/name_batch.go
deleted file mode 100644
index c0a759f3a4..0000000000
--- a/weed/util/skiplist/name_batch.go
+++ /dev/null
@@ -1,103 +0,0 @@
-package skiplist
-
-import (
- "slices"
- "strings"
-
- "github.com/seaweedfs/seaweedfs/weed/glog"
- "google.golang.org/protobuf/proto"
-)
-
-type NameBatch struct {
- key string
- names map[string]struct{}
-}
-
-func (nb *NameBatch) ContainsName(name string) (found bool) {
- _, found = nb.names[name]
- return
-}
-func (nb *NameBatch) WriteName(name string) {
- if nb.key == "" || strings.Compare(nb.key, name) > 0 {
- nb.key = name
- }
- nb.names[name] = struct{}{}
-}
-func (nb *NameBatch) DeleteName(name string) {
- delete(nb.names, name)
- if nb.key == name {
- nb.key = ""
- for n := range nb.names {
- if nb.key == "" || strings.Compare(nb.key, n) > 0 {
- nb.key = n
- }
- }
- }
-}
-func (nb *NameBatch) ListNames(startFrom string, visitNamesFn func(name string) bool) bool {
- var names []string
- needFilter := startFrom != ""
- for n := range nb.names {
- if !needFilter || strings.Compare(n, startFrom) >= 0 {
- names = append(names, n)
- }
- }
- slices.SortFunc(names, func(a, b string) int {
- return strings.Compare(a, b)
- })
- for _, n := range names {
- if !visitNamesFn(n) {
- return false
- }
- }
- return true
-}
-
-func NewNameBatch() *NameBatch {
- return &NameBatch{
- names: make(map[string]struct{}),
- }
-}
-
-func LoadNameBatch(data []byte) *NameBatch {
- t := &NameBatchData{}
- if len(data) > 0 {
- err := proto.Unmarshal(data, t)
- if err != nil {
- glog.Errorf("unmarshal into NameBatchData{} : %v", err)
- return nil
- }
- }
- nb := NewNameBatch()
- for _, n := range t.Names {
- name := string(n)
- if nb.key == "" || strings.Compare(nb.key, name) > 0 {
- nb.key = name
- }
- nb.names[name] = struct{}{}
- }
- return nb
-}
-
-func (nb *NameBatch) ToBytes() []byte {
- t := &NameBatchData{}
- for n := range nb.names {
- t.Names = append(t.Names, []byte(n))
- }
- data, _ := proto.Marshal(t)
- return data
-}
-
-func (nb *NameBatch) SplitBy(name string) (x, y *NameBatch) {
- x, y = NewNameBatch(), NewNameBatch()
-
- for n := range nb.names {
- // there should be no equal case though
- if strings.Compare(n, name) <= 0 {
- x.WriteName(n)
- } else {
- y.WriteName(n)
- }
- }
- return
-}
diff --git a/weed/util/skiplist/name_list.go b/weed/util/skiplist/name_list.go
deleted file mode 100644
index 5171734244..0000000000
--- a/weed/util/skiplist/name_list.go
+++ /dev/null
@@ -1,334 +0,0 @@
-package skiplist
-
-import (
- "bytes"
-)
-
-type NameList struct {
- skipList *SkipList
- batchSize int
-}
-
-func newNameList(store ListStore, batchSize int) *NameList {
- return &NameList{
- skipList: New(store),
- batchSize: batchSize,
- }
-}
-
-/*
-Be reluctant to create new nodes. Try to fit into either previous node or next node.
-Prefer to add to previous node.
-
-There are multiple cases after finding the name for greater or equal node
-
- 1. found and node.Key == name
- The node contains a batch with leading key the same as the name
- nothing to do
-
- 2. no such node found or node.Key > name
-
- if no such node found
- prevNode = list.LargestNode
-
- // case 2.1
- if previousNode contains name
- nothing to do
-
- // prefer to add to previous node
- if prevNode != nil {
- // case 2.2
- if prevNode has capacity
- prevNode.add name, and save
- return
- // case 2.3
- split prevNode by name
- }
-
- // case 2.4
- // merge into next node. Avoid too many nodes if adding data in reverse order.
- if nextNode is not nil and nextNode has capacity
- delete nextNode.Key
- nextNode.Key = name
- nextNode.batch.add name
- insert nodeNode.Key
- return
-
- // case 2.5
- if prevNode is nil
- insert new node with key = name, value = batch{name}
- return
-*/
-func (nl *NameList) WriteName(name string) error {
-
- lookupKey := []byte(name)
- prevNode, nextNode, found, err := nl.skipList.FindGreaterOrEqual(lookupKey)
- if err != nil {
- return err
- }
- // case 1: the name already exists as one leading key in the batch
- if found && bytes.Compare(nextNode.Key, lookupKey) == 0 {
- return nil
- }
-
- if !found {
- prevNode, err = nl.skipList.GetLargestNode()
- if err != nil {
- return err
- }
- }
-
- if nextNode != nil && prevNode == nil {
- prevNode, err = nl.skipList.LoadElement(nextNode.Prev)
- if err != nil {
- return err
- }
- }
-
- if prevNode != nil {
- prevNameBatch := LoadNameBatch(prevNode.Value)
- // case 2.1
- if prevNameBatch.ContainsName(name) {
- return nil
- }
-
- // case 2.2
- if len(prevNameBatch.names) < nl.batchSize {
- prevNameBatch.WriteName(name)
- return nl.skipList.ChangeValue(prevNode, prevNameBatch.ToBytes())
- }
-
- // case 2.3
- x, y := prevNameBatch.SplitBy(name)
- addToX := len(x.names) <= len(y.names)
- if len(x.names) != len(prevNameBatch.names) {
- if addToX {
- x.WriteName(name)
- }
- if x.key == prevNameBatch.key {
- if err := nl.skipList.ChangeValue(prevNode, x.ToBytes()); err != nil {
- return err
- }
- } else {
- if _, err := nl.skipList.InsertByKey([]byte(x.key), 0, x.ToBytes()); err != nil {
- return err
- }
- }
- }
- if len(y.names) != len(prevNameBatch.names) {
- if !addToX {
- y.WriteName(name)
- }
- if y.key == prevNameBatch.key {
- if err := nl.skipList.ChangeValue(prevNode, y.ToBytes()); err != nil {
- return err
- }
- } else {
- if _, err := nl.skipList.InsertByKey([]byte(y.key), 0, y.ToBytes()); err != nil {
- return err
- }
- }
- }
- return nil
-
- }
-
- // case 2.4
- if nextNode != nil {
- nextNameBatch := LoadNameBatch(nextNode.Value)
- if len(nextNameBatch.names) < nl.batchSize {
- if _, err := nl.skipList.DeleteByKey(nextNode.Key); err != nil {
- return err
- }
- nextNameBatch.WriteName(name)
- if _, err := nl.skipList.InsertByKey([]byte(nextNameBatch.key), 0, nextNameBatch.ToBytes()); err != nil {
- return err
- }
- return nil
- }
- }
-
- // case 2.5
- // now prevNode is nil
- newNameBatch := NewNameBatch()
- newNameBatch.WriteName(name)
- if _, err := nl.skipList.InsertByKey([]byte(newNameBatch.key), 0, newNameBatch.ToBytes()); err != nil {
- return err
- }
-
- return nil
-}
-
-/*
-// case 1: exists in nextNode
-
- if nextNode != nil && nextNode.Key == name {
- remove from nextNode, update nextNode
- // TODO: merge with prevNode if possible?
- return
- }
-
-if nextNode is nil
-
- prevNode = list.Largestnode
-
-if prevNode == nil and nextNode.Prev != nil
-
- prevNode = load(nextNode.Prev)
-
-// case 2: does not exist
-// case 2.1
-
- if prevNode == nil {
- return
- }
-
-// case 2.2
-
- if prevNameBatch does not contain name {
- return
- }
-
-// case 3
-delete from prevNameBatch
-if prevNameBatch + nextNode < capacityList
-
- // case 3.1
- merge
-
-else
-
- // case 3.2
- update prevNode
-*/
-func (nl *NameList) DeleteName(name string) error {
- lookupKey := []byte(name)
- prevNode, nextNode, found, err := nl.skipList.FindGreaterOrEqual(lookupKey)
- if err != nil {
- return err
- }
-
- // case 1
- var nextNameBatch *NameBatch
- if nextNode != nil {
- nextNameBatch = LoadNameBatch(nextNode.Value)
- }
- if found && bytes.Compare(nextNode.Key, lookupKey) == 0 {
- if _, err := nl.skipList.DeleteByKey(nextNode.Key); err != nil {
- return err
- }
- nextNameBatch.DeleteName(name)
- if len(nextNameBatch.names) > 0 {
- if _, err := nl.skipList.InsertByKey([]byte(nextNameBatch.key), 0, nextNameBatch.ToBytes()); err != nil {
- return err
- }
- }
- return nil
- }
-
- if !found {
- prevNode, err = nl.skipList.GetLargestNode()
- if err != nil {
- return err
- }
- }
-
- if nextNode != nil && prevNode == nil {
- prevNode, err = nl.skipList.LoadElement(nextNode.Prev)
- if err != nil {
- return err
- }
- }
-
- // case 2
- if prevNode == nil {
- // case 2.1
- return nil
- }
- prevNameBatch := LoadNameBatch(prevNode.Value)
- if !prevNameBatch.ContainsName(name) {
- // case 2.2
- return nil
- }
-
- // case 3
- prevNameBatch.DeleteName(name)
- if len(prevNameBatch.names) == 0 {
- if _, err := nl.skipList.DeleteByKey(prevNode.Key); err != nil {
- return err
- }
- return nil
- }
- 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
- }
- for nextName := range nextNameBatch.names {
- prevNameBatch.WriteName(nextName)
- }
- return nl.skipList.ChangeValue(prevNode, prevNameBatch.ToBytes())
- } else {
- // case 3.2 update prevNode
- return nl.skipList.ChangeValue(prevNode, prevNameBatch.ToBytes())
- }
-}
-
-func (nl *NameList) ListNames(startFrom string, visitNamesFn func(name string) bool) error {
- lookupKey := []byte(startFrom)
- prevNode, nextNode, found, err := nl.skipList.FindGreaterOrEqual(lookupKey)
- if err != nil {
- return err
- }
- if found && bytes.Compare(nextNode.Key, lookupKey) == 0 {
- prevNode = nil
- }
- if !found {
- prevNode, err = nl.skipList.GetLargestNode()
- if err != nil {
- return err
- }
- }
-
- if prevNode != nil {
- prevNameBatch := LoadNameBatch(prevNode.Value)
- if !prevNameBatch.ListNames(startFrom, visitNamesFn) {
- return nil
- }
- }
-
- for nextNode != nil {
- nextNameBatch := LoadNameBatch(nextNode.Value)
- if !nextNameBatch.ListNames(startFrom, visitNamesFn) {
- return nil
- }
- nextNode, err = nl.skipList.LoadElement(nextNode.Next[0])
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func (nl *NameList) RemoteAllListElement() error {
-
- t := nl.skipList
-
- nodeRef := t.StartLevels[0]
- for nodeRef != nil {
- node, err := t.LoadElement(nodeRef)
- if err != nil {
- return err
- }
- if node == nil {
- return nil
- }
- if err := t.DeleteElement(node); err != nil {
- return err
- }
- nodeRef = node.Next[0]
- }
- return nil
-
-}
diff --git a/weed/util/skiplist/name_list_serde.go b/weed/util/skiplist/name_list_serde.go
deleted file mode 100644
index 364c0f87ae..0000000000
--- a/weed/util/skiplist/name_list_serde.go
+++ /dev/null
@@ -1,71 +0,0 @@
-package skiplist
-
-import (
- "github.com/seaweedfs/seaweedfs/weed/glog"
- "google.golang.org/protobuf/proto"
-)
-
-func LoadNameList(data []byte, store ListStore, batchSize int) *NameList {
-
- nl := &NameList{
- skipList: New(store),
- batchSize: batchSize,
- }
-
- if len(data) == 0 {
- return nl
- }
-
- message := &SkipListProto{}
- if err := proto.Unmarshal(data, message); err != nil {
- glog.Errorf("loading skiplist: %v", err)
- }
- nl.skipList.MaxNewLevel = int(message.MaxNewLevel)
- nl.skipList.MaxLevel = int(message.MaxLevel)
- for i, ref := range message.StartLevels {
- nl.skipList.StartLevels[i] = &SkipListElementReference{
- ElementPointer: ref.ElementPointer,
- Key: ref.Key,
- }
- }
- for i, ref := range message.EndLevels {
- nl.skipList.EndLevels[i] = &SkipListElementReference{
- ElementPointer: ref.ElementPointer,
- Key: ref.Key,
- }
- }
- return nl
-}
-
-func (nl *NameList) HasChanges() bool {
- return nl.skipList.HasChanges
-}
-
-func (nl *NameList) ToBytes() []byte {
- message := &SkipListProto{}
- message.MaxNewLevel = int32(nl.skipList.MaxNewLevel)
- message.MaxLevel = int32(nl.skipList.MaxLevel)
- for _, ref := range nl.skipList.StartLevels {
- if ref == nil {
- break
- }
- message.StartLevels = append(message.StartLevels, &SkipListElementReference{
- ElementPointer: ref.ElementPointer,
- Key: ref.Key,
- })
- }
- for _, ref := range nl.skipList.EndLevels {
- if ref == nil {
- break
- }
- message.EndLevels = append(message.EndLevels, &SkipListElementReference{
- ElementPointer: ref.ElementPointer,
- Key: ref.Key,
- })
- }
- data, err := proto.Marshal(message)
- if err != nil {
- glog.Errorf("marshal skiplist: %v", err)
- }
- return data
-}
diff --git a/weed/util/skiplist/name_list_test.go b/weed/util/skiplist/name_list_test.go
deleted file mode 100644
index 9d539c9ba2..0000000000
--- a/weed/util/skiplist/name_list_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package skiplist
-
-import (
- "math/rand"
- "strconv"
- "testing"
-)
-
-const (
- maxNameCount = 100
-)
-
-func String(x int) string {
- return strconv.Itoa(x)
-}
-
-func TestNameList(t *testing.T) {
- list := newNameList(memStore, 7)
-
- for i := 0; i < maxNameCount; i++ {
- list.WriteName(String(i))
- }
-
- counter := 0
- list.ListNames("", func(name string) bool {
- counter++
- print(name, " ")
- return true
- })
- if counter != maxNameCount {
- t.Fail()
- }
-
- // list.skipList.println()
-
- deleteBase := 5
- deleteCount := maxNameCount - 3*deleteBase
-
- for i := deleteBase; i < deleteBase+deleteCount; i++ {
- list.DeleteName(String(i))
- }
-
- counter = 0
- list.ListNames("", func(name string) bool {
- counter++
- return true
- })
- // list.skipList.println()
- if counter != maxNameCount-deleteCount {
- t.Fail()
- }
-
- // randomized deletion
- list = newNameList(memStore, 7)
- // Delete elements at random positions in the list.
- rList := rand.Perm(maxN)
- for _, i := range rList {
- list.WriteName(String(i))
- }
- for _, i := range rList {
- list.DeleteName(String(i))
- }
- counter = 0
- list.ListNames("", func(name string) bool {
- counter++
- print(name, " ")
- return true
- })
- if counter != 0 {
- t.Fail()
- }
-
-}
diff --git a/weed/util/skiplist/skiplist.pb.go b/weed/util/skiplist/skiplist.pb.go
index 09a9dab9a0..4a6c84017e 100644
--- a/weed/util/skiplist/skiplist.pb.go
+++ b/weed/util/skiplist/skiplist.pb.go
@@ -1,17 +1,17 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.26.0
-// protoc v3.17.3
+// protoc-gen-go v1.36.6
+// protoc v6.33.4
// source: skiplist.proto
package skiplist
import (
- reflect "reflect"
- sync "sync"
-
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+ unsafe "unsafe"
)
const (
@@ -22,23 +22,20 @@ const (
)
type SkipListProto struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
+ state protoimpl.MessageState `protogen:"open.v1"`
+ StartLevels []*SkipListElementReference `protobuf:"bytes,1,rep,name=start_levels,json=startLevels,proto3" json:"start_levels,omitempty"`
+ EndLevels []*SkipListElementReference `protobuf:"bytes,2,rep,name=end_levels,json=endLevels,proto3" json:"end_levels,omitempty"`
+ MaxNewLevel int32 `protobuf:"varint,3,opt,name=max_new_level,json=maxNewLevel,proto3" json:"max_new_level,omitempty"`
+ MaxLevel int32 `protobuf:"varint,4,opt,name=max_level,json=maxLevel,proto3" json:"max_level,omitempty"`
unknownFields protoimpl.UnknownFields
-
- StartLevels []*SkipListElementReference `protobuf:"bytes,1,rep,name=start_levels,json=startLevels,proto3" json:"start_levels,omitempty"`
- EndLevels []*SkipListElementReference `protobuf:"bytes,2,rep,name=end_levels,json=endLevels,proto3" json:"end_levels,omitempty"`
- MaxNewLevel int32 `protobuf:"varint,3,opt,name=max_new_level,json=maxNewLevel,proto3" json:"max_new_level,omitempty"`
- MaxLevel int32 `protobuf:"varint,4,opt,name=max_level,json=maxLevel,proto3" json:"max_level,omitempty"`
+ sizeCache protoimpl.SizeCache
}
func (x *SkipListProto) Reset() {
*x = SkipListProto{}
- if protoimpl.UnsafeEnabled {
- mi := &file_skiplist_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
+ mi := &file_skiplist_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
}
func (x *SkipListProto) String() string {
@@ -49,7 +46,7 @@ func (*SkipListProto) ProtoMessage() {}
func (x *SkipListProto) ProtoReflect() protoreflect.Message {
mi := &file_skiplist_proto_msgTypes[0]
- if protoimpl.UnsafeEnabled && x != nil {
+ if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -93,21 +90,18 @@ func (x *SkipListProto) GetMaxLevel() int32 {
}
type SkipListElementReference struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- ElementPointer int64 `protobuf:"varint,1,opt,name=element_pointer,json=elementPointer,proto3" json:"element_pointer,omitempty"`
- Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
+ state protoimpl.MessageState `protogen:"open.v1"`
+ ElementPointer int64 `protobuf:"varint,1,opt,name=element_pointer,json=elementPointer,proto3" json:"element_pointer,omitempty"`
+ Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
func (x *SkipListElementReference) Reset() {
*x = SkipListElementReference{}
- if protoimpl.UnsafeEnabled {
- mi := &file_skiplist_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
+ mi := &file_skiplist_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
}
func (x *SkipListElementReference) String() string {
@@ -118,7 +112,7 @@ func (*SkipListElementReference) ProtoMessage() {}
func (x *SkipListElementReference) ProtoReflect() protoreflect.Message {
mi := &file_skiplist_proto_msgTypes[1]
- if protoimpl.UnsafeEnabled && x != nil {
+ if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -148,25 +142,22 @@ func (x *SkipListElementReference) GetKey() []byte {
}
type SkipListElement struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+ Next []*SkipListElementReference `protobuf:"bytes,2,rep,name=next,proto3" json:"next,omitempty"`
+ Level int32 `protobuf:"varint,3,opt,name=level,proto3" json:"level,omitempty"`
+ Key []byte `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"`
+ Value []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"`
+ Prev *SkipListElementReference `protobuf:"bytes,6,opt,name=prev,proto3" json:"prev,omitempty"`
unknownFields protoimpl.UnknownFields
-
- Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
- Next []*SkipListElementReference `protobuf:"bytes,2,rep,name=next,proto3" json:"next,omitempty"`
- Level int32 `protobuf:"varint,3,opt,name=level,proto3" json:"level,omitempty"`
- Key []byte `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"`
- Value []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"`
- Prev *SkipListElementReference `protobuf:"bytes,6,opt,name=prev,proto3" json:"prev,omitempty"`
+ sizeCache protoimpl.SizeCache
}
func (x *SkipListElement) Reset() {
*x = SkipListElement{}
- if protoimpl.UnsafeEnabled {
- mi := &file_skiplist_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
+ mi := &file_skiplist_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
}
func (x *SkipListElement) String() string {
@@ -177,7 +168,7 @@ func (*SkipListElement) ProtoMessage() {}
func (x *SkipListElement) ProtoReflect() protoreflect.Message {
mi := &file_skiplist_proto_msgTypes[2]
- if protoimpl.UnsafeEnabled && x != nil {
+ if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -234,117 +225,45 @@ func (x *SkipListElement) GetPrev() *SkipListElementReference {
return nil
}
-type NameBatchData struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Names [][]byte `protobuf:"bytes,1,rep,name=names,proto3" json:"names,omitempty"`
-}
-
-func (x *NameBatchData) Reset() {
- *x = NameBatchData{}
- if protoimpl.UnsafeEnabled {
- mi := &file_skiplist_proto_msgTypes[3]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *NameBatchData) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*NameBatchData) ProtoMessage() {}
-
-func (x *NameBatchData) ProtoReflect() protoreflect.Message {
- mi := &file_skiplist_proto_msgTypes[3]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use NameBatchData.ProtoReflect.Descriptor instead.
-func (*NameBatchData) Descriptor() ([]byte, []int) {
- return file_skiplist_proto_rawDescGZIP(), []int{3}
-}
-
-func (x *NameBatchData) GetNames() [][]byte {
- if x != nil {
- return x.Names
- }
- return nil
-}
-
var File_skiplist_proto protoreflect.FileDescriptor
-var file_skiplist_proto_rawDesc = []byte{
- 0x0a, 0x0e, 0x73, 0x6b, 0x69, 0x70, 0x6c, 0x69, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
- 0x12, 0x08, 0x73, 0x6b, 0x69, 0x70, 0x6c, 0x69, 0x73, 0x74, 0x22, 0xda, 0x01, 0x0a, 0x0d, 0x53,
- 0x6b, 0x69, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x45, 0x0a, 0x0c,
- 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03,
- 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x73, 0x6b, 0x69, 0x70, 0x6c, 0x69, 0x73, 0x74, 0x2e, 0x53, 0x6b,
- 0x69, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x66,
- 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4c, 0x65, 0x76,
- 0x65, 0x6c, 0x73, 0x12, 0x41, 0x0a, 0x0a, 0x65, 0x6e, 0x64, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c,
- 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x73, 0x6b, 0x69, 0x70, 0x6c, 0x69,
- 0x73, 0x74, 0x2e, 0x53, 0x6b, 0x69, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6c, 0x65, 0x6d, 0x65,
- 0x6e, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x09, 0x65, 0x6e, 0x64,
- 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x73, 0x12, 0x22, 0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x5f, 0x6e, 0x65,
- 0x77, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6d,
- 0x61, 0x78, 0x4e, 0x65, 0x77, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61,
- 0x78, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d,
- 0x61, 0x78, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0x55, 0x0a, 0x18, 0x53, 0x6b, 0x69, 0x70, 0x4c,
- 0x69, 0x73, 0x74, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65,
- 0x6e, 0x63, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x70,
- 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x65, 0x6c,
- 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03,
- 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0xcf,
- 0x01, 0x0a, 0x0f, 0x53, 0x6b, 0x69, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6c, 0x65, 0x6d, 0x65,
- 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02,
- 0x69, 0x64, 0x12, 0x36, 0x0a, 0x04, 0x6e, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,
- 0x32, 0x22, 0x2e, 0x73, 0x6b, 0x69, 0x70, 0x6c, 0x69, 0x73, 0x74, 0x2e, 0x53, 0x6b, 0x69, 0x70,
- 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72,
- 0x65, 0x6e, 0x63, 0x65, 0x52, 0x04, 0x6e, 0x65, 0x78, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65,
- 0x76, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c,
- 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b,
- 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
- 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x70, 0x72, 0x65, 0x76,
- 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x73, 0x6b, 0x69, 0x70, 0x6c, 0x69, 0x73,
- 0x74, 0x2e, 0x53, 0x6b, 0x69, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e,
- 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x04, 0x70, 0x72, 0x65, 0x76,
- 0x22, 0x25, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x44, 0x61, 0x74,
- 0x61, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c,
- 0x52, 0x05, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75,
- 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x65, 0x61, 0x77, 0x65, 0x65, 0x64, 0x66, 0x73, 0x2f,
- 0x73, 0x65, 0x61, 0x77, 0x65, 0x65, 0x64, 0x66, 0x73, 0x2f, 0x77, 0x65, 0x65, 0x64, 0x2f, 0x75,
- 0x74, 0x69, 0x6c, 0x2f, 0x73, 0x6b, 0x69, 0x70, 0x6c, 0x69, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72,
- 0x6f, 0x74, 0x6f, 0x33,
-}
+const file_skiplist_proto_rawDesc = "" +
+ "\n" +
+ "\x0eskiplist.proto\x12\bskiplist\"\xda\x01\n" +
+ "\rSkipListProto\x12E\n" +
+ "\fstart_levels\x18\x01 \x03(\v2\".skiplist.SkipListElementReferenceR\vstartLevels\x12A\n" +
+ "\n" +
+ "end_levels\x18\x02 \x03(\v2\".skiplist.SkipListElementReferenceR\tendLevels\x12\"\n" +
+ "\rmax_new_level\x18\x03 \x01(\x05R\vmaxNewLevel\x12\x1b\n" +
+ "\tmax_level\x18\x04 \x01(\x05R\bmaxLevel\"U\n" +
+ "\x18SkipListElementReference\x12'\n" +
+ "\x0felement_pointer\x18\x01 \x01(\x03R\x0eelementPointer\x12\x10\n" +
+ "\x03key\x18\x02 \x01(\fR\x03key\"\xcf\x01\n" +
+ "\x0fSkipListElement\x12\x0e\n" +
+ "\x02id\x18\x01 \x01(\x03R\x02id\x126\n" +
+ "\x04next\x18\x02 \x03(\v2\".skiplist.SkipListElementReferenceR\x04next\x12\x14\n" +
+ "\x05level\x18\x03 \x01(\x05R\x05level\x12\x10\n" +
+ "\x03key\x18\x04 \x01(\fR\x03key\x12\x14\n" +
+ "\x05value\x18\x05 \x01(\fR\x05value\x126\n" +
+ "\x04prev\x18\x06 \x01(\v2\".skiplist.SkipListElementReferenceR\x04prevB3Z1github.com/seaweedfs/seaweedfs/weed/util/skiplistb\x06proto3"
var (
file_skiplist_proto_rawDescOnce sync.Once
- file_skiplist_proto_rawDescData = file_skiplist_proto_rawDesc
+ file_skiplist_proto_rawDescData []byte
)
func file_skiplist_proto_rawDescGZIP() []byte {
file_skiplist_proto_rawDescOnce.Do(func() {
- file_skiplist_proto_rawDescData = protoimpl.X.CompressGZIP(file_skiplist_proto_rawDescData)
+ file_skiplist_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_skiplist_proto_rawDesc), len(file_skiplist_proto_rawDesc)))
})
return file_skiplist_proto_rawDescData
}
-var file_skiplist_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
-var file_skiplist_proto_goTypes = []interface{}{
+var file_skiplist_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
+var file_skiplist_proto_goTypes = []any{
(*SkipListProto)(nil), // 0: skiplist.SkipListProto
(*SkipListElementReference)(nil), // 1: skiplist.SkipListElementReference
(*SkipListElement)(nil), // 2: skiplist.SkipListElement
- (*NameBatchData)(nil), // 3: skiplist.NameBatchData
}
var file_skiplist_proto_depIdxs = []int32{
1, // 0: skiplist.SkipListProto.start_levels:type_name -> skiplist.SkipListElementReference
@@ -363,63 +282,13 @@ func file_skiplist_proto_init() {
if File_skiplist_proto != nil {
return
}
- if !protoimpl.UnsafeEnabled {
- file_skiplist_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*SkipListProto); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_skiplist_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*SkipListElementReference); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_skiplist_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*SkipListElement); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_skiplist_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*NameBatchData); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- }
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: file_skiplist_proto_rawDesc,
+ RawDescriptor: unsafe.Slice(unsafe.StringData(file_skiplist_proto_rawDesc), len(file_skiplist_proto_rawDesc)),
NumEnums: 0,
- NumMessages: 4,
+ NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
},
@@ -428,7 +297,6 @@ func file_skiplist_proto_init() {
MessageInfos: file_skiplist_proto_msgTypes,
}.Build()
File_skiplist_proto = out.File
- file_skiplist_proto_rawDesc = nil
file_skiplist_proto_goTypes = nil
file_skiplist_proto_depIdxs = nil
}
diff --git a/weed/util/skiplist/skiplist.proto b/weed/util/skiplist/skiplist.proto
index 4ea033c1be..49897667f4 100644
--- a/weed/util/skiplist/skiplist.proto
+++ b/weed/util/skiplist/skiplist.proto
@@ -24,7 +24,3 @@ message SkipListElement {
bytes value = 5;
SkipListElementReference prev = 6;
}
-
-message NameBatchData {
- repeated bytes names = 1;
-}