CheckFile 客户端检测文件是否存在,文件的临时ID和md5, 服务器返回不存在的文件ID.
(ctx context.Context, req *meta.GateCheckFileRequest)
| 456 | |
| 457 | // CheckFile 客户端检测文件是否存在,文件的临时ID和md5, 服务器返回不存在的文件ID. |
| 458 | func (g *Gate) CheckFile(ctx context.Context, req *meta.GateCheckFileRequest) (*meta.GateCheckFileResponse, error) { |
| 459 | s, err := g.getOnlineSession(ctx) |
| 460 | if err != nil { |
| 461 | log.Errorf("getSession error:%s", errors.ErrorStack(err)) |
| 462 | return &meta.GateCheckFileResponse{Header: &meta.ResponseHeader{Code: util.ErrorGetOnlineSession, Msg: err.Error()}}, nil |
| 463 | } |
| 464 | |
| 465 | names, err := g.store.checkFile(s.id, req.Names) |
| 466 | if err != nil { |
| 467 | return &meta.GateCheckFileResponse{Header: &meta.ResponseHeader{Code: util.ErrorCheckFile, Msg: err.Error()}}, nil |
| 468 | } |
| 469 | |
| 470 | return &meta.GateCheckFileResponse{Names: names}, nil |
| 471 | } |
| 472 | |
| 473 | // DownloadFile 客户端下载文件,传入ID,返回具体文件内容. |
| 474 | func (g *Gate) DownloadFile(ctx context.Context, req *meta.GateDownloadFileRequest) (*meta.GateDownloadFileResponse, error) { |
nothing calls this directly
no test coverage detected