mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-23 05:45:34 +08:00
migrate assign volume to grpc API on volume server
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage"
|
||||
)
|
||||
|
||||
func (vs *VolumeServer) DeleteCollection(ctx context.Context, req *volume_server_pb.DeleteCollectionRequest) (*volume_server_pb.DeleteCollectionResponse, error) {
|
||||
@@ -14,7 +15,32 @@ func (vs *VolumeServer) DeleteCollection(ctx context.Context, req *volume_server
|
||||
err := vs.store.DeleteCollection(req.Collection)
|
||||
|
||||
if err != nil {
|
||||
glog.V(3).Infof("delete collection %s: %v", req.Collection, err)
|
||||
glog.Errorf("delete collection %s: %v", req.Collection, err)
|
||||
} else {
|
||||
glog.V(2).Infof("delete collection %v", req)
|
||||
}
|
||||
|
||||
return resp, err
|
||||
|
||||
}
|
||||
|
||||
func (vs *VolumeServer) AssignVolume(ctx context.Context, req *volume_server_pb.AssignVolumeRequest) (*volume_server_pb.AssignVolumeResponse, error) {
|
||||
|
||||
resp := &volume_server_pb.AssignVolumeResponse{}
|
||||
|
||||
err := vs.store.AddVolume(
|
||||
storage.VolumeId(req.VolumdId),
|
||||
req.Collection,
|
||||
vs.needleMapKind,
|
||||
req.Replication,
|
||||
req.Ttl,
|
||||
req.Preallocate,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
glog.Errorf("assign volume %v: %v", req, err)
|
||||
} else {
|
||||
glog.V(2).Infof("assign volume %v", req)
|
||||
}
|
||||
|
||||
return resp, err
|
||||
|
Reference in New Issue
Block a user