跳到主要内容

Server HostingForking API Reference

DS Hosting & Management allows you to dynamically scale the DS (dedicated servers) you need, and the DS must integrate PgosSDK. Some games need to utilize the fork mechanism of the Linux platform into the creation process of ds instances to improve the utilization of idle memory resources. Currently, PGOS has supported this behavior for DS, which we have named the Shared-memory Mode for the DS Hosting service.

API List

APIDescription
ProcessReadySignals PGOS that the process is about to fork a number of child processes that could receive battle session placements. @param log_paths The log_paths includes the log paths that the server needs to upload. PGOS will upload these paths after interface ProcessEnding is called by a child process. The compressed size of the uploaded file cannot exceed 512 MBytes. The latest limitations can be viewed in the documentation: https://pgos.intlgame.com/pgosdoc/manual/limitations/service_limitations.html
QueryDsInstancePerCVMConfigQuery DS instance per cvm configuration of the fleet, which is the maximum effective number of (child) DS processes that users expect to run on the current CVM instance.
QueryAvailableDsInstanceCountQuery the number of (child) DS processes managed on the PGOS hosting service in the current CVM. This parameter can be used as a decision reference for the fork operation in the parent process.
LogMessageLog a message to POGS's log file @param message Log content
ProcessEndingSignals PGOS that the process is ending, and no child process will be forked any more. PGOS will kill the process by force if it do not exit in 2mins after ProcessEnding is called.

API Details

ProcessReady

Signals PGOS that the process is about to fork a number of child processes that could receive battle session placements. @param log_paths The log_paths includes the log paths that the server needs to upload. PGOS will upload these paths after interface ProcessEnding is called by a child process. The compressed size of the uploaded file cannot exceed 512 MBytes. The latest limitations can be viewed in the documentation: https://pgos.intlgame.com/pgosdoc/manual/limitations/service_limitations.html

/// <summary>
/// Signals PGOS that the process is about to fork a number of child processes that could receive battle session placements.
/// @param log_paths The log_paths includes the log paths that the server needs to upload. PGOS will upload these paths after interface ProcessEnding is called by a child process.
/// The compressed size of the uploaded file cannot exceed 512 MBytes. The latest limitations can be viewed in the documentation: https://pgos.intlgame.com/pgosdoc/manual/limitations/service_limitations.html
/// </summary>
public PgosResult ProcessReady(List<string> log_paths);

Parameters:

ParamTypeDescription
log_pathsList<string>

Return: PgosResult

QueryDsInstancePerCVMConfig

Query DS instance per cvm configuration of the fleet, which is the maximum effective number of (child) DS processes that users expect to run on the current CVM instance.

/// <summary>Query DS instance per cvm configuration of the fleet, which is the maximum effective number of (child) DS processes that users expect to run on the current CVM instance.</summary>
public Int32 QueryDsInstancePerCVMConfig();

Parameters:

(No parameters)

Return: Int32

QueryAvailableDsInstanceCount

Query the number of (child) DS processes managed on the PGOS hosting service in the current CVM. This parameter can be used as a decision reference for the fork operation in the parent process.

/// <summary>
/// Query the number of (child) DS processes managed on the PGOS hosting service in the current CVM.
/// This parameter can be used as a decision reference for the fork operation in the parent process.
/// </summary>
public Int32 QueryAvailableDsInstanceCount();

Parameters:

(No parameters)

Return: Int32

LogMessage

Log a message to POGS's log file @param message Log content

/// <summary>
/// Log a message to POGS's log file
/// @param message Log content
/// </summary>
public PgosResult LogMessage(string message);

Parameters:

ParamTypeDescription
messagestring

Return: PgosResult

ProcessEnding

Signals PGOS that the process is ending, and no child process will be forked any more. PGOS will kill the process by force if it do not exit in 2mins after ProcessEnding is called.

/// <summary>
/// Signals PGOS that the process is ending, and no child process will be forked any more.
/// PGOS will kill the process by force if it do not exit in 2mins after ProcessEnding is called.
/// </summary>
public PgosResult ProcessEnding();

Parameters:

(No parameters)

Return: PgosResult