18
"github.com/cubefs/cubefs/blobstore/api/proxy"
19
errcode "github.com/cubefs/cubefs/blobstore/common/errors"
20
"github.com/cubefs/cubefs/blobstore/common/rpc"
21
"github.com/cubefs/cubefs/blobstore/common/trace"
25
func (s *Service) Alloc(c *rpc.Context) {
26
args := new(proxy.AllocVolsArgs)
27
if err := c.ParseArgs(args); err != nil {
32
ctx := c.Request.Context()
33
span := trace.SpanFromContextSafe(ctx)
35
if args.BidCount == 0 || args.Fsize == 0 {
36
c.RespondError(errcode.ErrIllegalArguments)
39
span.Infof("accept Alloc request, args: %v", args)
40
resp, err := s.volumeMgr.Alloc(ctx, args)
42
span.Errorf("alloc volume failed, err: %v", err)
47
span.Infof("alloc request response: %v", resp)
51
func (s *Service) List(c *rpc.Context) {
52
args := new(proxy.ListVolsArgs)
53
if err := c.ParseArgs(args); err != nil {
58
ctx := c.Request.Context()
59
span := trace.SpanFromContextSafe(ctx)
61
if !args.CodeMode.IsValid() {
62
c.RespondError(errcode.ErrIllegalArguments)
66
span.Infof("accept List request, args: %v", args)
67
vids, volumes, err := s.volumeMgr.List(ctx, args.CodeMode)
72
resp := &proxy.VolumeList{
77
span.Infof("list request response: %v", resp)
81
func (s *Service) Discard(c *rpc.Context) {
82
args := new(proxy.DiscardVolsArgs)
83
if err := c.ParseArgs(args); err != nil {
88
ctx := c.Request.Context()
89
span := trace.SpanFromContextSafe(ctx)
91
span.Infof("accept Discard request, args: %v", args)
93
err := s.volumeMgr.Discard(ctx, args)