MCPcopy
hub / github.com/rclone/rclone / NewItem

Function NewItem

fstest/fstest.go:97–111  ·  view source on GitHub ↗

NewItem creates an item from a string content

(Path, Content string, modTime time.Time)

Source from the content-addressed store, hash-verified

95
96// NewItem creates an item from a string content
97func NewItem(Path, Content string, modTime time.Time) Item {
98 i := Item{
99 Path: Path,
100 ModTime: modTime,
101 Size: int64(len(Content)),
102 }
103 hash := hash.NewMultiHasher()
104 buf := bytes.NewBufferString(Content)
105 _, err := io.Copy(hash, buf)
106 if err != nil {
107 fs.Fatalf(nil, "Failed to create item: %v", err)
108 }
109 i.Hashes = hash.Sums()
110 return i
111}
112
113// CheckTimeEqualWithPrecision checks the times are equal within the
114// precision, returns the delta and a flag

Callers 15

TestInternalReadOnlyMethod · 0.92
TestMoveCopyFunction · 0.92
internalTestMetadataMethod · 0.92
InternalTestVersionsMethod · 0.92
InternalTestMetadataMethod · 0.92
InternalTestMetadataMethod · 0.92
InternalTestNoHeadMethod · 0.92
InternalTestVersionsMethod · 0.92
testGzipEncodingMethod · 0.92
testMetadataPathsMethod · 0.92

Calls 3

SumsMethod · 0.95
FatalfFunction · 0.92
CopyMethod · 0.65

Tested by 15

TestInternalReadOnlyMethod · 0.74
TestMoveCopyFunction · 0.74
internalTestMetadataMethod · 0.74
InternalTestVersionsMethod · 0.74
InternalTestMetadataMethod · 0.74
InternalTestMetadataMethod · 0.74
InternalTestNoHeadMethod · 0.74
InternalTestVersionsMethod · 0.74
testGzipEncodingMethod · 0.74
testMetadataPathsMethod · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…