MCPcopy Create free account
hub / github.com/devspace-sh/devspace / Upload

Method Upload

helper/server/upstream.go:241–263  ·  view source on GitHub ↗

Upload implements the server upload interface and writes all the data received to a temporary file

(stream remote.Upstream_UploadServer)

Source from the content-addressed store, hash-verified

239// Upload implements the server upload interface and writes all the data received to a
240// temporary file
241func (u *Upstream) Upload(stream remote.Upstream_UploadServer) error {
242 reader, writer := io.Pipe()
243
244 defer reader.Close()
245 defer writer.Close()
246
247 writerErrChan := make(chan error)
248 go func() {
249 writerErrChan <- u.writeTar(writer, stream)
250 }()
251
252 err := untarAll(reader, u.options)
253 if err != nil {
254 return errors.Wrap(err, "untar all")
255 }
256
257 err = <-writerErrChan
258 if err != nil {
259 return errors.Wrap(err, "write tar")
260 }
261
262 return stream.SendAndClose(&remote.Empty{})
263}
264
265func (u *Upstream) writeTar(writer io.WriteCloser, stream remote.Upstream_UploadServer) error {
266 defer writer.Close()

Callers

nothing calls this directly

Calls 4

writeTarMethod · 0.95
untarAllFunction · 0.70
CloseMethod · 0.65
SendAndCloseMethod · 0.65

Tested by

no test coverage detected