snapshot

package
v0.0.0-...-ced0851 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LayeredMap

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

func NewLayeredMap

func NewLayeredMap(h func(string) (string, error)) *LayeredMap

NewLayeredMap creates a new layered map which keeps track of adds and deletes.

func (*LayeredMap) Add

func (l *LayeredMap) Add(s string) error

Add will add the specified file s to the current layer.

func (*LayeredMap) AddDelete

func (l *LayeredMap) AddDelete(s string) error

AddDelete will delete the specific files in the current layer.

func (*LayeredMap) CheckFileChange

func (l *LayeredMap) CheckFileChange(s string) (bool, error)

CheckFileChange checks whether a given file (needs to exist) changed from the current layered map by its hashing function. If the file does not exist, an error is returned. Returns true if the file is changed.

func (*LayeredMap) GetCurrentPaths

func (l *LayeredMap) GetCurrentPaths() map[string]struct{}

GetCurrentPaths returns all existing paths in the actual current image cached by FlattenLayers.

func (*LayeredMap) Key

func (l *LayeredMap) Key() (string, error)

Key returns a hash for added and delted files.

func (*LayeredMap) Snapshot

func (l *LayeredMap) Snapshot()

Snapshot creates a new layer.

type Snapshotter

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

Snapshotter holds the root directory from which to take snapshots, and a list of snapshots taken

func NewSnapshotter

func NewSnapshotter(l *LayeredMap, d string) *Snapshotter

NewSnapshotter creates a new snapshotter rooted at d

func (*Snapshotter) Init

func (s *Snapshotter) Init() error

Init initializes a new snapshotter

func (*Snapshotter) Key

func (s *Snapshotter) Key() (string, error)

Key returns a string based on the current state of the file system

func (*Snapshotter) TakeSnapshot

func (s *Snapshotter) TakeSnapshot(files []string, shdCheckDelete bool, forceBuildMetadata bool) (string, error)

TakeSnapshot takes a snapshot of the specified files, avoiding directories in the ignorelist, and creates a tarball of the changed files. Return contents of the tarball, and whether or not any files were changed

func (*Snapshotter) TakeSnapshotFS

func (s *Snapshotter) TakeSnapshotFS() (string, error)

TakeSnapshotFS takes a snapshot of the filesystem, avoiding directories in the ignorelist, and creates a tarball of the changed files.

Jump to

Keyboard shortcuts

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