|
|
@ -4,12 +4,18 @@ import ( |
|
|
|
"context" |
|
|
|
"fmt" |
|
|
|
|
|
|
|
"github.com/chrislusf/raft" |
|
|
|
"github.com/chrislusf/seaweedfs/weed/pb/master_pb" |
|
|
|
"github.com/chrislusf/seaweedfs/weed/storage" |
|
|
|
"github.com/chrislusf/seaweedfs/weed/topology" |
|
|
|
) |
|
|
|
|
|
|
|
func (ms *MasterServer) LookupVolume(ctx context.Context, req *master_pb.LookupVolumeRequest) (*master_pb.LookupVolumeResponse, error) { |
|
|
|
|
|
|
|
if !ms.Topo.IsLeader() { |
|
|
|
return nil, raft.NotLeaderError |
|
|
|
} |
|
|
|
|
|
|
|
resp := &master_pb.LookupVolumeResponse{} |
|
|
|
volumeLocations := ms.lookupVolumeId(req.VolumeIds, req.Collection) |
|
|
|
|
|
|
@ -33,6 +39,10 @@ func (ms *MasterServer) LookupVolume(ctx context.Context, req *master_pb.LookupV |
|
|
|
|
|
|
|
func (ms *MasterServer) Assign(ctx context.Context, req *master_pb.AssignRequest) (*master_pb.AssignResponse, error) { |
|
|
|
|
|
|
|
if !ms.Topo.IsLeader() { |
|
|
|
return nil, raft.NotLeaderError |
|
|
|
} |
|
|
|
|
|
|
|
if req.Count == 0 { |
|
|
|
req.Count = 1 |
|
|
|
} |
|
|
@ -87,6 +97,10 @@ func (ms *MasterServer) Assign(ctx context.Context, req *master_pb.AssignRequest |
|
|
|
|
|
|
|
func (ms *MasterServer) Statistics(ctx context.Context, req *master_pb.StatisticsRequest) (*master_pb.StatisticsResponse, error) { |
|
|
|
|
|
|
|
if !ms.Topo.IsLeader() { |
|
|
|
return nil, raft.NotLeaderError |
|
|
|
} |
|
|
|
|
|
|
|
if req.Replication == "" { |
|
|
|
req.Replication = ms.defaultReplicaPlacement |
|
|
|
} |
|
|
|