MCPcopy Index your code
hub / github.com/rclone/rclone / getHash

Method getHash

backend/hasher/object.go:17–27  ·  view source on GitHub ↗

obtain hash for an object

(ctx context.Context, hashType hash.Type)

Source from the content-addressed store, hash-verified

15
16// obtain hash for an object
17func (o *Object) getHash(ctx context.Context, hashType hash.Type) (string, error) {
18 maxAge := time.Duration(o.f.opt.MaxAge)
19 if maxAge <= 0 {
20 return "", nil
21 }
22 fp := o.fingerprint(ctx)
23 if fp == "" {
24 return "", errors.New("fingerprint failed")
25 }
26 return o.f.getRawHash(ctx, hashType, o.Remote(), fp, maxAge)
27}
28
29// obtain hash for a path
30func (f *Fs) getRawHash(ctx context.Context, hashType hash.Type, remote, fp string, age time.Duration) (string, error) {

Callers 1

HashMethod · 0.95

Calls 3

fingerprintMethod · 0.95
RemoteMethod · 0.95
getRawHashMethod · 0.80

Tested by

no test coverage detected