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)
| 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. |
| 168 | func (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 | |
| 188 | func (*zipExtractCreator) UsingCompression() bool { return true } |
| 189 | func (*zipExtractCreator) SupportsOffset() bool { return false } |
nothing calls this directly
no test coverage detected