|
|
@ -3,6 +3,7 @@ package weed_server |
|
|
|
import ( |
|
|
|
"context" |
|
|
|
"fmt" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/glog" |
|
|
|
"time" |
|
|
|
|
|
|
|
"github.com/seaweedfs/raft" |
|
|
@ -15,6 +16,24 @@ import ( |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/topology" |
|
|
|
) |
|
|
|
|
|
|
|
func (ms *MasterServer) StreamAssign(server master_pb.Seaweed_StreamAssignServer) error { |
|
|
|
for { |
|
|
|
req, err := server.Recv() |
|
|
|
if err != nil { |
|
|
|
glog.Errorf("StreamAssign failed to receive: %v", err) |
|
|
|
return err |
|
|
|
} |
|
|
|
resp, err := ms.Assign(context.Background(), req) |
|
|
|
if err != nil { |
|
|
|
glog.Errorf("StreamAssign failed to assign: %v", err) |
|
|
|
return err |
|
|
|
} |
|
|
|
if err = server.Send(resp); err != nil { |
|
|
|
glog.Errorf("StreamAssign failed to send: %v", err) |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
func (ms *MasterServer) Assign(ctx context.Context, req *master_pb.AssignRequest) (*master_pb.AssignResponse, error) { |
|
|
|
|
|
|
|
if !ms.Topo.IsLeader() { |
|
|
|