You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
807 B

6 years ago
  1. package weed_server
  2. import (
  3. "context"
  4. "github.com/chrislusf/seaweedfs/weed/pb/master_pb"
  5. )
  6. func (ms *MasterServer) LookupVolume(ctx context.Context, req *master_pb.LookupVolumeRequest) (*master_pb.LookupVolumeResponse, error) {
  7. resp := &master_pb.LookupVolumeResponse{}
  8. volumeLocations := ms.lookupVolumeId(req.VolumeIds, req.Collection)
  9. for _, result := range volumeLocations {
  10. var locations []*master_pb.Location
  11. for _, loc := range result.Locations {
  12. locations = append(locations, &master_pb.Location{
  13. Url: loc.Url,
  14. PublicUrl: loc.PublicUrl,
  15. })
  16. }
  17. resp.VolumeIdLocations = append(resp.VolumeIdLocations, &master_pb.LookupVolumeResponse_VolumeIdLocation{
  18. VolumeId: result.VolumeId,
  19. Locations: locations,
  20. Error: result.Error,
  21. })
  22. }
  23. return resp, nil
  24. }