manifest

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB wraps the SQLite manifest database.

func Open

func Open(configDir string) (*DB, error)

Open opens (or creates) the manifest database.

func (*DB) Close

func (m *DB) Close() error

Close closes the database.

func (*DB) CountSyncedTo added in v0.5.0

func (m *DB) CountSyncedTo(destination string, count *int) error

CountSyncedTo counts the number of files synced to a given destination.

func (*DB) GetAnySyncedFiles added in v0.2.0

func (m *DB) GetAnySyncedFiles(deviceSerial string) ([]Entry, error)

GetAnySyncedFiles returns files synced to at least one destination for a device.

func (*DB) GetDeviceStats

func (m *DB) GetDeviceStats(deviceSerial string, numDestinations int) (DeviceStats, error)

GetDeviceStats returns sync statistics for a device.

func (*DB) GetFullySyncedFiles

func (m *DB) GetFullySyncedFiles(deviceSerial string, destinations []string) ([]Entry, error)

GetFullySyncedFiles returns files synced to ALL destinations for a device (safe to clean).

func (*DB) GetLocalSyncedFiles added in v0.2.0

func (m *DB) GetLocalSyncedFiles(destinations []string, anyDest bool) ([]Entry, error)

GetLocalSyncedFiles returns files with a local_path that have been synced to destinations. If anyDest is true, files synced to at least one destination are returned. If anyDest is false, only files synced to all given destinations are returned.

func (*DB) GetUnpushedFiles

func (m *DB) GetUnpushedFiles(destination string) ([]Entry, error)

GetUnpushedFiles returns files that have been pulled but not synced to the given destination.

func (*DB) IsFullySynced

func (m *DB) IsFullySynced(deviceSerial, remotePath string, destinations []string) (bool, error)

IsFullySynced checks if a file has been synced to all given destinations.

func (*DB) IsPulled

func (m *DB) IsPulled(deviceSerial, remotePath string, size, mtime int64) (bool, error)

IsPulled returns true if the file has been pulled (device_serial, remote_path, size, mtime match).

func (*DB) Path

func (m *DB) Path() string

Path returns the path to the manifest database file.

func (*DB) QueryByLocalPath added in v0.5.0

func (m *DB) QueryByLocalPath(localPath string) ([]Entry, error)

QueryByLocalPath returns all file entries with the given local_path.

func (*DB) RecordDestSync

func (m *DB) RecordDestSync(fileID int64, destination string) error

RecordDestSync marks a file as synced to a destination.

func (*DB) RecordPull

func (m *DB) RecordPull(deviceSerial, remotePath, localPath string, size, mtime int64) (int64, error)

RecordPull inserts or updates a file entry after pulling.

type DestSync

type DestSync struct {
	ID          int64
	FileID      int64
	Destination string
	SyncedAt    time.Time
}

DestSync records that a file has been synced to a destination.

type DeviceStats

type DeviceStats struct {
	TotalFiles  int
	PulledFiles int
	SyncedFiles int // fully synced to all destinations
}

DeviceStats returns sync statistics for a device.

type Entry

type Entry struct {
	ID           int64
	DeviceSerial string
	RemotePath   string
	LocalPath    string
	Size         int64
	MTime        int64
	SHA256       string
	PulledAt     *time.Time
}

Entry represents a synced file in the manifest.

Jump to

Keyboard shortcuts

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