Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
 
/// \file manifest_parser.h
/// \brief Internal parser that reads a model package from disk into the
///        in-memory representation defined in model_package_impl.h.
 
#pragma once
 
#include "model_package_impl.h"
#include "path_resolver.h"
 
namespace model_package {
 
/// Parse the manifest at `<package_root>/manifest.json` and all referenced
/// external component files, then populate `*pkg`. Caller owns `pkg`.
ModelPackageStatus* ParsePackage(const std::filesystem::path& package_root,
                                 const ModelPackageOpenOptions& opts,
                                 ModelPackage* pkg);
 
/// Parse a single variant body into `out`. Used by authoring.
ModelPackageStatus* ParseVariantBody(const std::filesystem::path& component_dir,
                                     const std::filesystem::path& package_root,
                                     const PathResolverOptions& opts,
                                     bool strict,
                                     const std::string& variant_name,
                                     const ordered_json& variant_body,
                                     VariantRecord* out);
 
/// Parse a single component body. `component_dir` is the directory used as the
/// base for the component's relative paths.
ModelPackageStatus* ParseComponentBody(const std::filesystem::path& package_root,
                                       const PathResolverOptions& opts,
                                       bool strict,
                                       const std::string& component_name,
                                       const ordered_json& body,
                                       const std::filesystem::path& component_dir,
                                       ComponentRecord* out);
 
/// Re-derive package-level metadata (schema_version, package_name, version,
/// description, layout, additional_metadata) from `pkg->manifest` into the
/// package's stable string buffers.
ModelPackageStatus* RefreshPackageMetadata(ModelPackage* pkg);
 
/// Re-derive `pkg->shared_assets` from `pkg->manifest.shared_assets` overrides,
/// plus any `sha256-<hex>` subdirectories discovered under
/// `<package_root>/shared_assets/`, plus any pending copy_in entries staged via
/// the authoring API. Clears and replaces the existing shared_assets vector
/// and `shared_asset_index_by_uri`.
ModelPackageStatus* RefreshSharedAssets(ModelPackage* pkg, const PathResolverOptions& opts);
 
/// Re-resolve every variant's executor_info entries into stable strings on the
/// VariantRecord (inline bodies dumped, external files loaded + JSON-parsed).
/// If `strict_missing_external` is true, missing external files are an error
/// (use at Open: the package is already published, files must be present);
/// if false, missing external files are recorded as an empty body (use during
/// authoring: callers may set the path before writing the file). Parse errors
/// on existing external files are always surfaced.
ModelPackageStatus* RefreshExecutorInfoCache(ModelPackage* pkg, bool strict_missing_external);
 
/// Build PathResolverOptions appropriate for `pkg` (respects layout).
PathResolverOptions PathOptionsFor(const ModelPackage* pkg);
 
}  // namespace model_package