MCPcopy
hub / github.com/NVIDIA/aistore / Write

Method Write

cluster/ct.go:164–177  ·  view source on GitHub ↗

Save CT to local drives. If workFQN is set, it saves in two steps: first, save to workFQN; second, rename workFQN to ct.FQN. If unset, it writes directly to ct.FQN

(t Target, reader io.Reader, size int64, workFQN ...string)

Source from the content-addressed store, hash-verified

162// save to workFQN; second, rename workFQN to ct.FQN. If unset, it writes
163// directly to ct.FQN
164func (ct *CT) Write(t Target, reader io.Reader, size int64, workFQN ...string) (err error) {
165 bdir := ct.mpathInfo.MakePathBck(ct.Bucket())
166 if err := cos.Stat(bdir); err != nil {
167 return err
168 }
169 buf, slab := t.PageMM().Alloc()
170 if len(workFQN) == 0 {
171 _, err = cos.SaveReader(ct.fqn, reader, buf, cos.ChecksumNone, size, "")
172 } else {
173 _, err = cos.SaveReaderSafe(workFQN[0], ct.fqn, reader, buf, cos.ChecksumNone, size, "")
174 }
175 slab.Free(buf)
176 return err
177}

Callers 5

ReadMethod · 0.45
mkFileFunction · 0.45
receiveMDMethod · 0.45
throughputFunction · 0.45
createTestFileFunction · 0.45

Calls 8

BucketMethod · 0.95
StatFunction · 0.92
SaveReaderFunction · 0.92
SaveReaderSafeFunction · 0.92
MakePathBckMethod · 0.80
PageMMMethod · 0.65
AllocMethod · 0.45
FreeMethod · 0.45

Tested by 3

mkFileFunction · 0.36
throughputFunction · 0.36
createTestFileFunction · 0.36