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

Method CreateShard

dsort/extract/zip.go:168–186  ·  view source on GitHub ↗

CreateShard creates a new shard locally based on the Shard. Note that the order of closing must be trw, gzw, then finally tarball.

(s *Shard, w io.Writer, loadContent LoadContentFunc)

Source from the content-addressed store, hash-verified

166// CreateShard creates a new shard locally based on the Shard.
167// Note that the order of closing must be trw, gzw, then finally tarball.
168func (z *zipExtractCreator) CreateShard(s *Shard, w io.Writer, loadContent LoadContentFunc) (written int64, err error) {
169 var n int64
170 zw := zip.NewWriter(w)
171 defer cos.Close(zw)
172
173 rdReader := newZipRecordDataReader(z.t)
174 for _, rec := range s.Records.All() {
175 for _, obj := range rec.Objects {
176 rdReader.reinit(zw, obj.Size, obj.MetadataSize)
177 if n, err = loadContent(rdReader, rec, obj); err != nil {
178 return written + n, err
179 }
180
181 written += n
182 }
183 }
184 rdReader.free()
185 return written, nil
186}
187
188func (*zipExtractCreator) UsingCompression() bool { return true }
189func (*zipExtractCreator) SupportsOffset() bool { return false }

Callers

nothing calls this directly

Calls 5

CloseFunction · 0.92
newZipRecordDataReaderFunction · 0.85
AllMethod · 0.45
reinitMethod · 0.45
freeMethod · 0.45

Tested by

no test coverage detected