Browse Source

mv pb to master_pb

pull/655/head
Chris Lu 7 years ago
parent
commit
942c2cbd7b
  1. 4
      weed/command/master.go
  2. 4
      weed/command/server.go
  3. 2
      weed/pb/Makefile
  4. 78
      weed/pb/master_pb/seaweed.pb.go
  5. 2
      weed/pb/seaweed.proto
  6. 8
      weed/server/master_grpc_server.go
  7. 4
      weed/server/volume_grpc_client.go
  8. 12
      weed/storage/store.go
  9. 4
      weed/storage/volume_info.go

4
weed/command/master.go

@ -9,7 +9,7 @@ import (
"time"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"github.com/chrislusf/seaweedfs/weed/server"
"github.com/chrislusf/seaweedfs/weed/util"
"github.com/gorilla/mux"
@ -104,7 +104,7 @@ func runMaster(cmd *Command, args []string) bool {
// Create your protocol servers.
grpcS := grpc.NewServer()
pb.RegisterSeaweedServer(grpcS, ms)
master_pb.RegisterSeaweedServer(grpcS, ms)
reflection.Register(grpcS)
httpS := &http.Server{Handler: r}

4
weed/command/server.go

@ -11,7 +11,7 @@ import (
"time"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"github.com/chrislusf/seaweedfs/weed/server"
"github.com/chrislusf/seaweedfs/weed/storage"
"github.com/chrislusf/seaweedfs/weed/util"
@ -226,7 +226,7 @@ func runServer(cmd *Command, args []string) bool {
// Create your protocol servers.
grpcS := grpc.NewServer()
pb.RegisterSeaweedServer(grpcS, ms)
master_pb.RegisterSeaweedServer(grpcS, ms)
reflection.Register(grpcS)
httpS := &http.Server{Handler: r}

2
weed/pb/Makefile

@ -3,5 +3,5 @@ all: gen
.PHONY : gen
gen:
protoc seaweed.proto --go_out=plugins=grpc:.
protoc seaweed.proto --go_out=plugins=grpc:./master_pb
protoc filer.proto --go_out=plugins=grpc:../filer

78
weed/pb/seaweed.pb.go → weed/pb/master_pb/seaweed.pb.go

@ -3,7 +3,7 @@
// DO NOT EDIT!
/*
Package pb is a generated protocol buffer package.
Package master_pb is a generated protocol buffer package.
It is generated from these files:
seaweed.proto
@ -13,7 +13,7 @@ It has these top-level messages:
HeartbeatResponse
VolumeInformationMessage
*/
package pb
package master_pb
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
@ -236,9 +236,9 @@ func (m *VolumeInformationMessage) GetTtl() uint32 {
}
func init() {
proto.RegisterType((*Heartbeat)(nil), "pb.Heartbeat")
proto.RegisterType((*HeartbeatResponse)(nil), "pb.HeartbeatResponse")
proto.RegisterType((*VolumeInformationMessage)(nil), "pb.VolumeInformationMessage")
proto.RegisterType((*Heartbeat)(nil), "master_pb.Heartbeat")
proto.RegisterType((*HeartbeatResponse)(nil), "master_pb.HeartbeatResponse")
proto.RegisterType((*VolumeInformationMessage)(nil), "master_pb.VolumeInformationMessage")
}
// Reference imports to suppress errors if they are not otherwise used.
@ -264,7 +264,7 @@ func NewSeaweedClient(cc *grpc.ClientConn) SeaweedClient {
}
func (c *seaweedClient) SendHeartbeat(ctx context.Context, opts ...grpc.CallOption) (Seaweed_SendHeartbeatClient, error) {
stream, err := grpc.NewClientStream(ctx, &_Seaweed_serviceDesc.Streams[0], c.cc, "/pb.Seaweed/SendHeartbeat", opts...)
stream, err := grpc.NewClientStream(ctx, &_Seaweed_serviceDesc.Streams[0], c.cc, "/master_pb.Seaweed/SendHeartbeat", opts...)
if err != nil {
return nil, err
}
@ -331,7 +331,7 @@ func (x *seaweedSendHeartbeatServer) Recv() (*Heartbeat, error) {
}
var _Seaweed_serviceDesc = grpc.ServiceDesc{
ServiceName: "pb.Seaweed",
ServiceName: "master_pb.Seaweed",
HandlerType: (*SeaweedServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{
@ -348,37 +348,37 @@ var _Seaweed_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("seaweed.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 498 bytes of a gzipped FileDescriptorProto
// 504 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x93, 0xdf, 0x6e, 0xd3, 0x30,
0x14, 0xc6, 0x49, 0x1a, 0xda, 0xe6, 0x74, 0x1d, 0x9d, 0x25, 0x90, 0x05, 0x03, 0x4a, 0xaf, 0x22,
0x81, 0x2a, 0x34, 0x24, 0x6e, 0xb8, 0x63, 0xd2, 0x04, 0x1a, 0x88, 0xc9, 0x15, 0xdc, 0x46, 0x4e,
0x72, 0x86, 0xac, 0x39, 0x7f, 0xe4, 0xb8, 0xa3, 0xd9, 0x03, 0xf1, 0x24, 0x3c, 0x18, 0xf2, 0x71,
0xd2, 0x02, 0x12, 0x77, 0xe7, 0xfc, 0xce, 0x17, 0xfb, 0xf4, 0xfb, 0x5c, 0x98, 0xb7, 0x28, 0x7f,
0x20, 0x16, 0xeb, 0xc6, 0xd4, 0xb6, 0x66, 0x61, 0x93, 0xad, 0x7e, 0x86, 0x10, 0x7f, 0x40, 0x69,
0x6c, 0x86, 0xd2, 0xb2, 0x63, 0x08, 0x55, 0xc3, 0x83, 0x65, 0x90, 0xc4, 0x22, 0x54, 0x0d, 0x63,
0x10, 0x35, 0xb5, 0xb1, 0x3c, 0x5c, 0x06, 0xc9, 0x5c, 0x50, 0xcd, 0x9e, 0x02, 0x34, 0xdb, 0x4c,
0xab, 0x3c, 0xdd, 0x1a, 0xcd, 0x47, 0xa4, 0x8d, 0x3d, 0xf9, 0x6a, 0x34, 0x4b, 0x60, 0x51, 0xca,
0x5d, 0x7a, 0x5b, 0xeb, 0x6d, 0x89, 0x69, 0x5e, 0x6f, 0x2b, 0xcb, 0x23, 0xfa, 0xfc, 0xb8, 0x94,
0xbb, 0x6f, 0x84, 0xcf, 0x1d, 0x65, 0x4b, 0x38, 0x72, 0xca, 0x6b, 0xa5, 0x31, 0xbd, 0xc1, 0x8e,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ad, 0x0b, 0xbf, 0xc5, 0x48, 0xd2, 0x2f, 0xf9, 0x14, 0x0e, 0xbc,
0x37, 0x02, 0x88, 0x86, 0xf2, 0xf4, 0x2b, 0x0c, 0x97, 0xdd, 0x3b, 0xe0, 0xe7, 0x30, 0x59, 0x62,
0x55, 0xec, 0x6f, 0xfe, 0xc3, 0x3b, 0xb7, 0x60, 0x47, 0x1f, 0x9f, 0xfc, 0x8b, 0xf6, 0xb1, 0xcf,
0xef, 0xa5, 0xd1, 0x9b, 0x68, 0x35, 0xa0, 0x37, 0xf5, 0xf6, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff,
0x01, 0x14, 0xbb, 0x3a, 0x64, 0x03, 0x00, 0x00,
}

2
weed/pb/seaweed.proto

@ -1,6 +1,6 @@
syntax = "proto3";
package pb;
package master_pb;
//////////////////////////////////////////////////

8
weed/server/master_grpc_server.go

@ -5,13 +5,13 @@ import (
"strings"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"github.com/chrislusf/seaweedfs/weed/storage"
"github.com/chrislusf/seaweedfs/weed/topology"
"google.golang.org/grpc/peer"
)
func (ms MasterServer) SendHeartbeat(stream pb.Seaweed_SendHeartbeatServer) error {
func (ms MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServer) error {
var dn *topology.DataNode
t := ms.Topo
for {
@ -34,7 +34,7 @@ func (ms MasterServer) SendHeartbeat(stream pb.Seaweed_SendHeartbeatServer) erro
int(heartbeat.Port), heartbeat.PublicUrl,
int(heartbeat.MaxVolumeCount))
glog.V(0).Infof("added volume server %v:%d", heartbeat.GetIp(), heartbeat.GetPort())
if err := stream.Send(&pb.HeartbeatResponse{
if err := stream.Send(&master_pb.HeartbeatResponse{
VolumeSizeLimit: uint64(ms.volumeSizeLimitMB) * 1024 * 1024,
SecretKey: string(ms.guard.SecretKey),
}); err != nil {
@ -69,7 +69,7 @@ func (ms MasterServer) SendHeartbeat(stream pb.Seaweed_SendHeartbeatServer) erro
// tell the volume servers about the leader
newLeader, err := t.Leader()
if err == nil {
if err := stream.Send(&pb.HeartbeatResponse{
if err := stream.Send(&master_pb.HeartbeatResponse{
Leader: newLeader,
}); err != nil {
return err

4
weed/server/volume_grpc_client.go

@ -5,7 +5,7 @@ import (
"time"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"github.com/chrislusf/seaweedfs/weed/security"
"github.com/chrislusf/seaweedfs/weed/storage"
"golang.org/x/net/context"
@ -42,7 +42,7 @@ func (vs *VolumeServer) doHeartbeat(sleepInterval time.Duration) error {
}
defer grpcConection.Close()
client := pb.NewSeaweedClient(grpcConection)
client := master_pb.NewSeaweedClient(grpcConection)
stream, err := client.SendHeartbeat(context.Background())
if err != nil {
glog.V(0).Infof("%v.SendHeartbeat(_) = _, %v", client, err)

12
weed/storage/store.go

@ -8,7 +8,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/operation"
"github.com/chrislusf/seaweedfs/weed/pb"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
)
const (
@ -76,7 +76,7 @@ type Store struct {
rack string //optional information, overwriting master setting if exists
connected bool
VolumeSizeLimit uint64 //read from the master
Client pb.Seaweed_SendHeartbeatClient
Client master_pb.Seaweed_SendHeartbeatClient
NeedleMapType NeedleMapType
}
@ -208,8 +208,8 @@ func (s *Store) SetRack(rack string) {
s.rack = rack
}
func (s *Store) CollectHeartbeat() *pb.Heartbeat {
var volumeMessages []*pb.VolumeInformationMessage
func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
var volumeMessages []*master_pb.VolumeInformationMessage
maxVolumeCount := 0
var maxFileKey uint64
for _, location := range s.Locations {
@ -220,7 +220,7 @@ func (s *Store) CollectHeartbeat() *pb.Heartbeat {
maxFileKey = v.nm.MaxFileKey()
}
if !v.expired(s.VolumeSizeLimit) {
volumeMessage := &pb.VolumeInformationMessage{
volumeMessage := &master_pb.VolumeInformationMessage{
Id: uint32(k),
Size: uint64(v.Size()),
Collection: v.Collection,
@ -245,7 +245,7 @@ func (s *Store) CollectHeartbeat() *pb.Heartbeat {
location.Unlock()
}
return &pb.Heartbeat{
return &master_pb.Heartbeat{
Ip: s.Ip,
Port: uint32(s.Port),
PublicUrl: s.PublicUrl,

4
weed/storage/volume_info.go

@ -4,7 +4,7 @@ import (
"fmt"
"sort"
"github.com/chrislusf/seaweedfs/weed/pb"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
)
type VolumeInfo struct {
@ -20,7 +20,7 @@ type VolumeInfo struct {
ReadOnly bool
}
func NewVolumeInfo(m *pb.VolumeInformationMessage) (vi VolumeInfo, err error) {
func NewVolumeInfo(m *master_pb.VolumeInformationMessage) (vi VolumeInfo, err error) {
vi = VolumeInfo{
Id: VolumeId(m.Id),
Size: m.Size,

Loading…
Cancel
Save