Ejemplo n.º 1
0
func (i *isolateServer) doPushDB(state *PushState, reader io.Reader) error {
	buf := bytes.Buffer{}
	compressor := isolated.GetCompressor(&buf)
	if _, err := io.Copy(compressor, reader); err != nil {
		return err
	}
	if err := compressor.Close(); err != nil {
		return err
	}
	in := &isolated.StorageRequest{state.status.UploadTicket, buf.Bytes()}
	return i.postJSON("/_ah/api/isolateservice/v1/store_inline", in, nil)
}
Ejemplo n.º 2
0
func (c *compressed) reset() {
	var w *io.PipeWriter
	c.r, w = io.Pipe()
	c.wg.Add(1)
	go func() {
		defer c.wg.Done()
		compressor := isolated.GetCompressor(w)
		_, err := io.Copy(compressor, c.src)
		if err2 := compressor.Close(); err == nil {
			err = err2
		}
		w.CloseWithError(err)
	}()
}