Documentation
¶
Index ¶
- Variables
- func Dedupe[T comparable](values []T) []T
- func DedupeAndSort(values []string) []string
- func FileNeedsSync(srcInfo os.FileInfo, dstPath string) bool
- func FileNeedsSyncInfo(srcInfo, dstInfo os.FileInfo) bool
- func FindInsertPosition[T any](items []T, anchor time.Time, timestamp func(T) time.Time) int
- func FirstNonZeroTime[T any](items []T, timestamp func(T) time.Time) time.Time
- func InsertAt[T any](items []T, index int, item T) []T
- func InsertSliceAt[T any](items []T, index int, inserted []T) []T
- func ProviderRawDir(archiveDir string, provider conv.Provider) string
- func SortedKeys(values map[string]struct{}) []string
- func StatDir(path string) (bool, error)
- func ValidateResumeTarget(target conv.ResumeTarget) error
- type Analysis
- type Backend
- type IncrementalLookup
- type IncrementalResolution
- type IncrementalResolver
- type Progress
- type SyncCandidate
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Dedupe ¶
func Dedupe[T comparable](values []T) []T
Dedupe returns a stable deduplicated copy of values.
func DedupeAndSort ¶
DedupeAndSort returns a sorted, deduplicated copy of values, skipping empty strings.
func FileNeedsSync ¶
FileNeedsSync returns true if the destination is missing, different, or older.
func FileNeedsSyncInfo ¶
FileNeedsSyncInfo compares pre-obtained source and destination file info. Use this when both infos are already available to avoid redundant stat calls.
func FindInsertPosition ¶
FindInsertPosition returns the index after the latest timestamp not after anchor.
func FirstNonZeroTime ¶
FirstNonZeroTime returns the first non-zero time from items, or zero if none found.
func InsertSliceAt ¶
InsertSliceAt inserts multiple items at the given index.
func ProviderRawDir ¶
ProviderRawDir returns the provider-specific raw archive path.
func SortedKeys ¶
SortedKeys returns the keys of a set as a sorted slice.
func ValidateResumeTarget ¶
func ValidateResumeTarget(target conv.ResumeTarget) error
ValidateResumeTarget applies the shared strict resume policy.
Types ¶
type Analysis ¶
type Analysis struct {
UnitsTotal int
FilesInspected int
Conversations int
NewConversations int
ToUpdate int
UpToDate int
SyncCandidates []string
}
Analysis describes provider-local import state before syncing raw files.
type Backend ¶
type Backend interface {
Provider() conv.Provider
Scan(ctx context.Context, rawDir string) ([]conv.Conversation, error)
Load(ctx context.Context, conversation conv.Conversation) (conv.Session, error)
Analyze(ctx context.Context, sourceDir, rawDir string, onProgress func(Progress)) (Analysis, error)
SyncCandidates(ctx context.Context, sourceDir, rawDir string) ([]SyncCandidate, error)
ResumeCommand(target conv.ResumeTarget) (*exec.Cmd, error)
}
Backend is the generic provider contract used by archive, canonical, and app.
type IncrementalLookup ¶
type IncrementalLookup interface {
ConversationByFilePath(ctx context.Context, provider conv.Provider, filePath string) (conv.Conversation, bool, error)
ConversationBySessionID(ctx context.Context, provider conv.Provider, sessionID string) (conv.Conversation, bool, error)
ConversationByCacheKey(ctx context.Context, cacheKey string) (conv.Conversation, bool, error)
}
IncrementalLookup provides canonical-store conversation lookups for provider-local targeted rebuild resolution.
type IncrementalResolution ¶
type IncrementalResolution struct {
Conversations []conv.Conversation
ReplaceCacheKeys []string
}
IncrementalResolution describes the exact conversations that should be replaced during a targeted canonical rebuild.
type IncrementalResolver ¶
type IncrementalResolver interface {
ResolveIncremental(
ctx context.Context,
rawDir string,
changedRawPaths []string,
lookup IncrementalLookup,
) (IncrementalResolution, error)
}
IncrementalResolver is an optional provider hook for targeted canonical rebuilds driven by changed raw paths.
type Progress ¶
type Progress struct {
Provider conv.Provider
UnitsCompleted int
UnitsTotal int
FilesInspected int
Conversations int
NewConversations int
ToUpdate int
CurrentUnit string
Err error
}
Progress reports provider-local analysis progress using provider-neutral terms.
type SyncCandidate ¶
SyncCandidate is a backend-owned raw-file sync plan item.