Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
Loading...
Searching...
No Matches
native_ops_bridge.c File Reference

Bridges native ops commands to doctor, drift, deploy-check, and migration verification report generation. More...

#include "native_ops_bridge.h"
#include "native_artifact_emit.h"
#include "native_json_config.h"
#include "native_runtime_reports.h"
#include "native_shell_bridge.h"
#include "native_support.h"
#include "native_process_capture.h"
#include "native_migrate_verify.h"
#include "native_yyjson_helpers.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

Go to the source code of this file.

Macros

#define native_ops_strdup   strdup

Functions

static int native_environment_valid (const char *value)
static int native_command_exists (const char *command)
static int native_cross_deb_packaging_available (const char *repo_root)
static char * native_default_environment (const AppRuntime *app)
static char * native_default_backend (const AppRuntime *app)
static char * native_default_sqlite_path (const AppRuntime *app)
static char * native_capture_trimmed (char *const argv[], int *code_out)
static int native_identifier_safe (const char *value)
static int native_append_escaped_sql_char (Buffer *buffer, char value)
static char * native_sql_literal_escape (const char *value)
static const char * native_output_path_status (int file_exists, int file_writable, int parent_exists, int parent_writable)
static char * native_sqlite_query_value (const char *db_path, const char *sql)
static int native_sqlite_table_exists (const char *db_path, const char *table_name)
static long native_sqlite_table_row_count (const char *db_path, const char *table_name)
static long native_sqlite_migration_applied_count (const char *db_path, const char *migration_id, const char *backend)
static char * native_sqlite_migration_applied_schema_version (const char *db_path, const char *migration_id, const char *backend)
static char * native_sqlite_migration_applied_checksum (const char *db_path, const char *migration_id, const char *backend)
static char * native_output_path_check_json (const char *file_path, const char *label)
static char * native_db_check_json (const AppRuntime *app, const char *backend)
static char * build_native_app_config_report_local_json (const AppRuntime *app)
static char * build_runtime_summary_json_from_app (const AppRuntime *app)
static void append_app_common_flags (const ServeConfig *config, char *argv_list[], int *argc)
static char * native_build_sqlite_migrate_verify_failure_report_json (const ServeConfig *config, const AppRuntime *app, const char *error_text)
static int native_sqlite_migrate_verify_preflight_ok (const AppRuntime *app)
static char * capture_migrate_verify_report_json (const char *repo_root, const ServeConfig *config, const AppRuntime *app, const char *backend, char **status_out, char **error_out)
char * build_native_app_doctor_report_local_json (const char *repo_root, const ServeConfig *config, const char *artifact_dir, const AppRuntime *app, const char *host_target)
 Builds a JSON doctor report for one app using native ops bridges.
char * build_native_app_drift_report_local_json (const char *repo_root, const ServeConfig *config, const AppRuntime *app)
 Builds a JSON drift report for one app using native ops bridges.
char * build_native_app_deploy_check_report_local_json (const char *repo_root, const ServeConfig *config, const char *artifact_dir, const AppRuntime *app, const char *host_target)
 Builds a JSON deploy-check report for one app using native ops bridges.

Detailed Description

Bridges native ops commands to doctor, drift, deploy-check, and migration verification report generation.

Definition in file native_ops_bridge.c.

Macro Definition Documentation

◆ native_ops_strdup

Function Documentation

◆ append_app_common_flags()

void append_app_common_flags ( const ServeConfig * config,
char * argv_list[],
int * argc )
static

◆ build_native_app_config_report_local_json()

◆ build_native_app_deploy_check_report_local_json()

char * build_native_app_deploy_check_report_local_json ( const char * repo_root,
const ServeConfig * config,
const char * artifact_dir,
const AppRuntime * app,
const char * host_target )

Builds a JSON deploy-check report for one app using native ops bridges.

Parameters
repo_rootRepository root used to locate supporting assets.
configActive serve configuration.
artifact_dirActive artifact directory for the app.
appFinalized app runtime being inspected.
host_targetHost target label to report.
Returns
Newly allocated JSON report text, or NULL on failure.

Definition at line 860 of file native_ops_bridge.c.

References AppRuntime::app_id, build_native_app_doctor_report_local_json(), json_string_dup_native(), native_cross_deb_packaging_available(), and native_ops_strdup.

Referenced by handle_native_deploy_check_ops_command().

◆ build_native_app_doctor_report_local_json()

char * build_native_app_doctor_report_local_json ( const char * repo_root,
const ServeConfig * config,
const char * artifact_dir,
const AppRuntime * app,
const char * host_target )

Builds a JSON doctor report for one app using native ops bridges.

Parameters
repo_rootRepository root used to locate supporting assets.
configActive serve configuration.
artifact_dirActive artifact directory for the app.
appFinalized app runtime being inspected.
host_targetHost target label to report.
Returns
Newly allocated JSON report text, or NULL on failure.

Definition at line 790 of file native_ops_bridge.c.

References AppRuntime::app_id, build_native_app_config_report_local_json(), build_native_app_runtime_report_json(), build_runtime_summary_json_from_app(), capture_migrate_verify_report_json(), json_string_dup_native(), native_default_backend(), native_ops_strdup, and streq().

Referenced by build_native_app_deploy_check_report_local_json(), and handle_native_runtime_app_command().

◆ build_native_app_drift_report_local_json()

char * build_native_app_drift_report_local_json ( const char * repo_root,
const ServeConfig * config,
const AppRuntime * app )

Builds a JSON drift report for one app using native ops bridges.

Parameters
repo_rootRepository root used to locate supporting assets.
configActive serve configuration.
appFinalized app runtime being inspected.
Returns
Newly allocated JSON report text, or NULL on failure.

Definition at line 833 of file native_ops_bridge.c.

References AppRuntime::app_id, capture_migrate_verify_report_json(), json_string_dup_native(), native_default_backend(), native_ops_strdup, and streq().

Referenced by handle_native_drift_check_ops_command().

◆ build_runtime_summary_json_from_app()

◆ capture_migrate_verify_report_json()

◆ native_append_escaped_sql_char()

int native_append_escaped_sql_char ( Buffer * buffer,
char value )
static

Definition at line 152 of file native_ops_bridge.c.

References buffer_append().

Referenced by native_sql_literal_escape().

◆ native_build_sqlite_migrate_verify_failure_report_json()

◆ native_capture_trimmed()

char * native_capture_trimmed ( char *const argv[],
int * code_out )
static

Definition at line 124 of file native_ops_bridge.c.

References run_process_capture_native(), and trim_in_place().

Referenced by native_sqlite_query_value().

◆ native_command_exists()

int native_command_exists ( const char * command)
static

Definition at line 37 of file native_ops_bridge.c.

References native_ops_strdup.

Referenced by native_cross_deb_packaging_available().

◆ native_cross_deb_packaging_available()

int native_cross_deb_packaging_available ( const char * repo_root)
static

◆ native_db_check_json()

char * native_db_check_json ( const AppRuntime * app,
const char * backend )
static

◆ native_default_backend()

◆ native_default_environment()

char * native_default_environment ( const AppRuntime * app)
static

◆ native_default_sqlite_path()

char * native_default_sqlite_path ( const AppRuntime * app)
static

◆ native_environment_valid()

int native_environment_valid ( const char * value)
static

Definition at line 27 of file native_ops_bridge.c.

References streq().

Referenced by build_native_app_config_report_local_json().

◆ native_identifier_safe()

int native_identifier_safe ( const char * value)
static

◆ native_output_path_check_json()

char * native_output_path_check_json ( const char * file_path,
const char * label )
static

◆ native_output_path_status()

const char * native_output_path_status ( int file_exists,
int file_writable,
int parent_exists,
int parent_writable )
static

Definition at line 178 of file native_ops_bridge.c.

Referenced by native_output_path_check_json().

◆ native_sql_literal_escape()

◆ native_sqlite_migrate_verify_preflight_ok()

◆ native_sqlite_migration_applied_checksum()

char * native_sqlite_migration_applied_checksum ( const char * db_path,
const char * migration_id,
const char * backend )
static

◆ native_sqlite_migration_applied_count()

long native_sqlite_migration_applied_count ( const char * db_path,
const char * migration_id,
const char * backend )
static

◆ native_sqlite_migration_applied_schema_version()

char * native_sqlite_migration_applied_schema_version ( const char * db_path,
const char * migration_id,
const char * backend )
static

◆ native_sqlite_query_value()

char * native_sqlite_query_value ( const char * db_path,
const char * sql )
static

◆ native_sqlite_table_exists()

int native_sqlite_table_exists ( const char * db_path,
const char * table_name )
static

◆ native_sqlite_table_row_count()

long native_sqlite_table_row_count ( const char * db_path,
const char * table_name )
static

Definition at line 226 of file native_ops_bridge.c.

References native_identifier_safe(), and native_sqlite_query_value().