snapshot

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const Extension = ".gkup"

Variables

View Source
var ErrNumberOfFilesDoesNotMatch = errors.New("numbers of files written doesn't match with the numberOfFiles provided when initializing writer")

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	Version       string `json:"version"`
	NumberOfFiles uint64 `json:"files"`
}

Metadata represents the metadata of a snapshot. It's always the first JSON found.

type Reader

type Reader struct {
	Meta Metadata
	// contains filtered or unexported fields
}

Reader represents a snapshot reader

func NewReader

func NewReader(path string) (*Reader, error)

NewReader will take the path of a snapshot and return a reader of it

func (*Reader) Close

func (r *Reader) Close() error

Close closes the reader

func (*Reader) More

func (r *Reader) More() bool

More returns if there are more files

func (*Reader) Next

func (r *Reader) Next() (*common.File, error)

Next returns the next file. As a consequence of the common.File serialization, the AbsPath of the file returned will be empty.

type Writer

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

Writer represents the writer of a snapshot

func NewWriter

func NewWriter(path string, numberOfFiles uint64) (*Writer, error)

NewWriter takes the path of a new snapshot and the number of files that it will contain, and return a new writer.

func (*Writer) Close

func (w *Writer) Close() error

Close flushes the buffers and closes the writer. If the numberOfFiles provided when initializing doesn't match the number of files wrote, it returns ErrNumberOfFilesDoesNotMatch AFTER closing the object.

func (*Writer) Write

func (w *Writer) Write(f *common.File) error

Write writes a new file

Jump to

Keyboard shortcuts

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