Add capacity to obidistribute to save gzipped files

This commit is contained in:
2023-02-17 12:52:19 +01:00
parent 6fd426d8be
commit 9554a32490
9 changed files with 124 additions and 30 deletions

View File

@@ -2,6 +2,7 @@ package obiformats
import (
"fmt"
"strings"
"sync"
log "github.com/sirupsen/logrus"
@@ -22,6 +23,7 @@ func WriterDispatcher(prototypename string,
jobDone.Add(1)
go func() {
opt := MakeOptions(options)
for newflux := range dispatcher.News() {
jobDone.Add(1)
go func(newflux int) {
@@ -31,8 +33,13 @@ func WriterDispatcher(prototypename string,
log.Fatalf("Cannot retreive the new chanel : %v", err)
}
name:=fmt.Sprintf(prototypename, dispatcher.Classifier().Value(newflux))
if opt.CompressedFile() && ! strings.HasSuffix(name,".gz") {
name = name + ".gz"
}
out, err := formater(data,
fmt.Sprintf(prototypename, dispatcher.Classifier().Value(newflux)),
name,
options...)
if err != nil {