执行时真实时钟与持久授权回读(撤销/过期即停并保留预备份)、写集合写前落盘、 租约与 attempt 身份、恢复队列与原发送身份分离、成功收尾必须释放维护后再登记终态。
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"knowledge-governance/internal/appconfig"
|
||||
"knowledge-governance/internal/librarymaintenance"
|
||||
"knowledge-governance/internal/librarysnapshot"
|
||||
"knowledge-governance/internal/objectgateway"
|
||||
v071 "knowledge-governance/internal/releaseadapter/v071"
|
||||
"knowledge-governance/internal/releasebundle"
|
||||
)
|
||||
@@ -93,9 +94,25 @@ func newTarget(ctx context.Context, config appconfig.Config, scope scopeConfig)
|
||||
if err != nil {
|
||||
return nil, errors.New("生产对象存储配置无效")
|
||||
}
|
||||
if config.LibraryObjectGatewayURL == "" {
|
||||
return nil, errors.New("对象写入网关未配置:发布目标不允许直写对象存储")
|
||||
}
|
||||
var writer v071.ObjectStore = objects
|
||||
if config.LibraryObjectGatewayURL != "" || config.LibraryObjectGatewayToken != "" || config.LibraryObjectGatewayGrantDirectory != "" {
|
||||
identity := objectgateway.Digest([]byte(scope.s3.Provider + "\x00" + scope.s3.Endpoint + "\x00" + scope.s3.Bucket))
|
||||
client, err := objectgateway.NewClient(config.LibraryObjectGatewayURL, config.LibraryObjectGatewayToken, identity)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
gateway := &v071.GatewayObjectStore{Automatic: true, Claim: objectgateway.ClaimFromContext(ctx), Client: client, Provider: scope.s3.Provider, Bucket: scope.s3.Bucket, GrantDirectory: config.LibraryObjectGatewayGrantDirectory}
|
||||
if err := gateway.ConditionalCapability(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
writer = gateway
|
||||
}
|
||||
return v071.NewProductionLibraryTarget(ctx, v071.ProductionLibraryConfig{
|
||||
Postgres: config.LibraryProductionDatabaseURL, SearchURL: config.LibraryProductionElasticURL,
|
||||
SearchIndex: config.LibraryProductionIndex, Objects: objects, ObjectsReader: objects,
|
||||
SearchIndex: config.LibraryProductionIndex, Objects: writer, ObjectsReader: objects,
|
||||
ArchiveRoot: config.LibraryArchiveRoot,
|
||||
ObjectsBucket: config.LibraryProductionS3Bucket,
|
||||
MaxDocuments: 200000,
|
||||
|
||||
Reference in New Issue
Block a user