combine

package
v4.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress

func Compress(output io.Writer) (*pgzip.Writer, func(), error)

Compress takes an io writer as its input, and compresses it. It returns this, along with a function to close the writer and an error status.

func Concatenate

func Concatenate(inputs []*os.File, output io.Writer) error

Concatenate takes a list of open files as its input, and an io.Writer as its output. It concatenates the contents of the inputs into the output.

func ConcatenateAndCompress

func ConcatenateAndCompress(inputs []*os.File, output *os.File) error

ConcatenateAndCompress takes a list of open files as its input, and an open file for its output. It writes to the output the compressed, concatenated inputs.

func DgutFiles

func DgutFiles(inputs []string, outputDir string) error

DgutFiles merges the pre-sorted dgut files, summing consecutive lines with the same first 4 columns, and outputs the results to an embedded database.

func GroupFiles

func GroupFiles(inputs []*os.File, output *os.File) error

GroupFiles combines pre-sorted .bygroup file data, by merging lines that share the same first 2 column values in to a single line.

func LogFiles

func LogFiles(inputs []*os.File, output *os.File) error

LogFiles merges the log files and stores in the output, compressed.

func Merge

func Merge(inputs []*os.File, output io.Writer, streamFunc Merger) error

Merge merges the inputs files and streams the content to the streamFunc.

func MergeAndCompress

func MergeAndCompress(inputs []*os.File, output *os.File, streamFunc Merger) error

MergeAndCompress takes a list of open files, an open output file, and a Merger function to express the details of how the file contents should be merged. It compresses the output, and stores the merged input contents in there.

func MergeSortedFiles

func MergeSortedFiles(inputs []string) (io.ReadCloser, func() error, error)

MergeSortedFiles shells out to `sort -m` to merge pre-sorted files together. Returns a pipe of the output from sort, and function you should call after you've finished reading the output to cleanup.

func MergeSummaryLines

func MergeSummaryLines(data io.ReadCloser, matchColumns, summaryColumns int,
	mslm MatchingSummaryLineMerger, output io.Writer) error

MergeSummaryLines merges pre-sorted (pre-merged) summary data (eg. from a `sort -m` of .by* files), summing consecutive lines that have the same values in the first matchColumns columns, and outputting the results.

func StatFiles

func StatFiles(inputs []*os.File, output *os.File) error

StatFiles concatenates and compresses the input stat files to the output.

func UserGroupFiles

func UserGroupFiles(inputs []*os.File, output *os.File) error

UserGroupFiles combines pre-sorted .byusergroup file data, by merging lines that share the same first 3 column values in to a single line, and compressing the output.

Types

type MatchingSummaryLineMerger

type MatchingSummaryLineMerger func(cols int, a, b []string)

MatchingSummaryLineMerger is a func used by MergeSummaryLines() to handle summary columns when match columns match. a is the previous columns, b is the current. a should have its summary columns altered to merge information from b. Cols is the number of summary columns (the columns that contain info to eg. sum).

type Merger

type Merger func(data io.ReadCloser, output io.Writer) error

Merger takes an input io.readCloser and an output io.writer, and defines how we want to merge the content in the io.readCloser, and stream it to the output io.writer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL