MCPcopy Create free account
hub / github.com/apache/mesos / Server

Class Server

3rdparty/libprocess/include/process/http.hpp:1067–1181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1065
1066
1067class Server
1068{
1069public:
1070 // Options for creating a server.
1071 //
1072 // NOTE: until GCC 5.0 default member initializers prevented the
1073 // class from being an aggregate which prevented you from being able
1074 // to use aggregate initialization, thus we introduce and use
1075 // `DEFAULT_CREATE_OPTIONS` for the default parameter of `create`.
1076 struct CreateOptions
1077 {
1078 Scheme scheme;
1079 size_t backlog;
1080 };
1081
1082 static CreateOptions DEFAULT_CREATE_OPTIONS()
1083 {
1084 return {
1085 /* .scheme = */ Scheme::HTTP,
1086 /* .backlog = */ 16384,
1087 };
1088 };
1089
1090 // Options for stopping a server.
1091 //
1092 // NOTE: see note above as to why we have `DEFAULT_STOP_OPTIONS`.
1093 struct StopOptions
1094 {
1095 // During the grace period:
1096 // * No new sockets will be accepted (but on OS X they'll still queue).
1097 // * Existing sockets will be shut down for reads to prevent new
1098 // requests from arriving.
1099 // * Existing sockets will be shut down after already received
1100 // requests have their responses sent.
1101 // After the grace period connections will be forcibly shut down.
1102 Duration grace_period;
1103 };
1104
1105 static StopOptions DEFAULT_STOP_OPTIONS()
1106 {
1107 return {
1108 /* .grace_period = */ Seconds(0),
1109 };
1110 };
1111
1112 static Try<Server> create(
1113 network::Socket socket,
1114 std::function<Future<Response>(
1115 const network::Socket& socket,
1116 const Request&)>&& f,
1117 const CreateOptions& options = DEFAULT_CREATE_OPTIONS());
1118
1119 template <typename F>
1120 static Try<Server> create(
1121 network::Socket socket,
1122 F&& f,
1123 const CreateOptions& options = DEFAULT_CREATE_OPTIONS())
1124 {

Callers 1

createMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected