feat: update restore to support InfluxDB 2.0.x (#185)

This commit is contained in:
Daniel Moran
2021-07-09 15:36:44 -04:00
committed by GitHub
parent 95f190bf64
commit c3feea5900
17 changed files with 380 additions and 161 deletions

30
pkg/gzip/gunzip.go Normal file
View File

@ -0,0 +1,30 @@
package gzip
import (
"compress/gzip"
"io"
)
func NewGunzipReadCloser(in io.ReadCloser) (*gunzipReadCloser, error) {
gzr, err := gzip.NewReader(in)
if err != nil {
return nil, err
}
return &gunzipReadCloser{underlying: in, gunzip: gzr}, nil
}
type gunzipReadCloser struct {
underlying io.ReadCloser
gunzip io.ReadCloser
}
func (gzrc *gunzipReadCloser) Read(p []byte) (int, error) {
return gzrc.gunzip.Read(p)
}
func (gzrc *gunzipReadCloser) Close() error {
if err := gzrc.gunzip.Close(); err != nil {
return err
}
return gzrc.underlying.Close()
}