Azure / Azure/data-api-builder
Hot-Reload of all DataSourceFiles
- 主要言語
- C#
- スター
- 1.5k
- フォーク
- 370
- 平均マージ
- 3日 22時間
- マージ済み PR(30日)
- 9
説明
We provide an option of using many DataSource files, and therefore for the purpose of Hot-Reloading we need to monitor all of these DataSource files. In the case that they change, Hot-Reloading means updating this collection of DataSourceFiles, and refreshing their dependencies.
The configuration file that is provided to DAB on startup may contain a property, DataSourceFiles. In a single DB scenario, this property will be null. However, in a multi-db scenario, DataSourceFiles will be a list of additional files that contain the data source information for the additional DBs.
`public DataSourceFiles? DataSourceFiles { get; init; }`
///
/// DataSourceFiles is a record that contains a list of files defining the runtime configs for multi-db scenario.
/// SourceFiles is null for single-db scenario.
///
/// File names would match guidance as described in FileSystemRuntimeConfigLoader.cs
public record DataSourceFiles(IEnumerable? SourceFiles = null);
In order to correctly hot reload, we need to add file-monitoring to all of the data source files that are used as a part of a multi-db scenario, which should then trigger a hot-reload if any of those files are modified.
However, each data source file can itself contain a property DataSourceFiles, which means that we can treat the data sources that will be used in a multi-db scenario as existing in a tree structure, where the configuration file that was used to start dab is the root. We then need to file monitor that configuration file, and then parse out any of the additional files that the root config lists as DataSourceFiles. Each of those data source files then must be checked if they contain any additional data source files, and that process must repeat until we reach the data source files for which DataSourceFiles is null, the equivalent of leaves in the tree we are traversing.
When all files in the tree are being monitored, and any changes to any of them results in a hot-reload, then we will fully support hot-reloading in a multi-db scenario.
コントリビューションガイド
調査の方向性
FileSystemRuntimeConfigLoader.cs と DataSourceFiles の起動時の構成処理から始めます。ルートファイルと追加ファイルがどのように解析・監視されるかを追跡し、ネストされた DataSourceFiles エントリが監視され、いずれかのファイルへの変更によって hot-reload と依存関係の更新がトリガーされることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp
- 領域
- backend, databases
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100