Documentation ¶
Index ¶
- type DeviceMapper
- func (dmpr *DeviceMapper) CreateDeviceSnapshot(ctx context.Context, snapKey, parentKey string) error
- func (dmpr *DeviceMapper) CreateDeviceSnapshotFromImage(ctx context.Context, snapshotKey string, image containerd.Image) error
- func (dmpr *DeviceMapper) CreatePatch(ctx context.Context, patchPath, containerSnapKey string, ...) error
- func (dmpr *DeviceMapper) GetDeviceSnapshot(ctx context.Context, snapKey string) (*DeviceSnapshot, error)
- func (dmpr *DeviceMapper) GetImageSnapshot(ctx context.Context, image containerd.Image) (*DeviceSnapshot, error)
- func (dmpr *DeviceMapper) RemoveDeviceSnapshot(ctx context.Context, snapKey string) error
- func (dmpr *DeviceMapper) RestorePatch(ctx context.Context, containerSnapKey, patchPath string) error
- type DeviceSnapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeviceMapper ¶
DeviceMapper creates and manages device snapshots used to store container images.
func NewDeviceMapper ¶
func NewDeviceMapper(client *containerd.Client) *DeviceMapper
func (*DeviceMapper) CreateDeviceSnapshot ¶
func (dmpr *DeviceMapper) CreateDeviceSnapshot(ctx context.Context, snapKey, parentKey string) error
CreateDeviceSnapshot creates a new device mapper snapshot from the given parent snapshot.
func (*DeviceMapper) CreateDeviceSnapshotFromImage ¶
func (dmpr *DeviceMapper) CreateDeviceSnapshotFromImage(ctx context.Context, snapshotKey string, image containerd.Image) error
CreateDeviceSnapshotFromImage creates a new device mapper snapshot based on the given image.
func (*DeviceMapper) CreatePatch ¶
func (dmpr *DeviceMapper) CreatePatch(ctx context.Context, patchPath, containerSnapKey string, image containerd.Image) error
CreatePatch creates a patch file storing the file differences between and image and the changes applied by the container using rsync. Note that this is a different approach than using thin_delta which is able to extract blocks directly by leveraging the metadata stored by the device mapper.
func (*DeviceMapper) GetDeviceSnapshot ¶
func (dmpr *DeviceMapper) GetDeviceSnapshot(ctx context.Context, snapKey string) (*DeviceSnapshot, error)
GetDeviceSnapshot returns the device mapper snapshot identified by the given snapKey.
func (*DeviceMapper) GetImageSnapshot ¶
func (dmpr *DeviceMapper) GetImageSnapshot(ctx context.Context, image containerd.Image) (*DeviceSnapshot, error)
GetImageSnapshot retrieves the device mapper snapshot for a given image.
func (*DeviceMapper) RemoveDeviceSnapshot ¶
func (dmpr *DeviceMapper) RemoveDeviceSnapshot(ctx context.Context, snapKey string) error
RemoveDeviceSnapshot removes the device mapper snapshot identified by the given snapKey. This is only necessary for snapshots created through CreateDeviceSnapshot since other snapshots are managed by containerd. The locking here also assumes this function is only used to remove snapshots that are a child and are only used by a single container.
func (*DeviceMapper) RestorePatch ¶
func (dmpr *DeviceMapper) RestorePatch(ctx context.Context, containerSnapKey, patchPath string) error
RestorePatch applies the file changes stored in the supplied patch file on top of the given container snapshot.
type DeviceSnapshot ¶
DeviceSnapshot represents a device mapper snapshot
func NewDeviceSnapshot ¶
func NewDeviceSnapshot(path string) *DeviceSnapshot
NewDeviceSnapshot initializes a new device mapper snapshot.
func (*DeviceSnapshot) GetDevicePath ¶
func (dsnp *DeviceSnapshot) GetDevicePath() string
func (*DeviceSnapshot) Mount ¶
func (dsnp *DeviceSnapshot) Mount(readOnly bool) (string, error)
Mount a snapshot device and returns the path where it is mounted. For better performance and efficiency, a snapshot is only mounted once and shared if it is already mounted.
func (*DeviceSnapshot) UnMount ¶
func (dsnp *DeviceSnapshot) UnMount() error
UnMount a device snapshot. Due to mounted snapshot being shared, a snapshot is only actually unmounted if it is not in use by anyone else.