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

Method CheckFile

store/server.go:231–243  ·  view source on GitHub ↗

CheckFile 检测文件是否存在,文件的MD5, 服务器返回不存在的文件MD5.

(_ context.Context, req *meta.StoreCheckFileRequest)

Source from the content-addressed store, hash-verified

229
230// CheckFile 检测文件是否存在,文件的MD5, 服务器返回不存在的文件MD5.
231func (s *Store) CheckFile(_ context.Context, req *meta.StoreCheckFileRequest) (*meta.StoreCheckFileResponse, error) {
232 var names []string
233 for _, name := range req.Names {
234 ok, err := s.file.exist([]byte(name))
235 if err != nil {
236 return &meta.StoreCheckFileResponse{Header: &meta.ResponseHeader{Code: -1, Msg: err.Error()}}, nil
237 }
238 if !ok {
239 names = append(names, name)
240 }
241 }
242 return &meta.StoreCheckFileResponse{Names: names}, nil
243}
244
245// DownloadFile 下载文件,传入文件MD5,返回具体文件内容.
246func (s *Store) DownloadFile(_ context.Context, req *meta.StoreDownloadFileRequest) (*meta.StoreDownloadFileResponse, error) {

Callers

nothing calls this directly

Calls 2

existMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected