Struct Config#

struct Config#

Init input parameters for initializing the openYuanRong system.

Note

When both Config fields and environment variables are set, Config parameters take precedence over environment variables.

Public Members

Mode mode = Mode::CLUSTER_MODE#

Deployment model.

Required. Supported values: LOCAL_MODE: Local mode (single-machine multi-threading), CLUSTER_MODE: Cluster mode (multi-machine multi-process).

std::vector<std::string> loadPaths#

Custom .so file paths.

Defaults to services.yaml if empty.

std::string functionUrn = ""#

Function ID returned after deploying C++ function.

Required in CLUSTER_MODE. The corresponding environment variable is YRFUNCID.

std::string pythonFunctionUrn = ""#

Function ID returned after deploying Python function.

Optional in CLUSTER_MODE. The corresponding environment variable is YR_PYTHON_FUNCID.

std::string javaFunctionUrn = ""#

Function ID returned after deploying Java function.

Optional in CLUSTER_MODE. The corresponding environment variable is YR_JAVA_FUNCID.

std::string serverAddr = ""#

openYuanRong cluster address.

Required in CLUSTER_MODE. The corresponding environment variable is YR_SERVER_ADDRESS.

std::string dataSystemAddr = ""#

Data system server address within the cluster.

Required in CLUSTER_MODE. The corresponding environment variable is YR_DS_ADDRESS.

bool enableServerMode = false#

true: function-proxy acts as server, false: runtime acts as server.

Default is false.

int threadPoolSize = 0#

Thread pool size.

Valid range: 1~64. If out of range, defaults to CPU cores count. Only used in ParallelFor.

uint32_t localThreadPoolSize = 10#

Local thread pool size.

Required in LOCAL_MODE. Valid range: 1-64. If out of range, defaults to CPU cores count. Default is 10.

int recycleTime = DEFAULT_RECYCLETIME#

Maximum idle time for instances.

Instances will be terminated if idle beyond this duration. Unit: seconds. Valid range: 1~3000. Defaults to 2 if not configured.

bool enableMTLS = false#

Enable mutual TLS for external clients.

Default is false.

std::string certificateFilePath = ""#

Client certificate file path.

std::string privateKeyPath = ""#

Client private key file path.

std::string verifyFilePath = ""#

Server certificate file path.

std::string metricsLogPath = ""#

Custom path for metrics logs.

The corresponding environment variable is YR_METRICS_LOG_PATH.

bool enableMetrics = true#

Whether to enable metrics collection.

false means disabled, true means enabled. Only effective within the cluster. Default is false. The corresponding environment variable is YR_ENABLE_METRICS.

int maxConcurrencyCreateNum = 100#

Max concurrent stateless instance creations.

Must be > 0. Default is 100.

uint32_t maxLogSizeMb = 0#

Optional.

Max single log file size (MB). Default 0 (if 0, it will ultimately be set to 40). Negative values throw exceptions. Log rotation every 30s. The corresponding environment variable is YR_MAX_LOG_SIZE_MB.

uint32_t maxLogFileNum = 0#

Optional.

Max rotated log files retained. Default 0 (if 0, it will ultimately be set to 20). Oldest files deleted when exceeded. The corresponding environment variable is YR_MAX_LOG_FILE_NUM.

bool logCompress = true#

Optional.

Compress rotated logs. Default is true. The corresponding environment variable is YR_LOG_COMPRESS.

std::string logLevel = ""#

Optional.

Log level: DEBUG, INFO, WARN, ERROR. Invalid values default to INFO. The corresponding environment variable is YR_LOG_LEVEL.

std::int32_t rpcTimeout = 30 * 60#

RPC timeout (seconds).

Must be >10. Default is 1800.

std::string logDir = ""#

Optional.

Client log directory (created if nonexistent).

std::string logPath = ""#

(Deprecated, use logDir) Optional.

Alternate log directory.

std::string workingDir = ""#

Absolute path to openYuanRong function directory (where service.yaml resides).

Empty by default.

std::string ns = ""#

Default namespace of this client’s function.

std::unordered_map<std::string, std::string> customEnvs#

Custom environment variables for runtime (only LD_LIBRARY_PATH supported).

std::string tenantId = ""#

Tenant ID.

struct ClientInfo#

Object returned by Init, containing runtime context metadata.

Public Members

std::string jobId#

The job id of the current context.

Each Init generates a random job id.

std::string version#

The version number of the current openYuanRong SDK.

std::string serverVersion#

The version number of the server obtained after successful connection initialization.