diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-09-05 23:32:25 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-09-05 23:32:25 -0700 |
| commit | e93d4935e3ea6b2deb64f24e089b6f74d0f27ebe (patch) | |
| tree | 9af686f3c95f377d86a1a7e1df83edf9e2f1a615 /weed/operation/assign_file_id.go | |
| parent | 7a13816e9406548e93176ab887f73f7eef1dee83 (diff) | |
| download | seaweedfs-e93d4935e3ea6b2deb64f24e089b6f74d0f27ebe.tar.xz seaweedfs-e93d4935e3ea6b2deb64f24e089b6f74d0f27ebe.zip | |
add other replica locations when assigning volumes
Diffstat (limited to 'weed/operation/assign_file_id.go')
| -rw-r--r-- | weed/operation/assign_file_id.go | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/weed/operation/assign_file_id.go b/weed/operation/assign_file_id.go index f441dcb50..e4b30f040 100644 --- a/weed/operation/assign_file_id.go +++ b/weed/operation/assign_file_id.go @@ -22,13 +22,18 @@ type VolumeAssignRequest struct { WritableVolumeCount uint32 } +type AssignResultReplica struct { + Url string `json:"url,omitempty"` + PublicUrl string `json:"publicUrl,omitempty"` +} type AssignResult struct { - Fid string `json:"fid,omitempty"` - Url string `json:"url,omitempty"` - PublicUrl string `json:"publicUrl,omitempty"` - Count uint64 `json:"count,omitempty"` - Error string `json:"error,omitempty"` - Auth security.EncodedJwt `json:"auth,omitempty"` + Fid string `json:"fid,omitempty"` + Url string `json:"url,omitempty"` + PublicUrl string `json:"publicUrl,omitempty"` + Count uint64 `json:"count,omitempty"` + Error string `json:"error,omitempty"` + Auth security.EncodedJwt `json:"auth,omitempty"` + Replicas []AssignResultReplica `json:"replicas,omitempty"` } func Assign(masterFn GetMasterFn, grpcDialOption grpc.DialOption, primaryRequest *VolumeAssignRequest, alternativeRequests ...*VolumeAssignRequest) (*AssignResult, error) { @@ -69,6 +74,12 @@ func Assign(masterFn GetMasterFn, grpcDialOption grpc.DialOption, primaryRequest ret.PublicUrl = resp.PublicUrl ret.Error = resp.Error ret.Auth = security.EncodedJwt(resp.Auth) + for _, r := range ret.Replicas { + ret.Replicas = append(ret.Replicas, AssignResultReplica{ + Url: r.Url, + PublicUrl: r.PublicUrl, + }) + } if resp.Error != "" { return fmt.Errorf("assignRequest: %v", resp.Error) |
