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

Method Hash

fs/object/object.go:269–279  ·  view source on GitHub ↗

Hash returns the requested hash of the contents

(ctx context.Context, h hash.Type)

Source from the content-addressed store, hash-verified

267
268// Hash returns the requested hash of the contents
269func (o *MemoryObject) Hash(ctx context.Context, h hash.Type) (string, error) {
270 hash, err := hash.NewMultiHasherTypes(hash.Set(h))
271 if err != nil {
272 return "", err
273 }
274 _, err = hash.Write(o.content)
275 if err != nil {
276 return "", err
277 }
278 return hash.Sums()[h], nil
279}
280
281// SetModTime sets the metadata on the object to set the modification date
282func (o *MemoryObject) SetModTime(ctx context.Context, modTime time.Time) error {

Callers 1

TestMemoryObjectFunction · 0.95

Calls 3

SumsMethod · 0.80
SetMethod · 0.65
WriteMethod · 0.65

Tested by 1

TestMemoryObjectFunction · 0.76