MCPcopy Index your code
hub / github.com/dearcode/candy / CheckFile

Method CheckFile

gate/server.go:458–471  ·  view source on GitHub ↗

CheckFile 客户端检测文件是否存在,文件的临时ID和md5, 服务器返回不存在的文件ID.

(ctx context.Context, req *meta.GateCheckFileRequest)

Source from the content-addressed store, hash-verified

456
457// CheckFile 客户端检测文件是否存在,文件的临时ID和md5, 服务器返回不存在的文件ID.
458func (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,返回具体文件内容.
474func (g *Gate) DownloadFile(ctx context.Context, req *meta.GateDownloadFileRequest) (*meta.GateDownloadFileResponse, error) {

Callers

nothing calls this directly

Calls 3

getOnlineSessionMethod · 0.95
checkFileMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected