aboutsummaryrefslogtreecommitdiff
path: root/weed/wdclient/vid_map.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/wdclient/vid_map.go')
-rw-r--r--weed/wdclient/vid_map.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/weed/wdclient/vid_map.go b/weed/wdclient/vid_map.go
index 2f56b8fce..166c05b0a 100644
--- a/weed/wdclient/vid_map.go
+++ b/weed/wdclient/vid_map.go
@@ -54,6 +54,19 @@ func (vc *vidMap) LookupFileId(fileId string) (fullUrl string, err error) {
return "http://" + serverUrl + "/" + fileId, nil
}
+func (vc *vidMap) LookupVolumeServer(fileId string) (volumeServer string, err error) {
+ parts := strings.Split(fileId, ",")
+ if len(parts) != 2 {
+ return "", errors.New("Invalid fileId " + fileId)
+ }
+ serverUrl, lookupError := vc.LookupVolumeServerUrl(parts[0])
+ if lookupError != nil {
+ return "", lookupError
+ }
+ return serverUrl, nil
+}
+
+
func (vc *vidMap) GetLocations(vid uint32) (locations []Location) {
vc.RLock()
defer vc.RUnlock()