backup

package
v0.0.0-...-ac7cf33 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLine

type LogLine struct {
	Container string   `json:"container"`
	Line      string   `json:"_line"`
	Host      string   `json:"_host"`
	Tags      []string `json:"_tag"`
}

A LogLine represent a json line of LogDNA backup file.

type Reader

type Reader struct {
	File   *os.File
	Status *Status
}

A Reader can be read to retrieve uncompressed data from logdna backup file compressed with gzip.

func NewReader

func NewReader(file *os.File) *Reader

NewReader creates a new Reader reading the given file.

func (*Reader) ReadAll

func (r *Reader) ReadAll(output chan *LogLine)

ReadAll reads all file until EOF, Each row is parsed to a LogLine and sent to output channel. After EOF the output channel will be closed

type Status

type Status struct {
	FileInfo os.FileInfo
	Offset   int64
}

A Status contain the status of reading. FileInfo is a os.FileInfo of reading file. Offset is a position where the reader read at moment

type Writer

type Writer struct {
	OutputDir string
	// contains filtered or unexported fields
}

A Writer can be write to text plain from LogLine.

func NewWriter

func NewWriter(outputDir string) *Writer

NewWriter creates a new Writer writing files in output dir.

func (*Writer) CloseFiles

func (w *Writer) CloseFiles()

CloseFiles will close all opened files.

func (*Writer) WriteInFileByServer

func (w *Writer) WriteInFileByServer(l *LogLine)

WriteInFileByServer write a LogLine in a respective file. The file name is {l.Host}.log. For Each Distinct Host will open a new file but will not close the files when done. It is the caller's responsibility to call CloseFiles on the Writer when done.

Jump to

Keyboard shortcuts

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