执行时真实时钟与持久授权回读(撤销/过期即停并保留预备份)、写集合写前落盘、 租约与 attempt 身份、恢复队列与原发送身份分离、成功收尾必须释放维护后再登记终态。
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"knowledge-governance/internal/appconfig"
|
||||
"knowledge-governance/internal/governance"
|
||||
"knowledge-governance/internal/librarysnapshot"
|
||||
)
|
||||
|
||||
func configuredCaptureSource(config appconfig.Config, scope string) governance.LibrarySourceIdentity {
|
||||
kb := config.LibrarySourceInternalKB
|
||||
if scope == "external" {
|
||||
kb = config.LibrarySourceExternalKB
|
||||
}
|
||||
return governance.LibrarySourceIdentity{Project: config.SourceProject(), App: config.LibrarySourceApp, Scope: scope, TenantID: config.LibrarySourceTenantID, KnowledgeBaseID: kb}
|
||||
}
|
||||
func verifyCapturedSource(root, snapshotID string, source governance.LibrarySourceIdentity) error {
|
||||
if _, err := source.ID(); err != nil {
|
||||
return err
|
||||
}
|
||||
archive, err := librarysnapshot.Open(root, 256*1024*1024)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer archive.Close()
|
||||
manifest, err := archive.Load(snapshotID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if manifest.Scope != source.Scope || manifest.TenantID != source.TenantID || manifest.KnowledgeBaseID != source.KnowledgeBaseID {
|
||||
return errors.New("captured manifest differs from configured source")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user