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.

28 lines
765 B

  1. package topology
  2. import (
  3. "context"
  4. "github.com/chrislusf/seaweedfs/weed/operation"
  5. "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
  6. "github.com/chrislusf/seaweedfs/weed/storage"
  7. )
  8. type AllocateVolumeResult struct {
  9. Error string
  10. }
  11. func AllocateVolume(dn *DataNode, vid storage.VolumeId, option *VolumeGrowOption) error {
  12. return operation.WithVolumeServerClient(dn.Url(), func(client volume_server_pb.VolumeServerClient) error {
  13. _, deleteErr := client.AssignVolume(context.Background(), &volume_server_pb.AssignVolumeRequest{
  14. VolumdId: uint32(vid),
  15. Collection: option.Collection,
  16. Replication: option.ReplicaPlacement.String(),
  17. Ttl: option.Ttl.String(),
  18. Preallocate: option.Prealloacte,
  19. })
  20. return deleteErr
  21. })
  22. }