This commit is contained in:
@@ -20,6 +20,9 @@ import (
|
||||
)
|
||||
|
||||
const Format = "weknora-library-snapshot/v1"
|
||||
|
||||
// ArtifactAcceptancePolicy requires separate snapshot-bound semantic acceptance.
|
||||
const ArtifactAcceptancePolicy = "artifact-acceptance-v1"
|
||||
const maxManifestBytes = 16 * 1024 * 1024
|
||||
|
||||
type Part struct {
|
||||
@@ -39,13 +42,14 @@ type Compatibility struct {
|
||||
}
|
||||
|
||||
type Manifest struct {
|
||||
Compatibility Compatibility `json:"compatibility"`
|
||||
Format string `json:"format"`
|
||||
Scope string `json:"scope"`
|
||||
TenantID uint64 `json:"tenant_id"`
|
||||
KnowledgeBaseID string `json:"knowledge_base_id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Parts []Part `json:"parts"`
|
||||
ValidationPolicy string `json:"validation_policy,omitempty"`
|
||||
Compatibility Compatibility `json:"compatibility"`
|
||||
Format string `json:"format"`
|
||||
Scope string `json:"scope"`
|
||||
TenantID uint64 `json:"tenant_id"`
|
||||
KnowledgeBaseID string `json:"knowledge_base_id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Parts []Part `json:"parts"`
|
||||
}
|
||||
type Archive struct {
|
||||
root, blobs, versions *os.Root
|
||||
@@ -361,6 +365,9 @@ func identifier(s string) bool {
|
||||
}
|
||||
|
||||
func encodeManifest(m Manifest) ([]byte, error) {
|
||||
if m.ValidationPolicy != "" && m.ValidationPolicy != ArtifactAcceptancePolicy {
|
||||
return nil, errors.New("unsupported snapshot validation policy")
|
||||
}
|
||||
c := m.Compatibility
|
||||
if c.WeKnoraVersion != releasebundle.WeKnoraVersionV071 || c.SchemaVersion != releasebundle.WeKnoraMigrationV071 || c.RetrieverEngine != "elasticsearch_v8" || !identifier(c.EmbeddingModel) || c.EmbeddingDimension != releasebundle.EmbeddingDimensionV071 || !validDigest(c.IndexMappingSHA256) {
|
||||
return nil, errors.New("unsupported snapshot compatibility contract")
|
||||
|
||||
Reference in New Issue
Block a user