MCPcopy
hub / github.com/rclone/rclone / NewStaticObjectInfo

Function NewStaticObjectInfo

fs/object/object.go:30–50  ·  view source on GitHub ↗

NewStaticObjectInfo returns a static ObjectInfo If hashes is nil and fs is not nil, the hash map will be replaced with empty hashes of the types supported by the fs.

(remote string, modTime time.Time, size int64, storable bool, hashes map[hash.Type]string, f fs.Info)

Source from the content-addressed store, hash-verified

28// If hashes is nil and fs is not nil, the hash map will be replaced with
29// empty hashes of the types supported by the fs.
30func NewStaticObjectInfo(remote string, modTime time.Time, size int64, storable bool, hashes map[hash.Type]string, f fs.Info) *StaticObjectInfo {
31 info := &StaticObjectInfo{
32 remote: remote,
33 modTime: modTime,
34 size: size,
35 storable: storable,
36 hashes: hashes,
37 fs: f,
38 }
39 if f != nil && hashes == nil {
40 set := f.Hashes().Array()
41 info.hashes = make(map[hash.Type]string)
42 for _, ht := range set {
43 info.hashes[ht] = ""
44 }
45 }
46 if f == nil {
47 info.fs = MemoryFs
48 }
49 return info
50}
51
52// WithMetadata adds meta to the ObjectInfo
53func (i *StaticObjectInfo) WithMetadata(meta fs.Metadata) *StaticObjectInfo {

Callers 15

writeObjectReaderMethod · 0.92
updateObjectRemoteMethod · 0.92
updateDataMethod · 0.92
makeTempFileFunction · 0.92
TestInternalReadOnlyMethod · 0.92
uploadFileFunction · 0.92
testMetadataPathsMethod · 0.92
TestHashOnUpdateFunction · 0.92
rcatMethod · 0.92
UpdateMethod · 0.92

Calls 2

ArrayMethod · 0.80
HashesMethod · 0.65

Tested by 15

writeObjectReaderMethod · 0.74
updateObjectRemoteMethod · 0.74
updateDataMethod · 0.74
TestInternalReadOnlyMethod · 0.74
uploadFileFunction · 0.74
testMetadataPathsMethod · 0.74
TestHashOnUpdateFunction · 0.74
testFutureProofFunction · 0.74
testNoChunkMethod · 0.74
testWithChunkMethod · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…