package store import ( "context" "errors" "time" ) const ( OperationalLeaseOrphanScan = "mediamtx-orphan-scan" OperationalLeaseOrphanCleanup = "mediamtx-orphan-cleanup" OrphanOwnedStale = "owned_stale" OrphanUnowned = "unowned" ) var ErrOrphanScanNotFound = errors.New("orphan scan not found") type MediaPathOwnership struct { PathName string DeviceID string CurrentClaim bool } type OrphanFinding struct { PathName string Classification string DeviceID string Deleted bool } type OrphanScan struct { ID string InstanceID string ObservedCount int OwnedStaleCount int UnownedCount int SafetyAllowed bool SafetyReason string CompletedAt time.Time ExpiresAt time.Time Findings []OrphanFinding } type OrphanRepository interface { AcquireOperationalLease( context.Context, string, string, string, time.Time, time.Duration, ) (bool, error) ReleaseOperationalLease(context.Context, string, string, string, time.Time) error ListMediaPathOwnership(context.Context) ([]MediaPathOwnership, error) SaveOrphanScan(context.Context, OrphanScan, string, string) error GetOrphanScan(context.Context, string) (OrphanScan, error) RecordOrphanCleanup( context.Context, string, string, string, string, string, time.Time, ) error } var _ OrphanRepository = (*Postgres)(nil)