Versions in this module Expand all Collapse all v0 v0.1.0 May 11, 2026 Changes in this version + const ControlDevice + const FilterDevice + const V1ImagePrefix + const V2ImagePrefix + var ErrAlreadyExists = errors.New("blksnap: already exists") + var ErrCorrupted = errors.New("blksnap: snapshot corrupted") + var ErrInterrupted = errors.New("blksnap: interrupted") + var ErrNoData = errors.New("blksnap: no data available") + var ErrNoSpace = errors.New("blksnap: no space left on device") + var ErrNotFound = errors.New("blksnap: not found") + func CreateSnapshotV1(devices []DevID) (*Snapshot, UUID, error) + type APIVersion int + const APIV1 + const APIV2 + func Detect() (APIVersion, error) + func Detected() APIVersion + type CBTHandle struct + func NewCBT(devicePath string) (*CBTHandle, error) + func (c *CBTHandle) Close() error + func (c *CBTHandle) Data() ([]byte, error) + func (c *CBTHandle) DataChunked(chunkSize uint32, fn func(offset uint32, data []byte) error) error + func (c *CBTHandle) ErrorCode() (int32, error) + func (c *CBTHandle) Image() (string, error) + func (c *CBTHandle) Info() (CBTInfo, error) + type CBTInfo struct + BlockCount uint32 + BlockSize uint32 + ChangesNumber uint8 + DeviceCapacity uint64 + GenerationID UUID + type DevID struct + Major uint32 + Minor uint32 + type ModuleVersion struct + Build uint16 + Major uint16 + Minor uint16 + Revision uint16 + func (v ModuleVersion) String() string + type SectorRange struct + Count uint64 + Offset uint64 + type Service struct + func OpenService() (*Service, error) + func (s *Service) Close() error + func (s *Service) Collect() ([]UUID, error) + func (s *Service) FD() uintptr + func (s *Service) Version() (ModuleVersion, error) + type Session struct + func CreateSession(devices []string, diffStoragePath string, limitBytes uint64, ...) (*Session, error) + func (s *Session) CBTHandle(devicePath string) (*CBTHandle, error) + func (s *Session) Close() error + func (s *Session) Errors() ([]string, bool) + func (s *Session) ID() UUID + type SessionOption func(*sessionConfig) + func WithEventTimeout(d time.Duration) SessionOption + func WithLogger(logger *slog.Logger) SessionOption + type Snapshot struct + func CreateSnapshot(diffStorageFile string, limitBytes uint64) (*Snapshot, error) + func OpenSnapshot(id UUID) (*Snapshot, error) + func (s *Snapshot) Close() error + func (s *Snapshot) CollectImages() (map[DevID]DevID, error) + func (s *Snapshot) Destroy() error + func (s *Snapshot) ID() UUID + func (s *Snapshot) Take() error + func (s *Snapshot) WaitEvent(timeoutMs uint32) (SnapshotEvent, bool, error) + type SnapshotEvent struct + Code SnapshotEventCode + Corrupted *SnapshotEventCorrupted + NoSpace *SnapshotEventLowFreeSpace + TimeLabel int64 + type SnapshotEventCode int + const EventCorrupted + const EventLowFreeSpace + type SnapshotEventCorrupted struct + ErrorCode int32 + OrigDevIDMajor uint32 + OrigDevIDMinor uint32 + type SnapshotEventLowFreeSpace struct + RequestedSectors uint64 + type SnapshotImageInfo struct + ErrorCode int32 + Image string + type Tracker struct + func OpenTracker(devicePath string) (*Tracker, error) + func (t *Tracker) Attach() (bool, error) + func (t *Tracker) CBTInfo() (CBTInfo, error) + func (t *Tracker) Close() error + func (t *Tracker) Detach() error + func (t *Tracker) MarkDirty(ranges []SectorRange) error + func (t *Tracker) ReadCBTMap(offset, length uint32, dst []byte) error + func (t *Tracker) SnapshotAdd(id UUID) error + func (t *Tracker) SnapshotInfo() (SnapshotImageInfo, error) + func (t *Tracker) V1DevID() DevID + type UUID [16]byte + func MustParseUUID(s string) UUID + func ParseUUID(s string) (UUID, error) + func (u UUID) IsZero() bool + func (u UUID) String() string