snapshotter

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSnapshotter

func NewSnapshotter(cfg types.Config, snapCfg types.SnapshotterConfig, bootloader types.Bootloader) (types.Snapshotter, error)

func NewSubvolumeBackend added in v2.3.0

func NewSubvolumeBackend(cfg *types.Config, bCfg types.BtrfsConfig, maxSnaps int) subvolumeBackend

NewSubvolumeBackend returns an instance of a subvolume backend

Types

type Btrfs

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

func (*Btrfs) CloseTransaction

func (b *Btrfs) CloseTransaction(snapshot *types.Snapshot) (err error)

CloseTransaction closes the transaction for the given snapshot. This is the responsible to set the active btrfs subvolume

func (*Btrfs) CloseTransactionOnError

func (b *Btrfs) CloseTransactionOnError(snapshot *types.Snapshot) (err error)

CloseTransactionOnError is a destructor method to clean the given initated snapshot. Useful in case of an error once the transaction has already started.

func (*Btrfs) DeleteSnapshot

func (b *Btrfs) DeleteSnapshot(id int) error

DeleteSnapshot deletes the snapshot of the given ID. It cannot delete the current snapshot, if any.

func (*Btrfs) GetSnapshots

func (b *Btrfs) GetSnapshots() (snapshots []int, err error)

GetSnapshots returns a list of the available snapshots IDs. It does not return any value if this Btrfs instance has not previously called InitSnapshotter.

func (*Btrfs) InitSnapshotter

func (b *Btrfs) InitSnapshotter(state *types.Partition, efiDir string) error

InitSnapshotter initiates the snapshotter to the given root directory. This method includes the logic to create required subvolmes to handle snapshots as snapper does.

func (*Btrfs) SnapshotToImageSource

func (b *Btrfs) SnapshotToImageSource(snap *types.Snapshot) (*types.ImageSource, error)

SnapshotImageToSource converts the given snapshot into an ImageSource. This is useful to deploy a system from a given snapshot, for instance setting the recovery image from a snapshot.

func (*Btrfs) StartTransaction

func (b *Btrfs) StartTransaction() (*types.Snapshot, error)

StartTransaction starts a transaction for this snapshotter instance and returns the work in progress snapshot object.

type Date

type Date time.Time

func (Date) MarshalXML

func (d Date) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML is the encoder handler for time.Time types according to the snapper format.

func (*Date) UnmarshalXML

func (d *Date) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error

UnmarshalXML is the decoder handler for time.Time types according to the snapper format.

type LoopDevice

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

func (*LoopDevice) CloseTransaction

func (l *LoopDevice) CloseTransaction(snapshot *types.Snapshot) (err error)

CloseTransaction closes the transaction for the given snapshot. This is the responsible of setting new active and passive snapshots.

func (*LoopDevice) CloseTransactionOnError

func (l *LoopDevice) CloseTransactionOnError(snapshot *types.Snapshot) error

CloseTransactionOnError is a destructor method to clean the given initated snapshot. Useful in case of an error once the transaction has already started.

func (*LoopDevice) DeleteSnapshot

func (l *LoopDevice) DeleteSnapshot(id int) error

DeleteSnapshot deletes the snapshot of the given ID. It cannot delete an snapshot that is actually booted.

func (*LoopDevice) GetSnapshots

func (l *LoopDevice) GetSnapshots() ([]int, error)

GetSnapshots returns a list of the available snapshots IDs.

func (*LoopDevice) InitSnapshotter

func (l *LoopDevice) InitSnapshotter(state *types.Partition, efiDir string) error

InitSnapshotter initiates the snapshotter to the given root directory. More over this method includes logic to migrate from older elemental-toolkit versions.

func (*LoopDevice) SnapshotToImageSource

func (l *LoopDevice) SnapshotToImageSource(snap *types.Snapshot) (*types.ImageSource, error)

SnapshotImageToSource converts the given snapshot into an ImageSource. This is useful to deploy a system from a given snapshot, for instance setting the recovery image from a snapshot.

func (*LoopDevice) StartTransaction

func (l *LoopDevice) StartTransaction() (*types.Snapshot, error)

StartTransaction starts a transaction for this snapshotter instance and returns the work in progress snapshot object.

type SnapperSnapshotXML

type SnapperSnapshotXML struct {
	XMLName     xml.Name   `xml:"snapshot"`
	Type        string     `xml:"type"`
	Num         int        `xml:"num"`
	Date        Date       `xml:"date"`
	Cleanup     string     `xml:"cleanup"`
	Description string     `xml:"description"`
	UserData    []UserData `xml:"userdata"`
}

type UserData added in v2.3.0

type UserData struct {
	XMLName xml.Name `xml:"userdata"`
	Key     string   `xml:"key"`
	Value   string   `xml:"value"`
}

Jump to

Keyboard shortcuts

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