use grpc to replace http APIs for batch volume id lookup and batch delete
1. remove batch volume id lookup http API /vol/lookup 2. remove batch delete http API /delete
This commit is contained in:
28
weed/server/master_grpc_server_lookup.go
Normal file
28
weed/server/master_grpc_server_lookup.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package weed_server
|
||||
|
||||
import (
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
|
||||
"context"
|
||||
)
|
||||
|
||||
func (ms *MasterServer) LookupVolume(ctx context.Context, req *master_pb.LookupVolumeRequest) (*master_pb.LookupVolumeResponse, error) {
|
||||
resp := &master_pb.LookupVolumeResponse{}
|
||||
volumeLocations := ms.lookupVolumeId(req.VolumeIds, req.Collection)
|
||||
|
||||
for _, result := range volumeLocations {
|
||||
var locations []*master_pb.Location
|
||||
for _, loc := range result.Locations {
|
||||
locations = append(locations, &master_pb.Location{
|
||||
Url: loc.Url,
|
||||
PublicUrl: loc.PublicUrl,
|
||||
})
|
||||
}
|
||||
resp.VolumeIdLocations = append(resp.VolumeIdLocations, &master_pb.LookupVolumeResponse_VolumeIdLocation{
|
||||
VolumeId: result.VolumeId,
|
||||
Locations: locations,
|
||||
Error: result.Error,
|
||||
})
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
Reference in New Issue
Block a user