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

Method DownloadFile

store/server.go:246–257  ·  view source on GitHub ↗

DownloadFile 下载文件,传入文件MD5,返回具体文件内容.

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

Source from the content-addressed store, hash-verified

244
245// DownloadFile 下载文件,传入文件MD5,返回具体文件内容.
246func (s *Store) DownloadFile(_ context.Context, req *meta.StoreDownloadFileRequest) (*meta.StoreDownloadFileResponse, error) {
247 files := make(map[string][]byte)
248 for _, name := range req.Names {
249 data, err := s.file.get([]byte(name))
250 if err != nil {
251 return &meta.StoreDownloadFileResponse{Header: &meta.ResponseHeader{Code: -1, Msg: err.Error()}}, nil
252 }
253 files[name] = data
254 }
255
256 return &meta.StoreDownloadFileResponse{Files: files}, nil
257}
258
259// LoadMessage 收取用户消息,每次可逆序(旧消息)或正序(新消息)接收100条
260// 如果ID为0,就逆序返回旧的100条消息

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected