From 5f6cc9a8145f79c0f679c8b3fda34c3c76a6d411 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 21 Aug 2021 13:36:52 -0700 Subject: [PATCH] make proto node --- weed/util/bptree/Makefile | 6 ++ weed/util/bptree/bptree.pb.go | 186 ++++++++++++++++++++++++++++++++++ weed/util/bptree/bptree.proto | 14 +++ 3 files changed, 206 insertions(+) create mode 100644 weed/util/bptree/Makefile create mode 100644 weed/util/bptree/bptree.pb.go create mode 100644 weed/util/bptree/bptree.proto diff --git a/weed/util/bptree/Makefile b/weed/util/bptree/Makefile new file mode 100644 index 000000000..a98f39a08 --- /dev/null +++ b/weed/util/bptree/Makefile @@ -0,0 +1,6 @@ +all: gen + +.PHONY : gen + +gen: + protoc bptree.proto --go_out=plugins=grpc:. --go_opt=paths=source_relative diff --git a/weed/util/bptree/bptree.pb.go b/weed/util/bptree/bptree.pb.go new file mode 100644 index 000000000..e7d155a36 --- /dev/null +++ b/weed/util/bptree/bptree.pb.go @@ -0,0 +1,186 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: bptree.proto + +package bptree + +import ( + proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type ProtoNode struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Keys [][]byte `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"` + Values [][]byte `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` + Pointers []int64 `protobuf:"varint,3,rep,packed,name=pointers,proto3" json:"pointers,omitempty"` + Next int64 `protobuf:"varint,4,opt,name=next,proto3" json:"next,omitempty"` + Prev int64 `protobuf:"varint,5,opt,name=prev,proto3" json:"prev,omitempty"` +} + +func (x *ProtoNode) Reset() { + *x = ProtoNode{} + if protoimpl.UnsafeEnabled { + mi := &file_bptree_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProtoNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProtoNode) ProtoMessage() {} + +func (x *ProtoNode) ProtoReflect() protoreflect.Message { + mi := &file_bptree_proto_msgTypes[0] + 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 ProtoNode.ProtoReflect.Descriptor instead. +func (*ProtoNode) Descriptor() ([]byte, []int) { + return file_bptree_proto_rawDescGZIP(), []int{0} +} + +func (x *ProtoNode) GetKeys() [][]byte { + if x != nil { + return x.Keys + } + return nil +} + +func (x *ProtoNode) GetValues() [][]byte { + if x != nil { + return x.Values + } + return nil +} + +func (x *ProtoNode) GetPointers() []int64 { + if x != nil { + return x.Pointers + } + return nil +} + +func (x *ProtoNode) GetNext() int64 { + if x != nil { + return x.Next + } + return 0 +} + +func (x *ProtoNode) GetPrev() int64 { + if x != nil { + return x.Prev + } + return 0 +} + +var File_bptree_proto protoreflect.FileDescriptor + +var file_bptree_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x62, 0x70, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, + 0x62, 0x70, 0x74, 0x72, 0x65, 0x65, 0x22, 0x7b, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x4e, + 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0c, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, + 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x03, 0x52, 0x08, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x65, 0x78, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x6e, 0x65, 0x78, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x70, 0x72, 0x65, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x70, + 0x72, 0x65, 0x76, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x63, 0x68, 0x72, 0x69, 0x73, 0x6c, 0x75, 0x73, 0x66, 0x2f, 0x73, 0x65, 0x61, 0x77, + 0x65, 0x65, 0x64, 0x66, 0x73, 0x2f, 0x77, 0x65, 0x65, 0x64, 0x2f, 0x75, 0x74, 0x69, 0x6c, 0x2f, + 0x62, 0x70, 0x74, 0x72, 0x65, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_bptree_proto_rawDescOnce sync.Once + file_bptree_proto_rawDescData = file_bptree_proto_rawDesc +) + +func file_bptree_proto_rawDescGZIP() []byte { + file_bptree_proto_rawDescOnce.Do(func() { + file_bptree_proto_rawDescData = protoimpl.X.CompressGZIP(file_bptree_proto_rawDescData) + }) + return file_bptree_proto_rawDescData +} + +var file_bptree_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_bptree_proto_goTypes = []interface{}{ + (*ProtoNode)(nil), // 0: bptree.ProtoNode +} +var file_bptree_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_bptree_proto_init() } +func file_bptree_proto_init() { + if File_bptree_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_bptree_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProtoNode); 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_bptree_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_bptree_proto_goTypes, + DependencyIndexes: file_bptree_proto_depIdxs, + MessageInfos: file_bptree_proto_msgTypes, + }.Build() + File_bptree_proto = out.File + file_bptree_proto_rawDesc = nil + file_bptree_proto_goTypes = nil + file_bptree_proto_depIdxs = nil +} diff --git a/weed/util/bptree/bptree.proto b/weed/util/bptree/bptree.proto new file mode 100644 index 000000000..1d55096a2 --- /dev/null +++ b/weed/util/bptree/bptree.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package bptree; + +option go_package = "github.com/chrislusf/seaweedfs/weed/util/bptree"; + +message ProtoNode { + repeated bytes keys = 1; + repeated bytes values = 2; + repeated int64 pointers = 3; + int64 next = 4; + int64 prev = 5; + int64 id = 6; +}