|
@ -82,7 +82,13 @@ func (ms *MasterServer) LookupVolume(ctx context.Context, req *master_pb.LookupV |
|
|
resp := &master_pb.LookupVolumeResponse{} |
|
|
resp := &master_pb.LookupVolumeResponse{} |
|
|
volumeLocations := ms.lookupVolumeId(req.VolumeOrFileIds, req.Collection) |
|
|
volumeLocations := ms.lookupVolumeId(req.VolumeOrFileIds, req.Collection) |
|
|
|
|
|
|
|
|
for _, result := range volumeLocations { |
|
|
|
|
|
|
|
|
for _, volumeOrFileId := range req.VolumeOrFileIds { |
|
|
|
|
|
vid := volumeOrFileId |
|
|
|
|
|
commaSep := strings.Index(vid, ",") |
|
|
|
|
|
if commaSep > 0 { |
|
|
|
|
|
vid = vid[0:commaSep] |
|
|
|
|
|
} |
|
|
|
|
|
if result, found := volumeLocations[vid]; found { |
|
|
var locations []*master_pb.Location |
|
|
var locations []*master_pb.Location |
|
|
for _, loc := range result.Locations { |
|
|
for _, loc := range result.Locations { |
|
|
locations = append(locations, &master_pb.Location{ |
|
|
locations = append(locations, &master_pb.Location{ |
|
@ -92,7 +98,7 @@ func (ms *MasterServer) LookupVolume(ctx context.Context, req *master_pb.LookupV |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
var auth string |
|
|
var auth string |
|
|
if strings.Contains(result.VolumeOrFileId, ",") { // this is a file id
|
|
|
|
|
|
|
|
|
if commaSep > 0 { // this is a file id
|
|
|
auth = string(security.GenJwtForVolumeServer(ms.guard.SigningKey, ms.guard.ExpiresAfterSec, result.VolumeOrFileId)) |
|
|
auth = string(security.GenJwtForVolumeServer(ms.guard.SigningKey, ms.guard.ExpiresAfterSec, result.VolumeOrFileId)) |
|
|
} |
|
|
} |
|
|
resp.VolumeIdLocations = append(resp.VolumeIdLocations, &master_pb.LookupVolumeResponse_VolumeIdLocation{ |
|
|
resp.VolumeIdLocations = append(resp.VolumeIdLocations, &master_pb.LookupVolumeResponse_VolumeIdLocation{ |
|
@ -102,6 +108,7 @@ func (ms *MasterServer) LookupVolume(ctx context.Context, req *master_pb.LookupV |
|
|
Auth: auth, |
|
|
Auth: auth, |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return resp, nil |
|
|
return resp, nil |
|
|
} |
|
|
} |
|
|