Documentation
¶
Overview ¶
Package sync coordinates section-scoped synchronization between local specs and docs providers.
Index ¶
Constants ¶
const ( DirectionIn = "in" DirectionOut = "out" DirectionBoth = "both" )
Sync directions.
const ( ConflictWarn = "warn" ConflictAbort = "abort" ConflictForce = "force" ConflictSkip = "skip" )
Conflict strategies.
Variables ¶
var ErrSyncConflict = errors.New("sync conflicts detected")
ErrSyncConflict is returned when conflicts are found and the strategy is abort.
Functions ¶
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine coordinates sync through adapter interfaces and store APIs.
func NewEngine ¶
func NewEngine(docs adapter.DocsAdapter, db *store.DB) *Engine
NewEngine creates a sync engine.
func (*Engine) Finalize ¶
func (e *Engine) Finalize(ctx context.Context, prepared *PreparedRun) error
Finalize applies external docs writes, sync-state persistence, and activity logging.
type Options ¶
type Options struct {
SpecID string
SpecPath string
Direction string
ConflictStrategy string
OwnerRole string
UserName string
DryRun bool
}
Options configures one sync run.
type PreparedRun ¶
type PreparedRun struct {
Report *Report
// contains filtered or unexported fields
}
PreparedRun contains local changes and deferred external/state side effects.
type Report ¶
type Report struct {
SpecID string
Direction string
DryRun bool
OutboundPushed bool
InboundApplied []string
OutboundSections []string
Conflicts []SectionConflict
Skipped []SectionSkip
Unchanged []string
PageMissing bool
}
Report summarizes the outcome of a sync run.
func (Report) HasBlockingConflicts ¶
HasBlockingConflicts returns whether conflicts should block the command.
type SectionConflict ¶
type SectionConflict struct {
Section string
Owner string
LocalHash string
RemoteHash string
Reason string
}
SectionConflict describes a local/remote section conflict.
type SectionSkip ¶
SectionSkip describes a section that was intentionally not updated.