Azure / Azure/data-api-builder

Hot-Reload of all DataSourceFiles

Abierto
#2,326 0 comentarios 0 reacciones 0 asignados Ver en GitHub
🔥Hot Reload enhancement
Lenguaje dominante
C#
Estrellas
1.5k
Forks
370
Merge medio
3 d 22 h
PR fusionados (30 d)
9

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con FileSystemRuntimeConfigLoader.cs y el procesamiento de la configuración de inicio para DataSourceFiles. Sigue cómo se analizan y supervisan el archivo raíz y los archivos adicionales, y verifica después que las entradas anidadas de DataSourceFiles se supervisen y que los cambios en cualquier archivo activen el hot-reload y la actualización de dependencias.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
csharp
Área
backend, databases
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.