package v071 import ( "context" "errors" "knowledge-governance/internal/libraryrelease" ) // ErrProductionTargetUnconfigured 表示生产读/写适配器还没接线。 // 这是一个**显式缺项**,不是"暂时跳过":没有它就无法读生产当前状态、 // 无法建预备份、也无法验证或恢复,所以整条生产链路必须拒绝执行。 var ErrProductionTargetUnconfigured = errors.New("生产目标适配器未配置(需要生产端点、只读凭据与写入适配)") // ProductionLibraryTarget 是整库同步的生产目标实现占位。 // // 为什么先不做"半套"实现:读生产当前状态、写四类数据、验证与恢复必须同时成立, // 只实现其中一半会让链路看起来可用却无法回滚。接口在此固定,接线时只补实现。 type ProductionLibraryTarget struct { BaseURL string APIKeyFile string } func NewProductionLibraryTarget(baseURL, apiKeyFile string) (*ProductionLibraryTarget, error) { if baseURL == "" || apiKeyFile == "" { return nil, ErrProductionTargetUnconfigured } return &ProductionLibraryTarget{BaseURL: baseURL, APIKeyFile: apiKeyFile}, nil } func (t *ProductionLibraryTarget) Current(context.Context) (libraryrelease.CurrentState, error) { return libraryrelease.CurrentState{}, ErrProductionTargetUnconfigured } func (t *ProductionLibraryTarget) Apply(context.Context, libraryrelease.Stage, string) error { return ErrProductionTargetUnconfigured } func (t *ProductionLibraryTarget) Verify(context.Context, libraryrelease.Expectation) error { return ErrProductionTargetUnconfigured } func (t *ProductionLibraryTarget) Restore(context.Context, libraryrelease.BackupRef) error { return ErrProductionTargetUnconfigured } // ArchiveBackupStore 也还没接线:预备份必须读生产当前整库,同样的前置条件。 type ArchiveBackupStore struct{} func (ArchiveBackupStore) Prepare(context.Context, string, libraryrelease.CurrentState) (libraryrelease.BackupRef, error) { return libraryrelease.BackupRef{}, errors.New("生产预备份存储未配置(需要生产读取凭据与可独立恢复的备份目标)") }