Split's JoinStream now creates and returns a read only channel

master
Frederick F. Kautz IV 10 years ago
parent fa52e8b355
commit d73c57cff9
  1. 11
      pkgs/split/split.go

@ -95,7 +95,13 @@ func SplitStream(reader io.Reader, chunkSize uint64, ch chan SplitMessage) {
close(ch) close(ch)
} }
func JoinStream(dirname string, inputPrefix string, ch chan JoinMessage) { func JoinStream(dirname string, inputPrefix string) <-chan JoinMessage {
ch := make(chan JoinMessage)
go joinStreamGoRoutine(dirname, inputPrefix, ch)
return ch
}
func joinStreamGoRoutine(dirname string, inputPrefix string, ch chan JoinMessage) {
var readError error var readError error
var bytesBuffer bytes.Buffer var bytesBuffer bytes.Buffer
@ -147,8 +153,7 @@ func JoinFilesWithPrefix(dirname string, inputPrefix string, outputFile string)
return errors.New("Invalid output file") return errors.New("Invalid output file")
} }
ch := make(chan JoinMessage) ch := JoinStream(dirname, inputPrefix)
go JoinStream(dirname, inputPrefix, ch)
var multiReaders []io.Reader var multiReaders []io.Reader
var aggregatedLength int64 var aggregatedLength int64

Loading…
Cancel
Save