| 61 | struct SocketSSLContext; |
| 62 | |
| 63 | struct ServerOptions { |
| 64 | ServerOptions(); // Constructed with default options. |
| 65 | |
| 66 | // connections without data transmission for so many seconds will be closed |
| 67 | // Default: -1 (disabled) |
| 68 | int idle_timeout_sec; |
| 69 | |
| 70 | // If this option is not empty, a file named so containing Process Id |
| 71 | // of the server will be created when the server is started. |
| 72 | // Default: "" |
| 73 | std::string pid_file; |
| 74 | |
| 75 | // Process requests in format of nshead_t + blob. |
| 76 | // Owned by Server and deleted in server's destructor. |
| 77 | // Default: NULL |
| 78 | NsheadService* nshead_service; |
| 79 | |
| 80 | // Process requests in format of thrift_binary_head_t + blob. |
| 81 | // Owned by Server and deleted in server's destructor. |
| 82 | // Default: NULL |
| 83 | ThriftService* thrift_service; |
| 84 | |
| 85 | // Adaptor for Mongo protocol, check src/brpc/mongo_service_adaptor.h for details |
| 86 | // The adaptor will not be deleted by server |
| 87 | // and must remain valid when server is running. |
| 88 | const MongoServiceAdaptor* mongo_service_adaptor; |
| 89 | |
| 90 | // Turn on authentication for all services if `auth' is not NULL. |
| 91 | // Default: NULL |
| 92 | const Authenticator* auth; |
| 93 | |
| 94 | // false: `auth' is not owned by server and must be valid when server is running. |
| 95 | // true: `auth' is owned by server and will be deleted when server is destructed. |
| 96 | // Default: false |
| 97 | bool server_owns_auth; |
| 98 | |
| 99 | // Turn on request interception if `interceptor' is not NULL. |
| 100 | // Default: NULL |
| 101 | const Interceptor* interceptor; |
| 102 | |
| 103 | // false: `interceptor' is not owned by server and must be valid when server is running. |
| 104 | // true: `interceptor' is owned by server and will be deleted when server is destructed. |
| 105 | // Default: false |
| 106 | bool server_owns_interceptor; |
| 107 | |
| 108 | // Number of pthreads that server runs on. Notice that this is just a hint, |
| 109 | // you can't assume that the server uses exactly so many pthreads because |
| 110 | // pthread workers are shared by all servers and channels inside a |
| 111 | // process. And there're no "io-thread" and "worker-thread" anymore, |
| 112 | // brpc automatically schedules "io" and "worker" code for better |
| 113 | // parallelism and less context switches. |
| 114 | // If this option <= 0, number of pthread workers is not changed. |
| 115 | // Default: #cpu-cores |
| 116 | int num_threads; |
| 117 | |
| 118 | // Server-level max concurrency. |
| 119 | // "concurrency" = "number of requests processed in parallel" |
| 120 | // |