github.com/kubeshop/testkube@v1.17.23/pkg/executor/scraper/extractor.go (about) 1 package scraper 2 3 import ( 4 "context" 5 "io" 6 ) 7 8 type DataType string 9 10 const ( 11 // DataTypeRaw specifies that the object is a raw file 12 DataTypeRaw DataType = "raw" 13 // DataTypeTarball specifies that the object is a tarball (gzip compressed tar archive) 14 DataTypeTarball DataType = "tarball" 15 ) 16 17 //go:generate mockgen -destination=./mock_extractor.go -package=scraper "github.com/kubeshop/testkube/pkg/executor/scraper" Extractor 18 type Extractor interface { 19 Extract(ctx context.Context, paths, masks []string, process ProcessFn, notify NotifyFn) error 20 } 21 22 type ProcessFn func(ctx context.Context, object *Object) error 23 24 type NotifyFn func(ctx context.Context, path string) error 25 26 type Object struct { 27 Name string 28 Size int64 29 Data io.Reader 30 DataType DataType 31 } 32 33 type FilesMeta struct { 34 // DataType is the type of data that is stored 35 DataType DataType `json:"dataType"` 36 // Files is a list of files that are stored and their original sizes 37 Files []*FileStat `json:"files"` 38 // Archive is the name of the archive file that contains all the files 39 Archive string `json:"archive,omitempty"` 40 } 41 type FileStat struct { 42 Name string `json:"name"` 43 Size int64 `json:"size"` 44 // Status shows if file is ready to be downloaded 45 // One of: ready, processing, error 46 Status string `json:"status,omitempty"` 47 }