MCPcopy
hub / github.com/rclone/rclone / readMetaDataForPath

Method readMetaDataForPath

backend/yandex/yandex.go:217–253  ·  view source on GitHub ↗
(ctx context.Context, path string, options *api.ResourceInfoRequestOptions)

Source from the content-addressed store, hash-verified

215}
216
217func (f *Fs) readMetaDataForPath(ctx context.Context, path string, options *api.ResourceInfoRequestOptions) (*api.ResourceInfoResponse, error) {
218 opts := rest.Opts{
219 Method: "GET",
220 Path: "/resources",
221 Parameters: url.Values{},
222 }
223
224 opts.Parameters.Set("path", f.opt.Enc.FromStandardPath(path))
225
226 if options.SortMode != nil {
227 opts.Parameters.Set("sort", options.SortMode.String())
228 }
229 if options.Limit != 0 {
230 opts.Parameters.Set("limit", strconv.FormatUint(options.Limit, 10))
231 }
232 if options.Offset != 0 {
233 opts.Parameters.Set("offset", strconv.FormatUint(options.Offset, 10))
234 }
235 if options.Fields != nil {
236 opts.Parameters.Set("fields", strings.Join(options.Fields, ","))
237 }
238
239 var err error
240 var info api.ResourceInfoResponse
241 var resp *http.Response
242 err = f.pacer.Call(func() (bool, error) {
243 resp, err = f.srv.CallJSON(ctx, &opts, nil, &info)
244 return shouldRetry(ctx, resp, err)
245 })
246
247 if err != nil {
248 return nil, err
249 }
250
251 info.Name = f.opt.Enc.ToStandardName(info.Name)
252 return &info, nil
253}
254
255// NewFs constructs an Fs from the path, container:path
256func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error) {

Callers 6

NewFsFunction · 0.95
ListMethod · 0.95
purgeCheckMethod · 0.95
DirMoveMethod · 0.95
PublicLinkMethod · 0.95
readMetaDataMethod · 0.45

Calls 8

JoinMethod · 0.80
shouldRetryFunction · 0.70
SetMethod · 0.65
FromStandardPathMethod · 0.65
StringMethod · 0.65
ToStandardNameMethod · 0.65
CallMethod · 0.45
CallJSONMethod · 0.45

Tested by

no test coverage detected